Compare commits

...

5 Commits

Author SHA1 Message Date
Yeuoly
85fd710fa0 fix: check if file is MessageFile 2024-01-23 23:06:28 +08:00
Yeuoly
e19ae829c7 fix: division or modulo by zero 2024-01-23 22:10:08 +08:00
Yeuoly
fc7b5f544e fix: remove logger 2024-01-23 21:46:04 +08:00
Yeuoly
c7f17943ab fix: None type in cot assistant app 2024-01-23 21:40:17 +08:00
Yeuoly
543f42caf0 fix: None type in cot assistant app 2024-01-23 21:38:35 +08:00
4 changed files with 6 additions and 7 deletions

View File

@@ -473,7 +473,7 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):
result = ''
for scratchpad in agent_scratchpad:
result += scratchpad.thought + next_iteration.replace("{{observation}}", scratchpad.observation) + "\n"
result += scratchpad.thought + next_iteration.replace("{{observation}}", scratchpad.observation or '') + "\n"
return result
@@ -543,7 +543,7 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):
# add assistant message
if len(agent_scratchpad) > 0:
prompt_messages.append(AssistantPromptMessage(
content=agent_scratchpad[-1].thought + "\n" + agent_scratchpad[-1].observation
content=(agent_scratchpad[-1].thought or '') + "\n" + (agent_scratchpad[-1].observation or '')
))
# add user message

View File

@@ -172,7 +172,6 @@ class AssistantFunctionCallApplicationRunner(BaseAssistantApplicationRunner):
for tool_call_id, tool_call_name, tool_call_args in tool_calls:
tool_instance = tool_instances.get(tool_call_name)
if not tool_instance:
logger.error(f"failed to find tool instance: {tool_call_name}")
tool_response = {
"tool_call_id": tool_call_id,
"tool_call_name": tool_call_name,
@@ -220,7 +219,6 @@ class AssistantFunctionCallApplicationRunner(BaseAssistantApplicationRunner):
if error_response:
observation = error_response
logger.error(error_response)
tool_response = {
"tool_call_id": tool_call_id,
"tool_call_name": tool_call_name,

View File

@@ -128,8 +128,9 @@ class MessageFileParser:
# group by file type and convert file args or message files to FileObj
for file in files:
if file.belongs_to == FileBelongsTo.ASSISTANT.value:
continue
if isinstance(file, MessageFile):
if file.belongs_to == FileBelongsTo.ASSISTANT.value:
continue
file_obj = self._to_file_obj(file, file_upload_config)
if file_obj.type not in type_file_objs:

View File

@@ -33,7 +33,7 @@ class YahooFinanceAnalyticsTool(BuiltinTool):
stock_data = download(symbol, start=time_range[0], end=time_range[1])
max_segments = min(15, len(stock_data))
rows_per_segment = len(stock_data) // max_segments
rows_per_segment = len(stock_data) // (max_segments or 1)
summary_data = []
for i in range(max_segments):
start_idx = i * rows_per_segment