diff --git a/.circleci/config.yml b/.circleci/config.yml
index 2822021760c..440343b45ea 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -57,6 +57,7 @@ jobs:
pip install "pytest-mock==3.12.0"
pip install python-multipart
pip install google-cloud-aiplatform
+ pip install prometheus-client==0.20.0
- save_cache:
paths:
- ./venv
@@ -198,6 +199,10 @@ jobs:
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e AWS_REGION_NAME=$AWS_REGION_NAME \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
+ -e LANGFUSE_PROJECT1_PUBLIC=$LANGFUSE_PROJECT1_PUBLIC \
+ -e LANGFUSE_PROJECT2_PUBLIC=$LANGFUSE_PROJECT2_PUBLIC \
+ -e LANGFUSE_PROJECT1_SECRET=$LANGFUSE_PROJECT1_SECRET \
+ -e LANGFUSE_PROJECT2_SECRET=$LANGFUSE_PROJECT2_SECRET \
--name my-app \
-v $(pwd)/proxy_server_config.yaml:/app/config.yaml \
my-app:latest \
diff --git a/docs/my-website/docs/providers/groq.md b/docs/my-website/docs/providers/groq.md
index d8a4fded438..8443387a5f5 100644
--- a/docs/my-website/docs/providers/groq.md
+++ b/docs/my-website/docs/providers/groq.md
@@ -50,4 +50,105 @@ We support ALL Groq models, just set `groq/` as a prefix when sending completion
|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| llama2-70b-4096 | `completion(model="groq/llama2-70b-4096", messages)` |
| mixtral-8x7b-32768 | `completion(model="groq/mixtral-8x7b-32768", messages)` |
-| gemma-7b-it | `completion(model="groq/gemma-7b-it", messages)` |
\ No newline at end of file
+| gemma-7b-it | `completion(model="groq/gemma-7b-it", messages)` |
+
+## Groq - Tool / Function Calling Example
+
+```python
+# Example dummy function hard coded to return the current weather
+import json
+def get_current_weather(location, unit="fahrenheit"):
+ """Get the current weather in a given location"""
+ if "tokyo" in location.lower():
+ return json.dumps({"location": "Tokyo", "temperature": "10", "unit": "celsius"})
+ elif "san francisco" in location.lower():
+ return json.dumps(
+ {"location": "San Francisco", "temperature": "72", "unit": "fahrenheit"}
+ )
+ elif "paris" in location.lower():
+ return json.dumps({"location": "Paris", "temperature": "22", "unit": "celsius"})
+ else:
+ return json.dumps({"location": location, "temperature": "unknown"})
+
+
+
+
+# Step 1: send the conversation and available functions to the model
+messages = [
+ {
+ "role": "system",
+ "content": "You are a function calling LLM that uses the data extracted from get_current_weather to answer questions about the weather in San Francisco.",
+ },
+ {
+ "role": "user",
+ "content": "What's the weather like in San Francisco?",
+ },
+]
+tools = [
+ {
+ "type": "function",
+ "function": {
+ "name": "get_current_weather",
+ "description": "Get the current weather in a given location",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "location": {
+ "type": "string",
+ "description": "The city and state, e.g. San Francisco, CA",
+ },
+ "unit": {
+ "type": "string",
+ "enum": ["celsius", "fahrenheit"],
+ },
+ },
+ "required": ["location"],
+ },
+ },
+ }
+]
+response = litellm.completion(
+ model="groq/llama2-70b-4096",
+ messages=messages,
+ tools=tools,
+ tool_choice="auto", # auto is default, but we'll be explicit
+)
+print("Response\n", response)
+response_message = response.choices[0].message
+tool_calls = response_message.tool_calls
+
+
+# Step 2: check if the model wanted to call a function
+if tool_calls:
+ # Step 3: call the function
+ # Note: the JSON response may not always be valid; be sure to handle errors
+ available_functions = {
+ "get_current_weather": get_current_weather,
+ }
+ messages.append(
+ response_message
+ ) # extend conversation with assistant's reply
+ print("Response message\n", response_message)
+ # Step 4: send the info for each function call and function response to the model
+ for tool_call in tool_calls:
+ function_name = tool_call.function.name
+ function_to_call = available_functions[function_name]
+ function_args = json.loads(tool_call.function.arguments)
+ function_response = function_to_call(
+ location=function_args.get("location"),
+ unit=function_args.get("unit"),
+ )
+ messages.append(
+ {
+ "tool_call_id": tool_call.id,
+ "role": "tool",
+ "name": function_name,
+ "content": function_response,
+ }
+ ) # extend conversation with function response
+ print(f"messages: {messages}")
+ second_response = litellm.completion(
+ model="groq/llama2-70b-4096", messages=messages
+ ) # get a new response from the model where it can see the function response
+ print("second response\n", second_response)
+```
\ No newline at end of file
diff --git a/docs/my-website/docs/providers/openai.md b/docs/my-website/docs/providers/openai.md
index e3f6c267d15..d40ab0676f5 100644
--- a/docs/my-website/docs/providers/openai.md
+++ b/docs/my-website/docs/providers/openai.md
@@ -2,7 +2,7 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# OpenAI
-LiteLLM supports OpenAI Chat + Text completion and embedding calls.
+LiteLLM supports OpenAI Chat + Embedding calls.
### Required API Keys
@@ -217,19 +217,6 @@ response = completion(
```
-## OpenAI Text Completion Models / Instruct Models
-
-| Model Name | Function Call |
-|---------------------|----------------------------------------------------|
-| gpt-3.5-turbo-instruct | `response = completion(model="gpt-3.5-turbo-instruct", messages=messages)` |
-| gpt-3.5-turbo-instruct-0914 | `response = completion(model="gpt-3.5-turbo-instruct-0914", messages=messages)` |
-| text-davinci-003 | `response = completion(model="text-davinci-003", messages=messages)` |
-| ada-001 | `response = completion(model="ada-001", messages=messages)` |
-| curie-001 | `response = completion(model="curie-001", messages=messages)` |
-| babbage-001 | `response = completion(model="babbage-001", messages=messages)` |
-| babbage-002 | `response = completion(model="babbage-002", messages=messages)` |
-| davinci-002 | `response = completion(model="davinci-002", messages=messages)` |
-
## Advanced
### Parallel Function calling
diff --git a/docs/my-website/docs/providers/openai_compatible.md b/docs/my-website/docs/providers/openai_compatible.md
index 09dcd7e4c98..ff0e8570998 100644
--- a/docs/my-website/docs/providers/openai_compatible.md
+++ b/docs/my-website/docs/providers/openai_compatible.md
@@ -5,7 +5,9 @@ import TabItem from '@theme/TabItem';
To call models hosted behind an openai proxy, make 2 changes:
-1. Put `openai/` in front of your model name, so litellm knows you're trying to call an openai-compatible endpoint.
+1. For `/chat/completions`: Put `openai/` in front of your model name, so litellm knows you're trying to call an openai `/chat/completions` endpoint.
+
+2. For `/completions`: Put `text-completion-openai/` in front of your model name, so litellm knows you're trying to call an openai `/completions` endpoint.
2. **Do NOT** add anything additional to the base url e.g. `/v1/embedding`. LiteLLM uses the openai-client to make these calls, and that automatically adds the relevant endpoints.
diff --git a/docs/my-website/docs/providers/text_completion_openai.md b/docs/my-website/docs/providers/text_completion_openai.md
new file mode 100644
index 00000000000..842b56aec95
--- /dev/null
+++ b/docs/my-website/docs/providers/text_completion_openai.md
@@ -0,0 +1,163 @@
+# OpenAI (Text Completion)
+
+LiteLLM supports OpenAI text completion models
+
+### Required API Keys
+
+```python
+import os
+os.environ["OPENAI_API_KEY"] = "your-api-key"
+```
+
+### Usage
+```python
+import os
+from litellm import completion
+
+os.environ["OPENAI_API_KEY"] = "your-api-key"
+
+# openai call
+response = completion(
+ model = "gpt-3.5-turbo-instruct",
+ messages=[{ "content": "Hello, how are you?","role": "user"}]
+)
+```
+
+### Usage - LiteLLM Proxy Server
+
+Here's how to call OpenAI models with the LiteLLM Proxy Server
+
+### 1. Save key in your environment
+
+```bash
+export OPENAI_API_KEY=""
+```
+
+### 2. Start the proxy
+
+
0?a=a.charAt(0)+"."+a.slice(1)+x(r):i>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(o<0?"e":"e+")+o):o<0?(a="0."+x(-o-1)+a,n&&(r=n-i)>0&&(a+=x(r))):o>=i?(a+=x(o+1-i),n&&(r=n-o-1)>0&&(a=a+"."+x(r))):((r=o+1)0&&(o+1===i&&(a+="."),a+=x(r))),e.s<0?"-"+a:a}function I(e,t){if(e.length>t)return e.length=t,!0}function N(e){if(!e||"object"!=typeof e)throw Error(s+"Object expected");var t,n,r,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t