mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +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,7 +17,12 @@ LiteLLM currently covers:
|
||||||
|
|
||||||
|
|
||||||
## **Supported Providers**:
|
## **Supported Providers**:
|
||||||
- [OpenAI](#quick-start)
|
- [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)
|
- [Azure OpenAI](#azure-openai)
|
||||||
- [OpenAI-Compatible APIs](#openai-compatible-apis)
|
- [OpenAI-Compatible APIs](#openai-compatible-apis)
|
||||||
|
|
||||||
|
@ -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.
|
- 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
|
### SDK + PROXY
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<TabItem value="sdk" label="SDK">
|
<TabItem value="sdk" label="SDK">
|
||||||
|
@ -80,6 +87,36 @@ assistants = get_assistants(custom_llm_provider="openai")
|
||||||
# assistants = await aget_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**
|
**Create a Thread**
|
||||||
|
|
||||||
```python
|
```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>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue