-
-
Save wooparadog/cf0d2c8de803e95340ddd1a4edba856c 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/modelbesttest.py", line 38, in <module> | |
chat_completion = client.chat.completions.create( | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/.venv/lib/python3.11/site-packages/openai/_utils/_utils.py", line 271, in wrapper | |
return func(*args, **kwargs) | |
^^^^^^^^^^^^^^^^^^^^^ | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/.venv/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 659, in create | |
return self._post( | |
^^^^^^^^^^^ | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 1180, in post | |
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 869, in request | |
return self._request( | |
^^^^^^^^^^^^^^ | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 962, in _request | |
return self._process_response( | |
^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 1056, in _process_response | |
return api_response.parse() | |
^^^^^^^^^^^^^^^^^^^^ | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/.venv/lib/python3.11/site-packages/openai/_response.py", line 242, in parse | |
parsed = self._parse() | |
^^^^^^^^^^^^^ | |
File "/home/wooparadog/Codes/github.com/orion-arm-ai/orion/.venv/lib/python3.11/site-packages/openai/_response.py", line 195, in _parse | |
content_type, *_ = response.headers.get("content-type").split(";") | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
AttributeError: 'NoneType' object has no attribute 'split' |
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 openai | |
client = openai.OpenAI( | |
base_url="https://openapi.ali.modelbest.cn/openapi/v1/funcCall", | |
api_key="hello", | |
default_headers={ | |
"X-Model-Best-Open-App-Id": "ff332612-6da6-414d-9591-1ef4b1a1e888", | |
}, | |
) | |
messages = [{"role": "user", "content": "hello, What is the weather like in beijing?"}] | |
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"], | |
}, | |
}, | |
} | |
] | |
chat_completion = client.chat.completions.create( | |
model="func-call-80b-8k-0115", | |
messages=messages, | |
tools=tools, | |
tool_choice=None, | |
temperature=0.7, | |
timeout=100, | |
) | |
print(chat_completion) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment