chore: apply ruff's pyflakes linter rules (#2420)

This commit is contained in:
Bowen Liang
2024-02-08 14:11:10 +08:00
committed by GitHub
parent 1b04382a9b
commit 14a19a3da9
34 changed files with 91 additions and 86 deletions

View File

@@ -39,13 +39,13 @@ class ToolModelManager:
)
if not model_instance:
raise InvokeModelError(f'Model not found')
raise InvokeModelError('Model not found')
llm_model = cast(LargeLanguageModel, model_instance.model_type_instance)
schema = llm_model.get_model_schema(model_instance.model, model_instance.credentials)
if not schema:
raise InvokeModelError(f'No model schema found')
raise InvokeModelError('No model schema found')
max_tokens = schema.model_properties.get(ModelPropertyKey.CONTEXT_SIZE, None)
if max_tokens is None:
@@ -69,7 +69,7 @@ class ToolModelManager:
)
if not model_instance:
raise InvokeModelError(f'Model not found')
raise InvokeModelError('Model not found')
llm_model = cast(LargeLanguageModel, model_instance.model_type_instance)
@@ -156,7 +156,7 @@ class ToolModelManager:
except InvokeConnectionError as e:
raise InvokeModelError(f'Invoke connection error: {e}')
except InvokeAuthorizationError as e:
raise InvokeModelError(f'Invoke authorization error')
raise InvokeModelError('Invoke authorization error')
except InvokeServerUnavailableError as e:
raise InvokeModelError(f'Invoke server unavailable error: {e}')
except Exception as e: