mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
Merge pull request #2484 from BerriAI/litellm_fix_langfuse_default
[Proxy-High Traffic] Fix using Langfuse in high traffic
This commit is contained in:
commit
3922b827f8
3 changed files with 4 additions and 3 deletions
|
|
@ -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}"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue