mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-04 20:28:12 +08:00
fix: _convert_prompt_message_to_dict parameters err (#5716)
This commit is contained in:
parent
8e5569f773
commit
0bf4817474
@ -167,6 +167,7 @@ class WorkflowCycleManage(WorkflowIterationCycleManage):
|
|||||||
db.session.refresh(workflow_run)
|
db.session.refresh(workflow_run)
|
||||||
db.session.close()
|
db.session.close()
|
||||||
|
|
||||||
|
if trace_manager:
|
||||||
trace_manager.add_trace_task(
|
trace_manager.add_trace_task(
|
||||||
TraceTask(
|
TraceTask(
|
||||||
TraceTaskName.WORKFLOW_TRACE,
|
TraceTaskName.WORKFLOW_TRACE,
|
||||||
|
@ -93,7 +93,7 @@ class MoonshotLargeLanguageModel(OAIAPICompatLargeLanguageModel):
|
|||||||
}.intersection(model_schema.features or []):
|
}.intersection(model_schema.features or []):
|
||||||
credentials['function_calling_type'] = 'tool_call'
|
credentials['function_calling_type'] = 'tool_call'
|
||||||
|
|
||||||
def _convert_prompt_message_to_dict(self, message: PromptMessage) -> dict:
|
def _convert_prompt_message_to_dict(self, message: PromptMessage, credentials: Optional[dict] = None) -> dict:
|
||||||
"""
|
"""
|
||||||
Convert PromptMessage to dict for OpenAI API format
|
Convert PromptMessage to dict for OpenAI API format
|
||||||
"""
|
"""
|
||||||
|
@ -200,7 +200,7 @@ class NVIDIALargeLanguageModel(OAIAPICompatLargeLanguageModel):
|
|||||||
endpoint_url = str(URL(endpoint_url) / 'chat' / 'completions')
|
endpoint_url = str(URL(endpoint_url) / 'chat' / 'completions')
|
||||||
elif 'server_url' in credentials:
|
elif 'server_url' in credentials:
|
||||||
endpoint_url = server_url
|
endpoint_url = server_url
|
||||||
data['messages'] = [self._convert_prompt_message_to_dict(m) for m in prompt_messages]
|
data['messages'] = [self._convert_prompt_message_to_dict(m, credentials) for m in prompt_messages]
|
||||||
elif completion_type is LLMMode.COMPLETION:
|
elif completion_type is LLMMode.COMPLETION:
|
||||||
data['prompt'] = 'ping'
|
data['prompt'] = 'ping'
|
||||||
if 'endpoint_url' in credentials:
|
if 'endpoint_url' in credentials:
|
||||||
|
@ -582,7 +582,7 @@ class OAIAPICompatLargeLanguageModel(_CommonOAI_API_Compat, LargeLanguageModel):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _convert_prompt_message_to_dict(self, message: PromptMessage, credentials: dict = None) -> dict:
|
def _convert_prompt_message_to_dict(self, message: PromptMessage, credentials: Optional[dict] = None) -> dict:
|
||||||
"""
|
"""
|
||||||
Convert PromptMessage to dict for OpenAI API format
|
Convert PromptMessage to dict for OpenAI API format
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user