mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
docs(observability): use gpt-4o instead of gpt-3.5-turbo in examples
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
This commit is contained in:
parent
6f10ddb843
commit
64f9b1178e
15 changed files with 55 additions and 55 deletions
|
|
@ -73,7 +73,7 @@ litellm.argilla_transformation_object = {
|
|||
|
||||
## LLM CALL ##
|
||||
response = completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[{"role": "user", "content": "Hello, how are you?"}],
|
||||
)
|
||||
```
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ We will use the `--config` to set `litellm.callbacks = ["azure_sentinel"]` this
|
|||
|
||||
```yaml showLineNumbers title="config.yaml"
|
||||
model_list:
|
||||
- model_name: gpt-3.5-turbo
|
||||
- model_name: gpt-4o
|
||||
litellm_params:
|
||||
model: gpt-3.5-turbo
|
||||
model: gpt-4o
|
||||
litellm_settings:
|
||||
callbacks: ["azure_sentinel"] # logs llm success + failure logs to Azure Sentinel
|
||||
```
|
||||
|
|
@ -80,7 +80,7 @@ Test Request
|
|||
curl --location 'http://0.0.0.0:4000/chat/completions' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"model": "gpt-4o",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
|
|
|
|||
|
|
@ -59,5 +59,5 @@ os.environ["LANGFUSE_PUBLIC_KEY"] = ""
|
|||
os.environ["LANGFUSE_SECRET_KEY"] = ""
|
||||
os.environ["LANGFUSE_HOST"] = ""
|
||||
|
||||
response = completion(model="gpt-3.5-turbo", messages=messages)
|
||||
response = completion(model="gpt-4o", messages=messages)
|
||||
```
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ Send LiteLLM logs to any HTTP endpoint.
|
|||
|
||||
```yaml
|
||||
model_list:
|
||||
- model_name: gpt-3.5-turbo
|
||||
- model_name: gpt-4o
|
||||
litellm_params:
|
||||
model: openai/gpt-3.5-turbo
|
||||
model: openai/gpt-4o
|
||||
api_key: os.environ/OPENAI_API_KEY
|
||||
|
||||
litellm_settings:
|
||||
|
|
@ -74,7 +74,7 @@ Logs are sent as `StandardLoggingPayload` [objects](https://docs.litellm.ai/docs
|
|||
{
|
||||
"id": "chatcmpl-123",
|
||||
"call_type": "litellm.completion",
|
||||
"model": "gpt-3.5-turbo",
|
||||
"model": "gpt-4o",
|
||||
"messages": [...],
|
||||
"response": {...},
|
||||
"usage": {...},
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ litellm.success_callback = ["greenscale"]
|
|||
|
||||
#openai call
|
||||
response = completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}]
|
||||
metadata={
|
||||
"greenscale_project": "acme-project",
|
||||
|
|
@ -58,7 +58,7 @@ You can send any additional information to Greenscale by using the `metadata` fi
|
|||
```python
|
||||
#openai call with additional metadata
|
||||
response = completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "Hi 👋 - i'm openai"}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ os.environ["HUMANLOOP_API_KEY"] = "" # [OPTIONAL] set here or in `.completion`
|
|||
litellm.set_verbose = True # see raw request to provider
|
||||
|
||||
resp = litellm.completion(
|
||||
model="humanloop/gpt-3.5-turbo",
|
||||
model="humanloop/gpt-4o",
|
||||
prompt_id="test-chat-prompt",
|
||||
prompt_variables={"user_message": "this is used"}, # [OPTIONAL]
|
||||
messages=[{"role": "user", "content": "<IGNORED>"}],
|
||||
|
|
@ -43,9 +43,9 @@ resp = litellm.completion(
|
|||
|
||||
```yaml
|
||||
model_list:
|
||||
- model_name: gpt-3.5-turbo
|
||||
- model_name: gpt-4o
|
||||
litellm_params:
|
||||
model: humanloop/gpt-3.5-turbo
|
||||
model: humanloop/gpt-4o
|
||||
prompt_id: "<humanloop_prompt_id>"
|
||||
api_key: os.environ/OPENAI_API_KEY
|
||||
```
|
||||
|
|
@ -66,7 +66,7 @@ curl -L -X POST 'http://0.0.0.0:4000/v1/chat/completions' \
|
|||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer sk-1234' \
|
||||
-d '{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"model": "gpt-4o",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
|
|
@ -90,7 +90,7 @@ client = openai.OpenAI(
|
|||
|
||||
# request sent to model set on litellm proxy, `litellm --model`
|
||||
response = client.chat.completions.create(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages = [
|
||||
{
|
||||
"role": "user",
|
||||
|
|
@ -120,7 +120,7 @@ print(response)
|
|||
POST Request Sent from LiteLLM:
|
||||
curl -X POST \
|
||||
https://api.openai.com/v1/ \
|
||||
-d '{'model': 'gpt-3.5-turbo', 'messages': <YOUR HUMANLOOP PROMPT TEMPLATE>}'
|
||||
-d '{'model': 'gpt-4o', 'messages': <YOUR HUMANLOOP PROMPT TEMPLATE>}'
|
||||
```
|
||||
|
||||
## How to set model
|
||||
|
|
@ -137,7 +137,7 @@ You can do `humanloop/<litellm_model_name>`
|
|||
|
||||
```python
|
||||
litellm.completion(
|
||||
model="humanloop/gpt-3.5-turbo", # or `humanloop/anthropic/claude-3-5-sonnet`
|
||||
model="humanloop/gpt-4o", # or `humanloop/anthropic/claude-3-5-sonnet`
|
||||
...
|
||||
)
|
||||
```
|
||||
|
|
@ -147,9 +147,9 @@ litellm.completion(
|
|||
|
||||
```yaml
|
||||
model_list:
|
||||
- model_name: gpt-3.5-turbo
|
||||
- model_name: gpt-4o
|
||||
litellm_params:
|
||||
model: humanloop/gpt-3.5-turbo # OR humanloop/anthropic/claude-3-5-sonnet
|
||||
model: humanloop/gpt-4o # OR humanloop/anthropic/claude-3-5-sonnet
|
||||
prompt_id: <humanloop_prompt_id>
|
||||
api_key: os.environ/OPENAI_API_KEY
|
||||
```
|
||||
|
|
@ -170,7 +170,7 @@ This also returns the template model set on Humanloop.
|
|||
... # your prompt template
|
||||
}
|
||||
],
|
||||
"model": "gpt-3.5-turbo" # your template model
|
||||
"model": "gpt-4o" # your template model
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ litellm.success_callback = ["lago"]
|
|||
|
||||
# openai call
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "Hi 👋 - i'm openai"}
|
||||
],
|
||||
|
|
@ -99,7 +99,7 @@ client = openai.OpenAI(
|
|||
)
|
||||
|
||||
# request sent to model set on litellm proxy, `litellm --model`
|
||||
response = client.chat.completions.create(model="gpt-3.5-turbo", messages = [
|
||||
response = client.chat.completions.create(model="gpt-4o", messages = [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "this is a test request, write a short poem"
|
||||
|
|
@ -125,7 +125,7 @@ os.environ["OPENAI_API_KEY"] = "anything"
|
|||
|
||||
chat = ChatOpenAI(
|
||||
openai_api_base="http://0.0.0.0:4000",
|
||||
model = "gpt-3.5-turbo",
|
||||
model = "gpt-4o",
|
||||
temperature=0.1,
|
||||
extra_body={
|
||||
"user": "my_customer_id" # 👈 whatever your customer id is
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ litellm.callbacks = ["langfuse_otel"]
|
|||
|
||||
# Make LLM requests as usual
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[{"role": "user", "content": "Hello!"}]
|
||||
)
|
||||
```
|
||||
|
|
@ -168,7 +168,7 @@ All metadata fields available in the vanilla Langfuse integration are now **full
|
|||
|
||||
```python
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[{"role": "user", "content": "Hello!"}],
|
||||
metadata={
|
||||
"generation_name": "welcome-message",
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ litellm --config config.yaml
|
|||
curl --location 'http://0.0.0.0:4000/chat/completions' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"model": "gpt-4o",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ litellm.failure_callback = ["literalai"] # Log Errors to LiteralAI
|
|||
|
||||
# openai call
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "Hi 👋 - i'm openai"}
|
||||
]
|
||||
|
|
@ -59,7 +59,7 @@ literalai_client = LiteralClient()
|
|||
def my_agent(question: str):
|
||||
# agent logic here
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": question}
|
||||
],
|
||||
|
|
@ -100,7 +100,7 @@ literalai_client = LiteralClient(api_key="")
|
|||
literalai_client.instrument_openai()
|
||||
|
||||
settings = {
|
||||
"model": "gpt-3.5-turbo", # model you want to send litellm proxy
|
||||
"model": "gpt-4o", # model you want to send litellm proxy
|
||||
"temperature": 0,
|
||||
# ... more settings
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ litellm.callbacks = ["opik"]
|
|||
|
||||
# openai call
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "Why is tracking and evaluation of LLMs important?"}
|
||||
]
|
||||
|
|
@ -70,7 +70,7 @@ litellm.callbacks = ["opik"]
|
|||
def streaming_function(input):
|
||||
messages = [{"role": "user", "content": input}]
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=messages,
|
||||
metadata = {
|
||||
"opik": {
|
||||
|
|
@ -92,9 +92,9 @@ chunks = list(response)
|
|||
|
||||
```yaml
|
||||
model_list:
|
||||
- model_name: gpt-3.5-turbo-testing
|
||||
- model_name: gpt-4o-testing
|
||||
litellm_params:
|
||||
model: gpt-3.5-turbo
|
||||
model: gpt-4o
|
||||
api_key: os.environ/OPENAI_API_KEY
|
||||
|
||||
litellm_settings:
|
||||
|
|
@ -118,7 +118,7 @@ curl -L -X POST 'http://0.0.0.0:4000/v1/chat/completions' \
|
|||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer sk-1234' \
|
||||
-d '{
|
||||
"model": "gpt-3.5-turbo-testing",
|
||||
"model": "gpt-4o-testing",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
|
|
@ -156,7 +156,7 @@ litellm.callbacks = ["opik"]
|
|||
|
||||
messages = [{"role": "user", "content": input}]
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=messages,
|
||||
metadata = {
|
||||
"opik": {
|
||||
|
|
@ -177,7 +177,7 @@ curl -L -X POST 'http://0.0.0.0:4000/v1/chat/completions' \
|
|||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer sk-1234' \
|
||||
-d '{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"model": "gpt-4o",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
|
|
@ -210,7 +210,7 @@ curl --location --request POST 'http://0.0.0.0:4000/chat/completions' \
|
|||
--header 'opik_thread_id: your-thread-id' \
|
||||
--header 'opik_tags: ["streaming-test"]' \
|
||||
--data '{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"model": "gpt-4o",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
|
|
@ -244,7 +244,7 @@ curl -L -X POST 'http://0.0.0.0:4000/v1/chat/completions' \
|
|||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer sk-key-from-step-1' \
|
||||
-d '{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"model": "gpt-4o",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ PostHog is an open-source product analytics platform that helps you track and an
|
|||
|
||||
```yaml
|
||||
model_list:
|
||||
- model_name: gpt-3.5-turbo
|
||||
- model_name: gpt-4o
|
||||
litellm_params:
|
||||
model: gpt-3.5-turbo
|
||||
model: gpt-4o
|
||||
|
||||
litellm_settings:
|
||||
success_callback: ["posthog"]
|
||||
|
|
@ -41,7 +41,7 @@ Test Request
|
|||
curl --location 'http://0.0.0.0:4000/chat/completions' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"model": "gpt-4o",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
|
|
@ -102,7 +102,7 @@ litellm.success_callback = ["posthog"]
|
|||
|
||||
# openai call
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "Hi - i'm openai"}
|
||||
],
|
||||
|
|
@ -126,7 +126,7 @@ import litellm
|
|||
litellm.success_callback = ["posthog"]
|
||||
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "Hello world"}
|
||||
],
|
||||
|
|
@ -148,7 +148,7 @@ client = openai.OpenAI(
|
|||
)
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "Hello world"}
|
||||
],
|
||||
|
|
@ -173,7 +173,7 @@ litellm.success_callback = ["posthog"]
|
|||
|
||||
# Use custom PostHog credentials for this specific request
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "Hello world"}
|
||||
],
|
||||
|
|
@ -197,7 +197,7 @@ import litellm
|
|||
litellm.success_callback = ["posthog"]
|
||||
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "This won't be logged"}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ litellm.success_callback = ["langfuse"]
|
|||
|
||||
# openai call
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "Hi 👋 - i'm openai"}
|
||||
]
|
||||
|
|
@ -78,7 +78,7 @@ litellm.return_response_headers = True
|
|||
os.environ["OPENAI_API_KEY"] = "your-api-key"
|
||||
|
||||
response = litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[{ "content": "Hello, how are you?","role": "user"}]
|
||||
)
|
||||
|
||||
|
|
@ -92,9 +92,9 @@ print(response._hidden_params)
|
|||
|
||||
```yaml
|
||||
model_list:
|
||||
- model_name: gpt-3.5-turbo
|
||||
- model_name: gpt-4o
|
||||
litellm_params:
|
||||
model: gpt-3.5-turbo
|
||||
model: gpt-4o
|
||||
api_key: os.environ/GROQ_API_KEY
|
||||
|
||||
litellm_settings:
|
||||
|
|
@ -108,7 +108,7 @@ curl -X POST 'http://0.0.0.0:4000/chat/completions' \
|
|||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer sk-1234' \
|
||||
-D '{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"model": "gpt-4o",
|
||||
"messages": [
|
||||
{ "role": "system", "content": "Use your tools smartly"},
|
||||
{ "role": "user", "content": "What time is it now? Use your tool"}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ litellm.success_callback = ["langfuse"]
|
|||
|
||||
|
||||
## sync
|
||||
response = completion(model="gpt-3.5-turbo", messages=[{ "role": "user", "content": "Hi 👋 - i'm openai"}],
|
||||
response = completion(model="gpt-4o", messages=[{ "role": "user", "content": "Hi 👋 - i'm openai"}],
|
||||
stream=True)
|
||||
for chunk in response:
|
||||
continue
|
||||
|
|
@ -89,7 +89,7 @@ for chunk in response:
|
|||
import asyncio
|
||||
|
||||
def async completion():
|
||||
response = await acompletion(model="gpt-3.5-turbo", messages=[{ "role": "user", "content": "Hi 👋 - i'm openai"}],
|
||||
response = await acompletion(model="gpt-4o", messages=[{ "role": "user", "content": "Hi 👋 - i'm openai"}],
|
||||
stream=True)
|
||||
async for chunk in response:
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ litellm.failure_callback=["supabase"]
|
|||
|
||||
# openai call
|
||||
response = completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}],
|
||||
user="ishaan22" # identify users
|
||||
)
|
||||
|
|
@ -87,7 +87,7 @@ Pass `user` to `litellm.completion` to map your llm call to an end-user
|
|||
|
||||
```python
|
||||
response = completion(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-4o",
|
||||
messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}],
|
||||
user="ishaan22" # identify users
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue