From c548d8ad372cea8883c04c8ae19974e7f865f312 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Sat, 9 Sep 2023 16:11:11 -0700 Subject: [PATCH] update docs --- .../docs/providers/custom_openai_proxy.md | 44 +++++++++++++++++++ docs/my-website/docs/providers/vllm.md | 4 +- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/my-website/docs/providers/custom_openai_proxy.md b/docs/my-website/docs/providers/custom_openai_proxy.md index e69de29bb2..8b661fddf7 100644 --- a/docs/my-website/docs/providers/custom_openai_proxy.md +++ b/docs/my-website/docs/providers/custom_openai_proxy.md @@ -0,0 +1,44 @@ +# OpenAI Proxy Servers (ChatCompletion) + +LiteLLM allows you to call your OpenAI ChatCompletion proxy server + + +### API KEYS +No api keys required + +### Example Usage + +#### Pre-Requisites +Ensure your proxy server has the following route + +```python +@app.route('/chat/completions', methods=["POST"]) +def chat_completion(): + print("got request for chat completion") + +``` + +In order to use your custom OpenAI Chat Completion proxy with LiteLLM, ensure you set + +* `api_base` to your proxy url, example "https://openai-proxy.berriai.repl.co" +* `custom_llm_provider` to `openai` this ensures litellm uses the `openai.ChatCompletion` to your api_base + +```python + +from litellm import completion + +## set ENV variables +os.environ["OPENAI_API_KEY"] = "set it, but it's not used" + +messages = [{ "content": "Hello, how are you?","role": "user"}] + +response = completion( + model="command-nightly", + messages=[{ "content": "Hello, how are you?","role": "user"}], + api_base="https://openai-proxy.berriai.repl.co", + custom_llm_provider="openai" + temperature=0.2, + max_tokens=80, +) +print(response) +``` \ No newline at end of file diff --git a/docs/my-website/docs/providers/vllm.md b/docs/my-website/docs/providers/vllm.md index 1b1e18add2..d97f09eaef 100644 --- a/docs/my-website/docs/providers/vllm.md +++ b/docs/my-website/docs/providers/vllm.md @@ -24,7 +24,7 @@ print(response) In order to use litellm to call a hosted vllm server add the following to your completion call * `custom_llm_provider == "openai"` -* `api_base = "your-hosted-vllm-server/v1"` +* `api_base = "your-hosted-vllm-server"` ```python import litellm @@ -32,7 +32,7 @@ import litellm response = completion( model="facebook/opt-125m", # pass the vllm model name messages=messages, - api_base="https://hosted-vllm-api.co/v1", + api_base="https://hosted-vllm-api.co", custom_llm_provider="openai", temperature=0.2, max_tokens=80)