OpenBMB / ToolBench

[ICLR'24 spotlight] An open platform for training, serving, and evaluating large language model for tool learning.
https://openbmb.github.io/ToolBench/
Apache License 2.0
4.83k stars 419 forks source link

Your URL of the tool is invalid. #6

Closed gLinxi closed 1 year ago

gLinxi commented 1 year ago

When I followed the readme document to execute the initial environment, I was able to successfully deploy local_tools to 127.0.0.1:8079. Only the api-keys for weather and openai were filled in, and the weather tool was loaded. However, when I executed inference_single_tools.py, I encountered the following error messages. How can I solve this problem?

python toolbench/inference/inference_single_tool.py --tool_name weather --model_path /data/jupyterlab/xxx/llama/model/7B --lora_path /data/jupyterlab/xxx/ToolBench/model_lora/ToolLLaMA will register chemical-prop will register douban-film will register wikidata will register stock will register weather will register wikipedia will register wolframalpha will register office-ppt will register bing_search will register bing_map will register baidu_map will register nllb-translation will register baidu-translation will register tutorial will register file_operation will register meta_analysis will register database will register db_diag will register code_interpreter will register hugging_tools will register arxiv will register zillow will register google_scholar will register google_places will register google_serper will register python will register sceneXplain will register shell will register image_generation will register airbnb will register job_search will register gradio_tools will register travel will register walmart weather http://127.0.0.1:8079/tools/weather/ Traceback (most recent call last): File "/data/jupyterlab/xxx/ToolBench/toolbench/inference/inference_single_tool.py", line 123, in main() File "/data/jupyterlab/xxx/ToolBench/toolbench/inference/inference_single_tool.py", line 109, in main tools_name, tools_config = load_single_tools(args.tool_name, tool_url) File "/data/jupyterlab/xxx/ToolBench/toolbench/inference/inference_single_tool.py", line 53, in load_single_tools raise RuntimeError("Your URL of the tool is invalid.")

-- server python BMTools/host_local_tools.py will register chemical-prop will register douban-film will register wikidata will register stock will register weather will register wikipedia will register wolframalpha will register office-ppt will register bing_search will register bing_map will register baidu_map will register nllb-translation will register baidu-translation will register tutorial will register file_operation will register meta_analysis will register database will register db_diag will register code_interpreter will register hugging_tools will register arxiv will register zillow will register google_scholar will register google_places will register google_serper will register python will register sceneXplain will register shell will register image_generation will register airbnb will register job_search will register gradio_tools will register travel will register walmart ['chemical-prop', 'douban-film', 'wikidata', 'stock', 'weather', 'wikipedia', 'wolframalpha', 'office-ppt', 'bing_search', 'bing_map', 'baidu_map', 'nllb-translation', 'baidu-translation', 'tutorial', 'file_operation', 'meta_analysis', 'database', 'db_diag', 'code_interpreter', 'hugging_tools', 'arxiv', 'zillow', 'google_scholar', 'google_places', 'google_serper', 'python', 'sceneXplain', 'shell', 'image_generation', 'airbnb', 'job_search', 'gradio_tools', 'travel', 'walmart'] will build weather INFO: Started server process [12334] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:8079 (Press CTRL+C to quit) INFO: 127.0.0.1:37162 - "GET / HTTP/1.1" 200 OK INFO: 127.0.0.1:45752 - "GET /tools HTTP/1.1" 404 Not Found INFO: 127.0.0.1:60902 - "GET /tools/weather HTTP/1.1" 307 Temporary Redirect INFO: 127.0.0.1:53110 - "GET /tools/weather HTTP/1.1" 307 Temporary Redirect

pooruss commented 1 year ago

Maybe you can check the BMTools/bmtools/tools/weather/api.py in your code to see if it's the same as here. The api name should be get_weather_today or forecast_weather, instead of /tools/weather.

Here is a successful server response: INFO: Started server process [3382212] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8079 (Press CTRL+C to quit) INFO: 127.0.0.1:38464 - "GET /.well-known/ai-plugin.json HTTP/1.1" 200 OK INFO: 127.0.0.1:60290 - "GET /openapi.json HTTP/1.1" 200 OK INFO: 127.0.0.1:48920 - "GET /get_weather_today?location=London HTTP/1.1" 200 OK

iseesaw commented 1 year ago
    NAME2URL = {
        'weather':  "http://127.0.0.1:8079/tools/weather/"
    }
    if args.tool_name not in NAME2URL:
        tool_url = f"http://127.0.0.1:8079/tools/{args.tool_name}/"
    else:
        tool_url = NAME2URL[args.tool_name]
    tools_name, tools_config = load_single_tools(args.tool_name, tool_url)

It works just when we remove /tools/{args.tool_name}/

iseesaw commented 1 year ago

Should I write a route named .well-known/ai-plugin.json for each tool? When I run database tool, /.well-known/ai-plugin.json returns:

{
 'schema_version': 'v1', 
 'name_for_human': 'BMTools', 
 'name_for_model': 'BMTools', 
 'description_for_human': 'tools to big models', 
 'description_for_model': 'tools to big models', 
 'auth': {'type': 'none'}, 
 'api': {'type': 'openapi', 'url': '/openapi.json', 'is_user_authenticated': False}, 'logo_url': None, 'contact_email': '', 'legal_info_url': ''}

and raise exceptions:

requests.exceptions.MissingSchema: Invalid URL '/openapi.json': No scheme supplied. Perhaps you meant http:///openapi.json?