From 68667a50919f886cbd3172aa45ccba72d266b550 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Sat, 23 Sep 2023 12:45:06 -0700 Subject: [PATCH] fix getting started page --- docs/my-website/docs/index.md | 74 ++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 5 deletions(-) diff --git a/docs/my-website/docs/index.md b/docs/my-website/docs/index.md index e74bae06732..9238e1e83c0 100644 --- a/docs/my-website/docs/index.md +++ b/docs/my-website/docs/index.md @@ -275,15 +275,79 @@ print("Cost for completion call with gpt-3.5-turbo: ", f"${float(cost):.10f}") Cost for completion call with gpt-3.5-turbo: $0.0000775000 ``` - -## Caching with LiteLLM - ## LiteLLM API +The LiteLLM API allows you to access LLMs you might not have access to (example Claude-2) -## Send Logs to Promptlayer + + + +```python +import os +from litellm import completion + +# use the LiteLLM API Key +os.environ["ANTHROPIC_API_KEY"] = "sk-litellm-7_NPZhMGxY2GoHC59LgbDw" + +messages = [{ "content": "Hello, how are you?","role": "user"}] + +response = completion(model="togethercomputer/falcon-40b-instruct", messages=messages) +print(response) +``` + + + +```python +import os +from litellm import completion + +# use the LiteLLM API Key +os.environ["OPENAI_API_KEY"] = "sk-litellm-7_NPZhMGxY2GoHC59LgbDw" + +messages = [{ "content": "Hello, how are you?","role": "user"}] + +response = completion(model="gpt-4", messages=messages) +print(response) +``` + + + +```python +import os +from litellm import completion + +# use the LiteLLM API Key +os.environ["TOGETHERAI_API_KEY"] = "sk-litellm-7_NPZhMGxY2GoHC59LgbDw" + +messages = [{ "content": "Hello, how are you?","role": "user"}] + +response = completion(model="togethercomputer/llama-2-70b-chat", messages=messages) +print(response) +``` + + + + +```python +import os +from litellm import completion + +# use the LiteLLM API Key +os.environ["TOGETHERAI_API_KEY"] = "sk-litellm-7_NPZhMGxY2GoHC59LgbDw" + +messages = [{ "content": "Hello, how are you?","role": "user"}] + +response = completion(model="togethercomputer/falcon-40b-instruct", messages=messages) +print(response) +``` + + + +👉 See all supported providers on [LiteLLM API](./proxy.md) + +Need a dedicated key? Email us @ krrish@berri.ai -More details 👉 +## More details * [exception mapping](./exception_mapping.md) * [retries + model fallbacks for completion()](./completion/reliable_completions.md) * [tutorial for model fallbacks with completion()](./tutorials/fallbacks.md) \ No newline at end of file