Skip to content

Commit 3922b82

Browse files
authored
Merge pull request #2484 from BerriAI/litellm_fix_langfuse_default
[Proxy-High Traffic] Fix using Langfuse in high traffic
2 parents 2b5ba1c + 786df1d commit 3922b82

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

litellm/integrations/langfuse.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def __init__(self, langfuse_public_key=None, langfuse_secret=None):
3333
host=self.langfuse_host,
3434
release=self.langfuse_release,
3535
debug=self.langfuse_debug,
36+
flush_interval=1, # flush interval in seconds
3637
)
3738

3839
if os.getenv("UPSTREAM_LANGFUSE_SECRET_KEY") is not None:
@@ -147,8 +148,6 @@ def log_event(
147148
input,
148149
response_obj,
149150
)
150-
151-
self.Langfuse.flush()
152151
print_verbose(
153152
f"Langfuse Layer Logging - final response object: {response_obj}"
154153
)

litellm/proxy/proxy_load_test/locustfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class MyUser(HttpUser):
88
def chat_completion(self):
99
headers = {
1010
"Content-Type": "application/json",
11+
"Authorization": f"Bearer sk-1234",
1112
# Include any additional headers you may need for authentication, etc.
1213
}
1314

litellm/proxy/proxy_load_test/openai_endpoint.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from fastapi.responses import StreamingResponse
77
from fastapi.security import OAuth2PasswordBearer
88
from fastapi.middleware.cors import CORSMiddleware
9+
import uuid
910

1011
app = FastAPI()
1112

@@ -23,7 +24,7 @@
2324
@app.post("/v1/chat/completions")
2425
async def completion(request: Request):
2526
return {
26-
"id": "chatcmpl-123",
27+
"id": f"chatcmpl-{uuid.uuid4().hex}",
2728
"object": "chat.completion",
2829
"created": 1677652288,
2930
"model": "gpt-3.5-turbo-0125",

0 commit comments

Comments
 (0)