client = OpenAI(
api_key=os.environ[“OPENAI_API_KEY”],
base_url=os.environ[“OPENAI_API_BASE”]
)
my_assistant = client.beta.assistants.create(
instructions=“You are a personal math tutor. When asked a question, write and run Python code to answer the question.”,
name=“Math Tutor”,
tools=[{“type”: “code_interpreter”}],
model=“gpt-4”,
)
print(my_assistant)
I use my Open API “gpt-4-vision-preview” and it works, but when applying it to the Assistant API, it gives me errors like:
File “/Users/xiaokeai/Documents/GitHub/protein-retrieval-lm/test2.py”, line 27, in
my_assistant = client.beta.assistants.create(
File “/Users/xiaokeai/miniconda3/envs/aiagent1/lib/python3.10/site-packages/openai/resources/beta/assistants/assistants.py”, line 108, in create
return self._post(
File “/Users/xiaokeai/miniconda3/envs/aiagent1/lib/python3.10/site-packages/openai/_base_client.py”, line 1167, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File “/Users/xiaokeai/miniconda3/envs/aiagent1/lib/python3.10/site-packages/openai/_base_client.py”, line 856, in request
return self._request(
File “/Users/xiaokeai/miniconda3/envs/aiagent1/lib/python3.10/site-packages/openai/_base_client.py”, line 932, in _request
return self._retry_request(
File “/Users/xiaokeai/miniconda3/envs/aiagent1/lib/python3.10/site-packages/openai/_base_client.py”, line 980, in _retry_request
return self._request(
File “/Users/xiaokeai/miniconda3/envs/aiagent1/lib/python3.10/site-packages/openai/_base_client.py”, line 932, in _request
return self._retry_request(
File “/Users/xiaokeai/miniconda3/envs/aiagent1/lib/python3.10/site-packages/openai/_base_client.py”, line 980, in _retry_request
return self._request(
File “/Users/xiaokeai/miniconda3/envs/aiagent1/lib/python3.10/site-packages/openai/_base_client.py”, line 947, in _request
raise self._make_status_error_from_response(err.response) from None
openai.InternalServerError: Error code: 501 - {‘error’: {‘message’: ‘API not implemented’, ‘type’: ‘one_api_error’, ‘param’: ‘’, ‘code’: ‘api_not_implemented’}}
(aiagent1) xiaokeai@shoukas-MacBook-Air protein-retrieval-lm %