Merge pull request #2484 from BerriAI/litellm_fix_langfuse_default

[Proxy-High Traffic] Fix using Langfuse in high traffic
This commit is contained in:
Ishaan Jaff 2024-03-12 19:35:24 -07:00 • committed by GitHub
commit 3922b827f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View file

@ -33,6 +33,7 @@ class LangFuseLogger:
host=self.langfuse_host,
release=self.langfuse_release,
debug=self.langfuse_debug,
flush_interval=1, # flush interval in seconds
)
if os.getenv("UPSTREAM_LANGFUSE_SECRET_KEY") is not None:
@ -147,8 +148,6 @@ class LangFuseLogger:
input,
response_obj,
)
self.Langfuse.flush()
print_verbose(
f"Langfuse Layer Logging - final response object: {response_obj}"
)

View file

@ -8,6 +8,7 @@ class MyUser(HttpUser):
def chat_completion(self):
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer sk-1234",
# Include any additional headers you may need for authentication, etc.
}

View file

@ -6,6 +6,7 @@ from fastapi import FastAPI, Request, status, HTTPException, Depends
from fastapi.responses import StreamingResponse
from fastapi.security import OAuth2PasswordBearer
from fastapi.middleware.cors import CORSMiddleware
import uuid
app = FastAPI()
@ -23,7 +24,7 @@ app.add_middleware(
@app.post("/v1/chat/completions")
async def completion(request: Request):
return {
"id": "chatcmpl-123",
"id": f"chatcmpl-{uuid.uuid4().hex}",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-3.5-turbo-0125",