mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
Work with custom LANGSMITH_BASE_URL
This allows working with a custom Langsmith base URL. For example, I can use this to test against a local Langsmith instance, running on my laptop with Docker by adding this to the proxy config: ```yaml litellm_settings: success_callback: ["langsmith"] environment_variables: LANGSMITH_BASE_URL: "http://localhost:1984" LANGSMITH_PROJECT: "litellm-proxy" ```
This commit is contained in:
parent
680a582847
commit
ee98b1b355
2 changed files with 24 additions and 1 deletions
|
@ -71,6 +71,23 @@ response = litellm.completion(
|
||||||
)
|
)
|
||||||
print(response)
|
print(response)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Make LiteLLM Proxy use Custom `LANGSMITH_BASE_URL`
|
||||||
|
|
||||||
|
If you're using a custom LangSmith instance, you can set the
|
||||||
|
`LANGSMITH_BASE_URL` environment variable to point to your instance.
|
||||||
|
For example, you can make LiteLLM Proxy log to a local LangSmith instance with
|
||||||
|
this config:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
litellm_settings:
|
||||||
|
success_callback: ["langsmith"]
|
||||||
|
|
||||||
|
environment_variables:
|
||||||
|
LANGSMITH_BASE_URL: "http://localhost:1984"
|
||||||
|
LANGSMITH_PROJECT: "litellm-proxy"
|
||||||
|
```
|
||||||
|
|
||||||
## Support & Talk to Founders
|
## Support & Talk to Founders
|
||||||
|
|
||||||
- [Schedule Demo 👋](https://calendly.com/d/4mp-gd3-k5k/berriai-1-1-onboarding-litellm-hosted-version)
|
- [Schedule Demo 👋](https://calendly.com/d/4mp-gd3-k5k/berriai-1-1-onboarding-litellm-hosted-version)
|
||||||
|
|
|
@ -44,6 +44,8 @@ class LangsmithLogger:
|
||||||
print_verbose(
|
print_verbose(
|
||||||
f"Langsmith Logging - project_name: {project_name}, run_name {run_name}"
|
f"Langsmith Logging - project_name: {project_name}, run_name {run_name}"
|
||||||
)
|
)
|
||||||
|
langsmith_base_url = os.getenv("LANGSMITH_BASE_URL", "https://api.smith.langchain.com")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print_verbose(
|
print_verbose(
|
||||||
f"Langsmith Logging - Enters logging function for model {kwargs}"
|
f"Langsmith Logging - Enters logging function for model {kwargs}"
|
||||||
|
@ -86,8 +88,12 @@ class LangsmithLogger:
|
||||||
"end_time": end_time,
|
"end_time": end_time,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
url = f"{langsmith_base_url}/runs"
|
||||||
|
print_verbose(
|
||||||
|
f"Langsmith Logging - About to send data to {url} ..."
|
||||||
|
)
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
"https://api.smith.langchain.com/runs",
|
url=url,
|
||||||
json=data,
|
json=data,
|
||||||
headers={"x-api-key": self.langsmith_api_key},
|
headers={"x-api-key": self.langsmith_api_key},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue