chore: apply ruff's pyupgrade linter rules to modernize Python code with targeted version (#2419)

This commit is contained in:
Bowen Liang 2024-02-09 15:21:33 +08:00 • committed by GitHub
commit 063191889d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
246 changed files with 912 additions and 937 deletions

View file

@ -5,7 +5,7 @@
"""
import json
from typing import List, cast
from typing import cast
from core.model_manager import ModelManager
from core.model_runtime.entities.llm_entities import LLMResult
@ -56,7 +56,7 @@ class ToolModelManager:
@staticmethod
def calculate_tokens(
tenant_id: str,
prompt_messages: List[PromptMessage]
prompt_messages: list[PromptMessage]
) -> int:
"""
calculate tokens from prompt messages and model parameters
@ -82,7 +82,7 @@ class ToolModelManager:
def invoke(
user_id: str, tenant_id: str,
tool_type: str, tool_name: str,
prompt_messages: List[PromptMessage]
prompt_messages: list[PromptMessage]
) -> LLMResult:
"""
invoke model with parameters in user's own context