mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +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
b170259a88
commit
bf4f08ac30
2 changed files with 24 additions and 1 deletions
|
@ -44,6 +44,8 @@ class LangsmithLogger:
|
|||
print_verbose(
|
||||
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:
|
||||
print_verbose(
|
||||
f"Langsmith Logging - Enters logging function for model {kwargs}"
|
||||
|
@ -86,8 +88,12 @@ class LangsmithLogger:
|
|||
"end_time": end_time,
|
||||
}
|
||||
|
||||
url = f"{langsmith_base_url}/runs"
|
||||
print_verbose(
|
||||
f"Langsmith Logging - About to send data to {url} ..."
|
||||
)
|
||||
response = requests.post(
|
||||
"https://api.smith.langchain.com/runs",
|
||||
url=url,
|
||||
json=data,
|
||||
headers={"x-api-key": self.langsmith_api_key},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue