From 0f2ec6c0e948d9e51a6cc4cdaaf7ba4a4f27279f Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Thu, 11 Jul 2024 09:20:55 -0700 Subject: [PATCH] docs(assistants.md): add openai-compatible assistants api example to docs --- docs/my-website/docs/assistants.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/my-website/docs/assistants.md b/docs/my-website/docs/assistants.md index cfbc4c11a4..fb30a132f7 100644 --- a/docs/my-website/docs/assistants.md +++ b/docs/my-website/docs/assistants.md @@ -26,6 +26,7 @@ Call an existing Assistant. - Run the Assistant on the Thread to generate a response by calling the model and the tools. +### SDK + PROXY @@ -281,3 +282,31 @@ curl -X POST 'http://0.0.0.0:4000/threads/{thread_id}/runs' \ ## [👉 Proxy API Reference](https://litellm-api.up.railway.app/#/assistants) + +## OpenAI-Compatible APIs + +To call openai-compatible Assistants API's (eg. Astra Assistants API), just add `openai/` to the model name: + + +**config** +```yaml +assistant_settings: + custom_llm_provider: openai + litellm_params: + api_key: os.environ/ASTRA_API_KEY + api_base: os.environ/ASTRA_API_BASE +``` + +**curl** + +```bash +curl -X POST "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": "openai/" + }' +``` \ No newline at end of file