mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 02:34:29 +00:00
Fix 2
This commit is contained in:
parent
cb52c59481
commit
a3d9e34b26
6 changed files with 29 additions and 13 deletions
|
@ -120,6 +120,7 @@ from litellm import completion
|
||||||
|
|
||||||
## set env variables for logging tools
|
## set env variables for logging tools
|
||||||
os.environ["LUNARY_PUBLIC_KEY"] = "your-lunary-public-key"
|
os.environ["LUNARY_PUBLIC_KEY"] = "your-lunary-public-key"
|
||||||
|
os.environ["HELICONE_AUTH"] = "your-helicone-auth-key"
|
||||||
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
|
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
|
||||||
os.environ["LANGFUSE_SECRET_KEY"] = ""
|
os.environ["LANGFUSE_SECRET_KEY"] = ""
|
||||||
os.environ["ATHINA_API_KEY"] = "your-athina-api-key"
|
os.environ["ATHINA_API_KEY"] = "your-athina-api-key"
|
||||||
|
|
|
@ -87,6 +87,7 @@ from litellm import completion
|
||||||
|
|
||||||
## set env variables for logging tools
|
## set env variables for logging tools
|
||||||
os.environ["LUNARY_PUBLIC_KEY"] = "your-lunary-public-key"
|
os.environ["LUNARY_PUBLIC_KEY"] = "your-lunary-public-key"
|
||||||
|
os.environ["HELICONE_API_KEY"] = "your-helicone-key"
|
||||||
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
|
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
|
||||||
os.environ["LANGFUSE_SECRET_KEY"] = ""
|
os.environ["LANGFUSE_SECRET_KEY"] = ""
|
||||||
|
|
||||||
|
|
|
@ -310,6 +310,7 @@ LiteLLM exposes pre defined callbacks to send data to Lunary, Langfuse, Helicone
|
||||||
from litellm import completion
|
from litellm import completion
|
||||||
|
|
||||||
## set env variables for logging tools
|
## set env variables for logging tools
|
||||||
|
os.environ["HELICONE_API_KEY"] = "your-helicone-key"
|
||||||
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
|
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
|
||||||
os.environ["LANGFUSE_SECRET_KEY"] = ""
|
os.environ["LANGFUSE_SECRET_KEY"] = ""
|
||||||
os.environ["LUNARY_PUBLIC_KEY"] = "your-lunary-public-key"
|
os.environ["LUNARY_PUBLIC_KEY"] = "your-lunary-public-key"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Helicone Tutorial
|
# 🧠 Helicone - OSS LLM Observability Platform
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
|
|
||||||
|
@ -7,47 +7,52 @@ https://github.com/BerriAI/litellm
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|
||||||
[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.
|
[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)
|
## 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.
|
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:
|
||||||
|
|
||||||
### Approach 1: Use Callbacks
|
|
||||||
Use just 1 line of code, to instantly log your responses **across all providers** with helicone:
|
|
||||||
```python
|
```python
|
||||||
litellm.success_callback=["helicone"]
|
litellm.success_callback=["helicone"]
|
||||||
```
|
```
|
||||||
|
|
||||||
Complete code
|
Complete code
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from litellm import completion
|
from litellm import completion
|
||||||
|
|
||||||
## set env variables
|
## set env variables
|
||||||
os.environ["HELICONE_API_KEY"] = "your-helicone-key"
|
os.environ["HELICONE_API_KEY"] = "your-helicone-key"
|
||||||
os.environ["OPENAI_API_KEY"], os.environ["COHERE_API_KEY"] = "", ""
|
os.environ["OPENAI_API_KEY"], os.environ["COHERE_API_KEY"] = "", ""
|
||||||
|
|
||||||
# set callbacks
|
# set callbacks
|
||||||
litellm.success_callback=["helicone"]
|
litellm.success_callback=["helicone"]
|
||||||
|
|
||||||
#openai call
|
#openai call
|
||||||
response = completion(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}])
|
response = completion(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}])
|
||||||
|
|
||||||
#cohere call
|
#cohere call
|
||||||
response = completion(model="command-nightly", messages=[{"role": "user", "content": "Hi 👋 - i'm cohere"}])
|
response = completion(model="command-nightly", messages=[{"role": "user", "content": "Hi 👋 - i'm cohere"}])
|
||||||
```
|
```
|
||||||
|
|
||||||
### Approach 2: [OpenAI + Azure only] Use Helicone as a proxy
|
### 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.
|
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 -
|
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`
|
- Set helicone as your base url via: `litellm.api_url`
|
||||||
- Pass in helicone request headers via: `litellm.headers`
|
- Pass in helicone request headers via: `litellm.headers`
|
||||||
|
|
||||||
Complete Code
|
Complete Code
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import litellm
|
import litellm
|
||||||
from litellm import completion
|
from litellm import completion
|
||||||
|
@ -62,3 +67,10 @@ response = litellm.completion(
|
||||||
|
|
||||||
print(response)
|
print(response)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Group and visualize multi-step LLM interactions.
|
||||||
|
|
||||||
|
Track request flows across multiple traces and gain insights into complex AI workflows by adding only 2 simple headers.
|
||||||
|
|
||||||
|
- `Helicone-Session-Id` - The session id you want to track
|
||||||
|
- `Helicone-Session-Path` - The path of the session
|
||||||
|
|
|
@ -186,6 +186,7 @@ const sidebars = {
|
||||||
type: "category",
|
type: "category",
|
||||||
label: "Logging & Observability",
|
label: "Logging & Observability",
|
||||||
items: [
|
items: [
|
||||||
|
"observability/helicone_integration",
|
||||||
"observability/langfuse_integration",
|
"observability/langfuse_integration",
|
||||||
"observability/logfire_integration",
|
"observability/logfire_integration",
|
||||||
"debugging/local_debugging",
|
"debugging/local_debugging",
|
||||||
|
@ -202,7 +203,6 @@ const sidebars = {
|
||||||
"observability/athina_integration",
|
"observability/athina_integration",
|
||||||
"observability/lunary_integration",
|
"observability/lunary_integration",
|
||||||
"observability/greenscale_integration",
|
"observability/greenscale_integration",
|
||||||
"observability/helicone_integration",
|
|
||||||
"observability/supabase_integration",
|
"observability/supabase_integration",
|
||||||
`observability/telemetry`,
|
`observability/telemetry`,
|
||||||
],
|
],
|
||||||
|
|
|
@ -304,6 +304,7 @@ LiteLLM exposes pre defined callbacks to send data to Lunary, Langfuse, Helicone
|
||||||
from litellm import completion
|
from litellm import completion
|
||||||
|
|
||||||
## set env variables for logging tools
|
## set env variables for logging tools
|
||||||
|
os.environ["HELICONE_API_KEY"] = "your-helicone-key"
|
||||||
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
|
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
|
||||||
os.environ["LANGFUSE_SECRET_KEY"] = ""
|
os.environ["LANGFUSE_SECRET_KEY"] = ""
|
||||||
os.environ["LUNARY_PUBLIC_KEY"] = "your-lunary-public-key"
|
os.environ["LUNARY_PUBLIC_KEY"] = "your-lunary-public-key"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue