From 305fc4bb9f8f8806f272383a1763683048a7ebb8 Mon Sep 17 00:00:00 2001 From: Jacky Wong Date: Tue, 5 Sep 2023 11:30:56 +1000 Subject: [PATCH] remove --- docs/docusaurus.config.js | 2 +- docs/src/pages/completion/input.md | 58 -------------- docs/src/pages/completion/output.md | 12 --- docs/src/pages/completion/supported.md | 72 ----------------- docs/src/pages/contact.md | 6 -- docs/src/pages/observability/callbacks.md | 29 ------- .../observability/helicone_integration.md | 55 ------------- docs/src/pages/observability/integrations.md | 12 --- .../observability/supabase_integration.md | 80 ------------------- docs/src/pages/troubleshoot.md | 11 --- 10 files changed, 1 insertion(+), 336 deletions(-) delete mode 100644 docs/src/pages/completion/input.md delete mode 100644 docs/src/pages/completion/output.md delete mode 100644 docs/src/pages/completion/supported.md delete mode 100644 docs/src/pages/contact.md delete mode 100644 docs/src/pages/observability/callbacks.md delete mode 100644 docs/src/pages/observability/helicone_integration.md delete mode 100644 docs/src/pages/observability/integrations.md delete mode 100644 docs/src/pages/observability/supabase_integration.md delete mode 100644 docs/src/pages/troubleshoot.md diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index f8ffc1fa0..422991b0a 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -11,7 +11,7 @@ const config = { favicon: 'static/img/favicon.ico', // Set the production url of your site here - url: 'https://litellm.vercel.app/', + url: 'https://docs.confident-ai.com', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' baseUrl: '/', diff --git a/docs/src/pages/completion/input.md b/docs/src/pages/completion/input.md deleted file mode 100644 index 86546bbba..000000000 --- a/docs/src/pages/completion/input.md +++ /dev/null @@ -1,58 +0,0 @@ -# Completion Function - completion() -The Input params are **exactly the same** as the -OpenAI Create chat completion, and let you call **Azure OpenAI, Anthropic, Cohere, Replicate, OpenRouter** models in the same format. - -In addition, liteLLM allows you to pass in the following **Optional** liteLLM args: -`force_timeout`, `azure`, `logger_fn`, `verbose` - -## Input - Request Body -# Request Body - -**Required Fields** - -- `model`: *string* - ID of the model to use. Refer to the model endpoint compatibility table for details on which models work with the Chat API. - -- `messages`: *array* - A list of messages comprising the conversation so far. - -*Note* - Each message in the array contains the following properties: - - - `role`: *string* - The role of the message's author. Roles can be: system, user, assistant, or function. - - - `content`: *string or null* - The contents of the message. It is required for all messages, but may be null for assistant messages with function calls. - - - `name`: *string (optional)* - The name of the author of the message. It is required if the role is "function". The name should match the name of the function represented in the content. It can contain characters (a-z, A-Z, 0-9), and underscores, with a maximum length of 64 characters. - - - `function_call`: *object (optional)* - The name and arguments of a function that should be called, as generated by the model. - - -**Optional Fields** - -- `functions`: *array* - A list of functions that the model may use to generate JSON inputs. Each function should have the following properties: - - - `name`: *string* - The name of the function to be called. It should contain a-z, A-Z, 0-9, underscores and dashes, with a maximum length of 64 characters. - - - `description`: *string (optional)* - A description explaining what the function does. It helps the model to decide when and how to call the function. - - - `parameters`: *object* - The parameters that the function accepts, described as a JSON Schema object. - - - `function_call`: *string or object (optional)* - Controls how the model responds to function calls. - -- `temperature`: *number or null (optional)* - The sampling temperature to be used, between 0 and 2. Higher values like 0.8 produce more random outputs, while lower values like 0.2 make outputs more focused and deterministic. - -- `top_p`: *number or null (optional)* - An alternative to sampling with temperature. It instructs the model to consider the results of the tokens with top_p probability. For example, 0.1 means only the tokens comprising the top 10% probability mass are considered. - -- `n`: *integer or null (optional)* - The number of chat completion choices to generate for each input message. - -- `stream`: *boolean or null (optional)* - If set to true, it sends partial message deltas. Tokens will be sent as they become available, with the stream terminated by a [DONE] message. - -- `stop`: *string/ array/ null (optional)* - Up to 4 sequences where the API will stop generating further tokens. - -- `max_tokens`: *integer (optional)* - The maximum number of tokens to generate in the chat completion. - -- `presence_penalty`: *number or null (optional)* - It is used to penalize new tokens based on their existence in the text so far. - -- `frequency_penalty`: *number or null (optional)* - It is used to penalize new tokens based on their frequency in the text so far. - -- `logit_bias`: *map (optional)* - Used to modify the probability of specific tokens appearing in the completion. - -- `user`: *string (optional)* - A unique identifier representing your end-user. This can help OpenAI to monitor and detect abuse. \ No newline at end of file diff --git a/docs/src/pages/completion/output.md b/docs/src/pages/completion/output.md deleted file mode 100644 index a82023771..000000000 --- a/docs/src/pages/completion/output.md +++ /dev/null @@ -1,12 +0,0 @@ -# Completion Function - completion() -Here's the exact json output you can expect from a litellm `completion` call: - -```python -{'choices': [{'finish_reason': 'stop', - 'index': 0, - 'message': {'role': 'assistant', - 'content': " I'm doing well, thank you for asking. I am Claude, an AI assistant created by Anthropic."}}], - 'created': 1691429984.3852863, - 'model': 'claude-instant-1', - 'usage': {'prompt_tokens': 18, 'completion_tokens': 23, 'total_tokens': 41}} -``` \ No newline at end of file diff --git a/docs/src/pages/completion/supported.md b/docs/src/pages/completion/supported.md deleted file mode 100644 index f7e835eed..000000000 --- a/docs/src/pages/completion/supported.md +++ /dev/null @@ -1,72 +0,0 @@ -# Generation/Completion/Chat Completion Models - -### OpenAI Chat Completion Models - -| Model Name | Function Call | Required OS Variables | -|------------------|----------------------------------------|--------------------------------------| -| gpt-3.5-turbo | `completion('gpt-3.5-turbo', messages)` | `os.environ['OPENAI_API_KEY']` | -| gpt-3.5-turbo-16k | `completion('gpt-3.5-turbo-16k', messages)` | `os.environ['OPENAI_API_KEY']` | -| gpt-3.5-turbo-16k-0613 | `completion('gpt-3.5-turbo-16k-0613', messages)` | `os.environ['OPENAI_API_KEY']` | -| gpt-4 | `completion('gpt-4', messages)` | `os.environ['OPENAI_API_KEY']` | - -## Azure OpenAI Chat Completion Models - -| Model Name | Function Call | Required OS Variables | -|------------------|-----------------------------------------|-------------------------------------------| -| gpt-3.5-turbo | `completion('gpt-3.5-turbo', messages, azure=True)` | `os.environ['AZURE_API_KEY']`,`os.environ['AZURE_API_BASE']`,`os.environ['AZURE_API_VERSION']` | -| gpt-4 | `completion('gpt-4', messages, azure=True)` | `os.environ['AZURE_API_KEY']`,`os.environ['AZURE_API_BASE']`,`os.environ['AZURE_API_VERSION']` | - -### OpenAI Text Completion Models - -| Model Name | Function Call | Required OS Variables | -|------------------|--------------------------------------------|--------------------------------------| -| text-davinci-003 | `completion('text-davinci-003', messages)` | `os.environ['OPENAI_API_KEY']` | - -### Cohere Models - -| Model Name | Function Call | Required OS Variables | -|------------------|--------------------------------------------|--------------------------------------| -| command-nightly | `completion('command-nightly', messages)` | `os.environ['COHERE_API_KEY']` | - - -### Anthropic Models - -| Model Name | Function Call | Required OS Variables | -|------------------|--------------------------------------------|--------------------------------------| -| claude-instant-1 | `completion('claude-instant-1', messages)` | `os.environ['ANTHROPIC_API_KEY']` | -| claude-2 | `completion('claude-2', messages)` | `os.environ['ANTHROPIC_API_KEY']` | - -### Hugging Face Inference API - -All [`text2text-generation`](https://huggingface.co/models?library=transformers&pipeline_tag=text2text-generation&sort=downloads) and [`text-generation`](https://huggingface.co/models?library=transformers&pipeline_tag=text-generation&sort=downloads) models are supported by liteLLM. You can use any text model from Hugging Face with the following steps: - -* Copy the `model repo` URL from Hugging Face and set it as the `model` parameter in the completion call. -* Set `hugging_face` parameter to `True`. -* Make sure to set the hugging face API key - -Here are some examples of supported models: -**Note that the models mentioned in the table are examples, and you can use any text model available on Hugging Face by following the steps above.** - -| Model Name | Function Call | Required OS Variables | -|------------------|-------------------------------------------------------------------------------------|--------------------------------------| -| [stabilityai/stablecode-completion-alpha-3b-4k](https://huggingface.co/stabilityai/stablecode-completion-alpha-3b-4k) | `completion(model="stabilityai/stablecode-completion-alpha-3b-4k", messages=messages, hugging_face=True)` | `os.environ['HF_TOKEN']` | -| [bigcode/starcoder](https://huggingface.co/bigcode/starcoder) | `completion(model="bigcode/starcoder", messages=messages, hugging_face=True)` | `os.environ['HF_TOKEN']` | -| [google/flan-t5-xxl](https://huggingface.co/google/flan-t5-xxl) | `completion(model="google/flan-t5-xxl", messages=messages, hugging_face=True)` | `os.environ['HF_TOKEN']` | -| [google/flan-t5-large](https://huggingface.co/google/flan-t5-large) | `completion(model="google/flan-t5-large", messages=messages, hugging_face=True)` | `os.environ['HF_TOKEN']` | - -### OpenRouter Completion Models - -All the text models from [OpenRouter](https://openrouter.ai/docs) are supported by liteLLM. - -| Model Name | Function Call | Required OS Variables | -|------------------|--------------------------------------------|--------------------------------------| -| openai/gpt-3.5-turbo | `completion('openai/gpt-3.5-turbo', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OR_API_KEY']` | -| openai/gpt-3.5-turbo-16k | `completion('openai/gpt-3.5-turbo-16k', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OR_API_KEY']` | -| openai/gpt-4 | `completion('openai/gpt-4', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OR_API_KEY']` | -| openai/gpt-4-32k | `completion('openai/gpt-4-32k', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OR_API_KEY']` | -| anthropic/claude-2 | `completion('anthropic/claude-2', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OR_API_KEY']` | -| anthropic/claude-instant-v1 | `completion('anthropic/claude-instant-v1', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OR_API_KEY']` | -| google/palm-2-chat-bison | `completion('google/palm-2-chat-bison', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OR_API_KEY']` | -| google/palm-2-codechat-bison | `completion('google/palm-2-codechat-bison', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OR_API_KEY']` | -| meta-llama/llama-2-13b-chat | `completion('meta-llama/llama-2-13b-chat', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OR_API_KEY']` | -| meta-llama/llama-2-70b-chat | `completion('meta-llama/llama-2-70b-chat', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OR_API_KEY']` | \ No newline at end of file diff --git a/docs/src/pages/contact.md b/docs/src/pages/contact.md deleted file mode 100644 index d5309cd73..000000000 --- a/docs/src/pages/contact.md +++ /dev/null @@ -1,6 +0,0 @@ -# Contact Us - -[![](https://dcbadge.vercel.app/api/server/wuPM9dRgDw)](https://discord.gg/wuPM9dRgDw) - -* [Meet with us 👋](https://calendly.com/d/4mp-gd3-k5k/berriai-1-1-onboarding-litellm-hosted-version) -* Contact us at ishaan@berri.ai / krrish@berri.ai diff --git a/docs/src/pages/observability/callbacks.md b/docs/src/pages/observability/callbacks.md deleted file mode 100644 index 7ac67b30d..000000000 --- a/docs/src/pages/observability/callbacks.md +++ /dev/null @@ -1,29 +0,0 @@ -# Callbacks - -## Use Callbacks to send Output Data to Posthog, Sentry etc -liteLLM provides `success_callbacks` and `failure_callbacks`, making it easy for you to send data to a particular provider depending on the status of your responses. - -liteLLM supports: - -- [Helicone](https://docs.helicone.ai/introduction) -- [Sentry](https://docs.sentry.io/platforms/python/) -- [PostHog](https://posthog.com/docs/libraries/python) -- [Slack](https://slack.dev/bolt-python/concepts) - -### Quick Start -```python -from litellm import completion - -# set callbacks -litellm.success_callback=["posthog", "helicone"] -litellm.failure_callback=["sentry"] - -## set env variables -os.environ['SENTRY_API_URL'], os.environ['SENTRY_API_TRACE_RATE']= "" -os.environ['POSTHOG_API_KEY'], os.environ['POSTHOG_API_URL'] = "api-key", "api-url" -os.environ["HELICONE_API_KEY"] = "" - -response = completion(model="gpt-3.5-turbo", messages=messages) -``` - - diff --git a/docs/src/pages/observability/helicone_integration.md b/docs/src/pages/observability/helicone_integration.md deleted file mode 100644 index 273d22d4f..000000000 --- a/docs/src/pages/observability/helicone_integration.md +++ /dev/null @@ -1,55 +0,0 @@ -# Helicone Tutorial -[Helicone](https://helicone.ai/) is an open source observability platform that proxies your OpenAI traffic and provides you key insights into your spend, latency and usage. - -## Use Helicone to log requests across all LLM Providers (OpenAI, Azure, Anthropic, Cohere, Replicate, PaLM) -liteLLM provides `success_callbacks` and `failure_callbacks`, making it easy for you to send data to a particular provider depending on the status of your responses. - -In this case, we want to log requests to Helicone when a request succeeds. - -### Approach 1: Use Callbacks -Use just 1 line of code, to instantly log your responses **across all providers** with helicone: -``` -litellm.success_callback=["helicone"] -``` - -Complete code -```python -from litellm import completion - -## set env variables -os.environ["HELICONE_API_KEY"] = "your-helicone-key" -os.environ["OPENAI_API_KEY"], os.environ["COHERE_API_KEY"] = "", "" - -# set callbacks -litellm.success_callback=["helicone"] - -#openai call -response = completion(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}]) - -#cohere call -response = completion(model="command-nightly", messages=[{"role": "user", "content": "Hi 👋 - i'm cohere"}]) -``` - -### Approach 2: [OpenAI + Azure only] Use Helicone as a proxy -Helicone provides advanced functionality like caching, etc. Helicone currently supports this for Azure and OpenAI. - -If you want to use Helicone to proxy your OpenAI/Azure requests, then you can - - -- Set helicone as your base url via: `litellm.api_url` -- Pass in helicone request headers via: `litellm.headers` - -Complete Code -``` -import litellm -from litellm import completion - -litellm.api_base = "https://oai.hconeai.com/v1" -litellm.headers = {"Helicone-Auth": f"Bearer {os.getenv('HELICONE_API_KEY')}"} - -response = litellm.completion( - model="gpt-3.5-turbo", - messages=[{"role": "user", "content": "how does a court case get to the Supreme Court?"}] -) - -print(response) -``` diff --git a/docs/src/pages/observability/integrations.md b/docs/src/pages/observability/integrations.md deleted file mode 100644 index 6b6d535be..000000000 --- a/docs/src/pages/observability/integrations.md +++ /dev/null @@ -1,12 +0,0 @@ -# Logging Integrations - -| Integration | Required OS Variables | How to Use with callbacks | -|-----------------|--------------------------------------------|-------------------------------------------| -| Sentry | `SENTRY_API_URL` | `litellm.success_callback=["sentry"]` | -| Posthog | `POSTHOG_API_KEY`,`POSTHOG_API_URL` | `litellm.success_callback=["posthog"]` | -| Slack | `SLACK_API_TOKEN`,`SLACK_API_SECRET`,`SLACK_API_CHANNEL` | `litellm.success_callback=["slack"]` | -| Helicone | `HELICONE_API_TOKEN` | `litellm.success_callback=["helicone"]` | - - - - diff --git a/docs/src/pages/observability/supabase_integration.md b/docs/src/pages/observability/supabase_integration.md deleted file mode 100644 index 6ae4f65da..000000000 --- a/docs/src/pages/observability/supabase_integration.md +++ /dev/null @@ -1,80 +0,0 @@ -# Supabase Tutorial -[Supabase](https://supabase.com/) is an open source Firebase alternative. -Start your project with a Postgres database, Authentication, instant APIs, Edge Functions, Realtime subscriptions, Storage, and Vector embeddings. - -## Use Supabase to log requests and see total spend across all LLM Providers (OpenAI, Azure, Anthropic, Cohere, Replicate, PaLM) -liteLLM provides `success_callbacks` and `failure_callbacks`, making it easy for you to send data to a particular provider depending on the status of your responses. - -In this case, we want to log requests to Supabase in both scenarios - when it succeeds and fails. - -### Create a supabase table - -Go to your Supabase project > go to the [Supabase SQL Editor](https://supabase.com/dashboard/projects) and create a new table with this configuration. - -Note: You can change the table name. Just don't change the column names. - -```sql -create table - public.request_logs ( - id bigint generated by default as identity, - created_at timestamp with time zone null default now(), - model text null default ''::text, - messages json null default '{}'::json, - response json null default '{}'::json, - end_user text null default ''::text, - error json null default '{}'::json, - response_time real null default '0'::real, - total_cost real null, - additional_details json null default '{}'::json, - constraint request_logs_pkey primary key (id) - ) tablespace pg_default; -``` - -### Use Callbacks -Use just 2 lines of code, to instantly see costs and log your responses **across all providers** with Supabase: - -``` -litellm.success_callback=["supabase"] -litellm.failure_callback=["supabase"] -``` - -Complete code -```python -from litellm import completion - -## set env variables -### SUPABASE -os.environ["SUPABASE_URL"] = "your-supabase-url" -os.environ["SUPABASE_KEY"] = "your-supabase-key" - -## LLM API KEY -os.environ["OPENAI_API_KEY"] = "" - -# set callbacks -litellm.success_callback=["supabase"] -litellm.failure_callback=["supabase"] - -#openai call -response = completion(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}]) - -#bad call -response = completion(model="chatgpt-test", messages=[{"role": "user", "content": "Hi 👋 - i'm a bad call to test error logging"}]) -``` - -### Additional Controls - -**Different Table name** - -If you modified your table name, here's how to pass the new name. - -```python -litellm.modify_integration("supabase",{"table_name": "litellm_logs"}) -``` - -**Identify end-user** - -Here's how to map your llm call to an end-user - -```python -litellm.identify({"end_user": "krrish@berri.ai"}) -``` \ No newline at end of file diff --git a/docs/src/pages/troubleshoot.md b/docs/src/pages/troubleshoot.md deleted file mode 100644 index 05dbf56ca..000000000 --- a/docs/src/pages/troubleshoot.md +++ /dev/null @@ -1,11 +0,0 @@ -# Troubleshooting - -## Stable Version - -If you're running into problems with installation / Usage -Use the stable version of litellm - -``` -pip install litellm==0.1.345 -``` -