Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改fixs的错误拼写 #204

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion XAgent/agent/tool_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def validate():
validate()
except Exception as e:
messages[0] = change_tool_call_description(messages[0],reverse=True)
tool_call_args = objgenerator.dynamic_json_fixs(
tool_call_args = objgenerator.dynamic_json_fixes(
broken_json=tool_call_args,
function_schema=tool_schema,
messages=messages,
Expand Down
4 changes: 2 additions & 2 deletions XAgent/ai_functions/request/obj_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _get_chatcompletion_request_func(self, request_type:str):
self.chatcompletion_request_funcs[request_type] = getattr(module,'chatcompletion_request')
return self.chatcompletion_request_funcs[request_type]

def dynamic_json_fixs(self, broken_json, function_schema, messages: list = [], error_message: str = None):
def dynamic_json_fixes(self, broken_json, function_schema, messages: list = [], error_message: str = None):
"""Attempts to fix invalid json and validate it against the function schema

Args:
Expand Down Expand Up @@ -158,7 +158,7 @@ def validate():
if not isinstance(arguments,str):
arguments = json5.dumps(arguments)
# give one opportunity to fix the json string
response = self.dynamic_json_fixs(arguments,function_schema,messages,str(e))
response = self.dynamic_json_fixes(arguments,function_schema,messages,str(e))
arguments = response['choices'][0]['message']['function_call']['arguments']
validate()

Expand Down