Added better instructions
This commit is contained in:
@@ -162,6 +162,17 @@ class OpenAICompatibleInferenceBot(InferenceBot):
|
||||
function_args_str = function_to_call.arguments
|
||||
|
||||
logging.info(f"Attempting to call tool: {function_name} with args: {function_args_str}")
|
||||
|
||||
if function_name not in self.functions:
|
||||
logging.warning(f"Tool function {function_name} not found in available functions.")
|
||||
tool_results_for_model.append({
|
||||
"role": "tool",
|
||||
"tool_call_id": tool_call_id,
|
||||
"name": function_name,
|
||||
"content": f"Error: Tool function {function_name} not found."
|
||||
})
|
||||
continue
|
||||
|
||||
try:
|
||||
# Arguments are already a string from the API, self.call_tool expects dict or string
|
||||
tool_response_content = self.call_tool(function_name, function_args_str)
|
||||
@@ -371,13 +382,15 @@ def main():
|
||||
system_prompt_path=system_prompt_path,
|
||||
allowed_function_tags=allowed_function_tags
|
||||
)
|
||||
messenger_helper_class = importlib.import_module(f'{messenger.lower()}_helper')
|
||||
full_code_file = importlib.import_module(f'{messenger.lower()}_helper')
|
||||
messenger_helper_class_name = f"{messenger.capitalize()}Helper"
|
||||
if not hasattr(messenger_helper_class, messenger_helper_class_name):
|
||||
raise ValueError(f"Messenger helper class {messenger_helper_class_name} not found in {messenger_helper_class.__name__}.")
|
||||
messenger_helper_class = getattr(messenger_helper_class, messenger_helper_class_name)
|
||||
if not hasattr(full_code_file, messenger_helper_class_name):
|
||||
messenger_helper_class_name = f"{messenger.upper()}Helper"
|
||||
if not hasattr(full_code_file, messenger_helper_class_name):
|
||||
raise ValueError(f"Messenger helper class {messenger_helper_class_name} not found in {full_code_file.__name__}.")
|
||||
helper_class = getattr(full_code_file, messenger_helper_class_name)
|
||||
|
||||
helper = messenger_helper_class(bot)
|
||||
helper = helper_class(bot)
|
||||
helper.run()
|
||||
except ValueError as e:
|
||||
logging.error(f"FATAL: {e}")
|
||||
|
||||
Reference in New Issue
Block a user