-
-
Save wooparadog/5bcfa151b867250bbce8b48036f89642 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/.venv/lib/python3.11/site-packages/requests/models.py", line 971, in json | |
return complexjson.loads(self.text, **kwargs) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/usr/lib/python3.11/json/__init__.py", line 346, in loads | |
return _default_decoder.decode(s) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/usr/lib/python3.11/json/decoder.py", line 337, in decode | |
obj, end = self.raw_decode(s, idx=_w(s, 0).end()) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode | |
raise JSONDecodeError("Expecting value", s, err.value) from None | |
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) | |
During handling of the above exception, another exception occurred: | |
Traceback (most recent call last): | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/modelbesttest.py", line 57, in <module> | |
response = response.json() | |
^^^^^^^^^^^^^^^ | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/.venv/lib/python3.11/site-packages/requests/models.py", line 975, in json | |
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) | |
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
if __name__ == "__main__": | |
url = "https://openapi.ali.modelbest.cn/openapi/v1/funcCall/chat/completions" | |
headers = { | |
"host": "openapi.ali.modelbest.cn", | |
"accept-encoding": "gzip, deflate, br", | |
"connection": "keep-alive", | |
"accept": "application/json", | |
"user-agent": "OpenAI/Python 1.9.0", | |
"x-stainless-lang": "python", | |
"x-stainless-package-version": "1.9.0", | |
"x-stainless-os": "MacOS", | |
"x-stainless-arch": "arm64", | |
"x-stainless-runtime": "CPython", | |
"x-stainless-runtime-version": "3.10.9", | |
"authorization": "Bearer hello", | |
"x-model-best-open-app-id": "ff332612-6da6-414d-9591-1ef4b1a1e888", | |
"x-stainless-async": "false", | |
} | |
json_data = { | |
"messages": [ | |
{"role": "user", "content": "hello, What is the weather like in beijing?"} | |
], | |
"model": "func-call-8b-32k-zhouge", | |
"temperature": 0.7, | |
"tool_choice": None, | |
"tools": [ | |
{ | |
"type": "function", | |
"function": { | |
"name": "get_current_weather", | |
"description": "Get the current weather", | |
"parameters": { | |
"type": "object", | |
"properties": { | |
"location": { | |
"type": "string", | |
"description": "The city and state, e.g. San Francisco, CA", | |
}, | |
"format": { | |
"type": "string", | |
"enum": ["celsius", "fahrenheit"], | |
"description": "The temperature unit to use. Infer this from the users location.", | |
}, | |
}, | |
"required": ["location", "format"], | |
}, | |
}, | |
} | |
], | |
} | |
response = requests.post(url=url, headers=headers, json=json_data, timeout=300) | |
print(response.content) | |
response = response.json() | |
print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment