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

[Bug] Mismatch between api_list and tool_descriptions in class rapidapi_wrapper Initialization #305

Open
yuyq18 opened this issue Sep 4, 2024 · 0 comments

Comments

@yuyq18
Copy link

yuyq18 commented Sep 4, 2024

In the initialization code of the rapidapi_wrapper class located in toolbench/inference/Downstream_tasks/rapidapi.py (lines 77-82):

if self.retriever is not None:
    query_json = self.retrieve_rapidapi_tools(self.input_description, args.retrieved_api_nums, args.tool_root_dir)
    data_dict = self.fetch_api_json(query_json)
    tool_descriptions = self.build_tool_description(data_dict)
else:
    data_dict = self.fetch_api_json(query_json)

When self.retriever is None, the data_dict is passed through the fetch_api_json function, but tool_descriptions is not built from the filtered data_dict (unlike the code in the if branch). This results in a mismatch between api_list and tool_descriptions when constructing the function lists later on (lines 84-85).

Here is the relevant code in toolbench/inference/Downstream_tasks/rapidapi.py (lines 84-91):

for k,api_json in enumerate(data_dict["api_list"]):
    standard_tool_name = tool_descriptions[k][0]
    openai_function_json,cate_name, pure_api_name = self.api_json_to_openai_json(api_json,standard_tool_name)
    self.functions.append(openai_function_json)

    self.api_name_reflect[openai_function_json["name"]] = pure_api_name
    self.tool_names.append(standard_tool_name)
    self.cate_names.append(cate_name)

This bug causes significant issues with prompt construction and function calling to the RapidAPI server, as the mismatch between api_list and tool_descriptions can lead to wrong function lists and subsequent wrong API requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant