mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
docs(api): add OpenAI modify assistant endpoint example and usage instructions
This commit is contained in:
parent
01c7feb87d
commit
d3b75abc86
1 changed files with 54 additions and 4 deletions
|
@ -17,15 +17,20 @@ LiteLLM currently covers:
|
|||
|
||||
|
||||
## **Supported Providers**:
|
||||
- [OpenAI](#quick-start)
|
||||
- [Azure OpenAI](#azure-openai)
|
||||
- [OpenAI-Compatible APIs](#openai-compatible-apis)
|
||||
- [Assistants API](#assistants-api)
|
||||
- [**Supported Providers**:](#supported-providers)
|
||||
- [Quick Start](#quick-start)
|
||||
- [SDK + PROXY](#sdk--proxy)
|
||||
- [Streaming](#streaming)
|
||||
- [👉 Proxy API Reference](#-proxy-api-reference)
|
||||
- [Azure OpenAI](#azure-openai)
|
||||
- [OpenAI-Compatible APIs](#openai-compatible-apis)
|
||||
|
||||
## Quick Start
|
||||
|
||||
Call an existing Assistant.
|
||||
|
||||
- Get the Assistant
|
||||
- Get the Assistant
|
||||
|
||||
- Create a Thread when a user starts a conversation.
|
||||
|
||||
|
@ -33,6 +38,8 @@ Call an existing Assistant.
|
|||
|
||||
- Run the Assistant on the Thread to generate a response by calling the model and the tools.
|
||||
|
||||
- Modify the Assistant's details if necessary (name, instructions, tools, etc.)
|
||||
|
||||
### SDK + PROXY
|
||||
<Tabs>
|
||||
<TabItem value="sdk" label="SDK">
|
||||
|
@ -80,6 +87,36 @@ assistants = get_assistants(custom_llm_provider="openai")
|
|||
# assistants = await aget_assistants(custom_llm_provider="openai")
|
||||
```
|
||||
|
||||
|
||||
**Modify the Assistant**
|
||||
|
||||
```python
|
||||
from litellm import modify_assistants, amodify_assistants
|
||||
|
||||
# setup env
|
||||
os.environ["OPENAI_API_KEY"] = "sk-.."
|
||||
|
||||
# Modify Assistant (sync)
|
||||
modified_assistant = modify_assistants(
|
||||
custom_llm_provider="openai",
|
||||
assistant_id="asst_S4IW1JplxrRtsb5sQOXmztf4",
|
||||
model="gpt-4o",
|
||||
name="Updated Python Assistant",
|
||||
instructions="You are an advanced Python tutor.",
|
||||
tools=[{"type": "code_interpreter"}],
|
||||
)
|
||||
|
||||
### ASYNC USAGE ###
|
||||
# modified_assistant = await amodify_assistants(
|
||||
# custom_llm_provider="openai",
|
||||
# assistant_id="asst_S4IW1JplxrRtsb5sQOXmztf4",
|
||||
# model="gpt-4o",
|
||||
# name="Updated Python Assistant",
|
||||
# instructions="You are an advanced Python tutor.",
|
||||
# tools=[{"type": "code_interpreter"}],
|
||||
# )
|
||||
```
|
||||
|
||||
**Create a Thread**
|
||||
|
||||
```python
|
||||
|
@ -246,6 +283,19 @@ curl http://0.0.0.0:4000/v1/threads/thread_abc123/runs \
|
|||
}'
|
||||
```
|
||||
|
||||
**Modify an Assistant**
|
||||
```bash
|
||||
curl -X PATCH "http://0.0.0.0:4000/v1/assistants/{assistant_id}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer sk-1234" \
|
||||
-d '{
|
||||
"name": "Updated Math Tutor",
|
||||
"instructions": "You are a Python coding expert who can solve complex math problems.",
|
||||
"tools": [{"type": "code_interpreter"}],
|
||||
"model": "gpt-4o"
|
||||
}'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue