From 415022aa1486ead1383b483dc6ddfed842ae214f Mon Sep 17 00:00:00 2001 From: takatost Date: Fri, 14 Jun 2024 03:05:04 +0800 Subject: [PATCH] fix: pydantic2 error (#5172) --- api/core/app/apps/agent_chat/app_generator.py | 2 +- api/core/app/apps/chat/app_generator.py | 2 +- api/core/app/apps/completion/app_generator.py | 4 ++-- api/core/model_runtime/model_providers/google/llm/llm.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/core/app/apps/agent_chat/app_generator.py b/api/core/app/apps/agent_chat/app_generator.py index fb4c28a855..407fb931ec 100644 --- a/api/core/app/apps/agent_chat/app_generator.py +++ b/api/core/app/apps/agent_chat/app_generator.py @@ -107,7 +107,7 @@ class AgentChatAppGenerator(MessageBasedAppGenerator): application_generate_entity = AgentChatAppGenerateEntity( task_id=str(uuid.uuid4()), app_config=app_config, - model_config=ModelConfigConverter.convert(app_config), + model_conf=ModelConfigConverter.convert(app_config), conversation_id=conversation.id if conversation else None, inputs=conversation.inputs if conversation else self._get_cleaned_inputs(inputs, app_config), query=query, diff --git a/api/core/app/apps/chat/app_generator.py b/api/core/app/apps/chat/app_generator.py index 4ad26e8506..505ada09db 100644 --- a/api/core/app/apps/chat/app_generator.py +++ b/api/core/app/apps/chat/app_generator.py @@ -104,7 +104,7 @@ class ChatAppGenerator(MessageBasedAppGenerator): application_generate_entity = ChatAppGenerateEntity( task_id=str(uuid.uuid4()), app_config=app_config, - model_config=ModelConfigConverter.convert(app_config), + model_conf=ModelConfigConverter.convert(app_config), conversation_id=conversation.id if conversation else None, inputs=conversation.inputs if conversation else self._get_cleaned_inputs(inputs, app_config), query=query, diff --git a/api/core/app/apps/completion/app_generator.py b/api/core/app/apps/completion/app_generator.py index 31ce4d70b6..52d907b535 100644 --- a/api/core/app/apps/completion/app_generator.py +++ b/api/core/app/apps/completion/app_generator.py @@ -98,7 +98,7 @@ class CompletionAppGenerator(MessageBasedAppGenerator): application_generate_entity = CompletionAppGenerateEntity( task_id=str(uuid.uuid4()), app_config=app_config, - model_config=ModelConfigConverter.convert(app_config), + model_conf=ModelConfigConverter.convert(app_config), inputs=self._get_cleaned_inputs(inputs, app_config), query=query, files=file_objs, @@ -257,7 +257,7 @@ class CompletionAppGenerator(MessageBasedAppGenerator): application_generate_entity = CompletionAppGenerateEntity( task_id=str(uuid.uuid4()), app_config=app_config, - model_config=ModelConfigConverter.convert(app_config), + model_conf=ModelConfigConverter.convert(app_config), inputs=message.inputs, query=message.query, files=file_objs, diff --git a/api/core/model_runtime/model_providers/google/llm/llm.py b/api/core/model_runtime/model_providers/google/llm/llm.py index 2dfde70816..c934c54634 100644 --- a/api/core/model_runtime/model_providers/google/llm/llm.py +++ b/api/core/model_runtime/model_providers/google/llm/llm.py @@ -313,7 +313,7 @@ class GoogleLargeLanguageModel(LargeLanguageModel): delta=LLMResultChunkDelta( index=index, message=assistant_prompt_message, - finish_reason=chunk.candidates[0].finish_reason, + finish_reason=str(chunk.candidates[0].finish_reason), usage=usage ) )