forked from phoenix/litellm-mirror
docs - assistants api
This commit is contained in:
parent
ba334ff8b9
commit
ed5cc86e8f
1 changed files with 45 additions and 0 deletions
|
@ -6,6 +6,7 @@ import TabItem from '@theme/TabItem';
|
|||
Covers Threads, Messages, Assistants.
|
||||
|
||||
LiteLLM currently covers:
|
||||
- Create Assistants
|
||||
- Get Assistants
|
||||
- Create Thread
|
||||
- Get Thread
|
||||
|
@ -28,6 +29,34 @@ Call an existing Assistant.
|
|||
<Tabs>
|
||||
<TabItem value="sdk" label="SDK">
|
||||
|
||||
**Create an Assistant**
|
||||
|
||||
|
||||
```python
|
||||
import litellm
|
||||
import os
|
||||
|
||||
# setup env
|
||||
os.environ["OPENAI_API_KEY"] = "sk-.."
|
||||
|
||||
assistant = litellm.create_assistants(
|
||||
custom_llm_provider="openai",
|
||||
model="gpt-4-turbo",
|
||||
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"}],
|
||||
)
|
||||
|
||||
### ASYNC USAGE ###
|
||||
# assistant = await litellm.acreate_assistants(
|
||||
# custom_llm_provider="openai",
|
||||
# model="gpt-4-turbo",
|
||||
# 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"}],
|
||||
# )
|
||||
```
|
||||
|
||||
**Get the Assistant**
|
||||
|
||||
```python
|
||||
|
@ -145,6 +174,22 @@ $ litellm --config /path/to/config.yaml
|
|||
# RUNNING on http://0.0.0.0:4000
|
||||
```
|
||||
|
||||
|
||||
**Create the Assistant**
|
||||
|
||||
```bash
|
||||
curl "http://localhost:4000/v1/assistants" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer sk-1234" \
|
||||
-d '{
|
||||
"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-turbo"
|
||||
}'
|
||||
```
|
||||
|
||||
|
||||
**Get the Assistant**
|
||||
|
||||
```bash
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue