THUNLP-MT / StableToolBench

A new tool learning benchmark aiming at well-balanced stability and reality, based on ToolBench.
https://zhichengg.github.io/stb.github.io/
Apache License 2.0
81 stars 11 forks source link

requests.exceptions.ConnectionError: HTTPConnectionPool(host='8.218.239.54', port=8080 #8

Open lileishitou opened 2 months ago

lileishitou commented 2 months ago

import requests import json

url = 'http://0.0.0.0:8005/virtual'

data = {

"category": "Media",

"tool_name": "newapi_for_media",

"api_name": "url",

"tool_input": {'url': 'https://api.socialmedia.com/friend/photos'},

"strip": "",

"toolbench_key": "XXXXXXX"

}

data = { "category": "Search", "tool_name": "wiki_search", "api_name": "wiki_search", "tool_input": {'q': '老大是谁?'}, "strip": "", "toolbench_key": "XXXXX" }

headers = { 'accept': 'application/json', 'Content-Type': 'application/json', }

Make the POST request

response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.text)

已经有了toolbenchkey , 但是报下属错误:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='8.218.239.54', port=8080): Max retries exceeded with url: /rapidapi (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd8b84c8520>: Failed to establish a new connection: [Errno 110] Connection timed out'))

zhichengg commented 1 month ago

看上去是连接到toolbench服务器有些问题,你可以通过下面的代码测试toolbench的连接:

import requests

url  = "http://8.218.239.54:8080/rapidapi"
payload = {

    "category": "Food",
    "tool_name": "yummly",
    "api_name": "categories_list",
    "tool_input": "{}",
    "strip": "truncate",
    'toolbench_key': ''
}

headers = {'toolbench_key': ''}
response = requests.post(url, json=payload, headers=headers)
print(response.text)