BerriAI / litellm

Call all LLM APIs using the OpenAI format. Use Bedrock, Azure, OpenAI, Cohere, Anthropic, Ollama, Sagemaker, HuggingFace, Replicate (100+ LLMs)
https://docs.litellm.ai/docs/
Other
10.05k stars 1.12k forks source link

[Bug]: Langfuse Integration counts Embedding Response as Output Tokens #4225

Closed hburrichter closed 1 week ago

hburrichter commented 1 week ago

What happened?

The Langfuse integration currently counts the embedding response (the vector data) as output tokens of the observation. These vectors are quite large, often around 30,000 tokens for an OpenAI text-embedding-3-large embedding vector. This overshadows the actual generated output tokens (from completion models) of the entire trace, making it difficult to see how many tokens were genuinely generated, especially in the trace list view.

I do not believe displaying the entire embedding vector as the output provides any value in the Langfuse UI. At the very least, the output vector should not count towards the total used tokens for this particular observation and the whole trace.

Here is a screenshots that shows this problem.

Screenshot 2024-06-16 at 15 31 47

Relevant log output

No response

Twitter / LinkedIn details

No response