From ed5cc86e8fbcf8626cf7cf2bcddf3a09b8852bcd Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 9 Jul 2024 12:29:53 -0700 Subject: [PATCH] docs - assistants api --- docs/my-website/docs/assistants.md | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/docs/my-website/docs/assistants.md b/docs/my-website/docs/assistants.md index 1af780500..cfbc4c11a 100644 --- a/docs/my-website/docs/assistants.md +++ b/docs/my-website/docs/assistants.md @@ -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. +**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