BerriAI / litellm

Python SDK, Proxy Server (LLM Gateway) to call 100+ LLM APIs in OpenAI format - [Bedrock, Azure, OpenAI, VertexAI, Cohere, Anthropic, Sagemaker, HuggingFace, Replicate, Groq]
https://docs.litellm.ai/docs/
Other
14.57k stars 1.71k forks source link

[Bug]: assistant api retrieve/modify not work #6977

Open elvis-cai opened 1 day ago

elvis-cai commented 1 day ago

What happened?

cat test.py
import logging
from openai import OpenAI

logging.info("Initializing OpenAI client...")
client = OpenAI(
    base_url="https://litellm.ai.gcp-sg.dev.awx.im",
    api_key="sk-xxxx"
)

my_assistant = client.beta.assistants.retrieve("asst_abc123")
print(my_assistant)
Traceback (most recent call last):
  File "/opt/nihao/gcp/ai-platform/ai-gateway/litellm/a.py", line 11, in <module>
    my_assistant = client.beta.assistants.retrieve("asst_abc123")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/openai/resources/beta/assistants.py", line 184, in retrieve
    return self._get(
           ^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/openai/_base_client.py", line 1206, in get
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/openai/_base_client.py", line 937, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/openai/_base_client.py", line 1041, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.APIStatusError: Error code: 405 - {'detail': 'Method Not Allowed'}

Relevant log output

Traceback (most recent call last):
  File "/opt/nihao/gcp/ai-platform/ai-gateway/litellm/a.py", line 11, in <module>
    my_assistant = client.beta.assistants.retrieve("asst_abc123")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/openai/resources/beta/assistants.py", line 184, in retrieve
    return self._get(
           ^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/openai/_base_client.py", line 1206, in get
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/openai/_base_client.py", line 937, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/openai/_base_client.py", line 1041, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.APIStatusError: Error code: 405 - {'detail': 'Method Not Allowed'}

Is there any plan to support assistant retrieval?

Twitter / LinkedIn details

No response

elvis-cai commented 1 day ago

same for client.beta.assistants.update