AgentAssistant
This commit is contained in:
@@ -498,7 +498,7 @@ class AIAgent(BaseAIAgent):
|
||||
|
||||
|
||||
logger.debug(f"Agent {self.agent_id} do llm token static system:{system_prompt_len},function:{function_token_len},history:{history_token_len},input:{input_len}, totoal prompt:{system_prompt_len + function_token_len + history_token_len} ")
|
||||
task_result = await self.do_llm_complection(prompt,msg,inner_functions=inner_functions)
|
||||
task_result = await self.do_llm_complection(prompt,msg, env=self.owner_env,inner_functions=inner_functions)
|
||||
if task_result.result_code != ComputeTaskResultCode.OK:
|
||||
error_resp = msg.create_error_resp(task_result.error_str)
|
||||
return error_resp
|
||||
|
||||
@@ -74,7 +74,7 @@ class OpenAI_ComputeNode(ComputeNode):
|
||||
# function_call["arguments"] = message.function_call.arguments
|
||||
# function_call["name"] = message.function_call.name
|
||||
# result_msg["function_call"] = function_call
|
||||
|
||||
|
||||
# if message.tool_calls:
|
||||
# tool_calls = []
|
||||
# for tool_call in message.tool_calls:
|
||||
@@ -88,10 +88,10 @@ class OpenAI_ComputeNode(ComputeNode):
|
||||
|
||||
# tool_calls.append(tool_call_dict)
|
||||
# result_msg["tool_calls"] = message.tool_calls
|
||||
|
||||
|
||||
# result["message"] = result_msg
|
||||
return result
|
||||
|
||||
|
||||
def _image_2_text(self, task: ComputeTask):
|
||||
logger.info('openai image_2_text')
|
||||
# 本地图片处理
|
||||
@@ -138,7 +138,7 @@ class OpenAI_ComputeNode(ComputeNode):
|
||||
|
||||
async def _run_task(self, task: ComputeTask):
|
||||
task.state = ComputeTaskState.RUNNING
|
||||
|
||||
|
||||
result = ComputeTaskResult()
|
||||
result.result_code = ComputeTaskResultCode.ERROR
|
||||
result.set_from_task(task)
|
||||
@@ -157,7 +157,7 @@ class OpenAI_ComputeNode(ComputeNode):
|
||||
task.error_str = str(e)
|
||||
result.error_str = str(e)
|
||||
return result
|
||||
|
||||
|
||||
# resp = {
|
||||
# "object": "list",
|
||||
# "data": [
|
||||
@@ -215,7 +215,7 @@ class OpenAI_ComputeNode(ComputeNode):
|
||||
messages=prompts,
|
||||
response_format = response_format,
|
||||
functions=llm_inner_functions,
|
||||
max_tokens=result_token,
|
||||
# max_tokens=result_token,
|
||||
) # TODO: add temperature to task params?
|
||||
except Exception as e:
|
||||
logger.error(f"openai run LLM_COMPLETION task error: {e}")
|
||||
@@ -289,7 +289,7 @@ class OpenAI_ComputeNode(ComputeNode):
|
||||
model_name : str = task.params["model_name"]
|
||||
if model_name.startswith("gpt-"):
|
||||
return True
|
||||
|
||||
|
||||
if task.task_type == ComputeTaskType.IMAGE_2_TEXT:
|
||||
model_name : str = task.params["model_name"]
|
||||
if model_name.startswith("gpt-4"):
|
||||
|
||||
Reference in New Issue
Block a user