-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add completion start time timestamp to relevant generators #8728
Conversation
Pull Request Test Coverage Report for Build 12825406823Details
💛 - Coveralls |
Co-authored-by: Stefano Fiorucci <[email protected]>
@julian-risch @anakin87 while at this, I suggest we do the same for the popular generators integrations like ollama, bedrock, and cohere. Or perhaps not - LMK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of introducing metadata that are very specific (for Langfuse in this case), but I don't see alternative solutions and the PR looks good.
On introducing this metadata in other (Chat)Generators, I would only focus on those supported by our Langfuse implementation: https://github.com/deepset-ai/haystack-core-integrations/blob/72989f4461b863d8be6051dbed5fdefdd6d870ed/integrations/langfuse/src/haystack_integrations/tracing/langfuse/tracer.py#L18
Why:
Enhances Langfuse integration to track the time-to-first-token (TTFT) in streaming responses. The new entry in chat message metadata
completion_start_time
enables TTFT tracking in Langfuse. We'll separately update all other relevant generators in https://github.com/deepset-ai/haystack-core-integrations/What:
completion_start_time
metadata in theHugging Face API
andOpenAI
chat and non-chat generators to record the TTFT.completion_start_time
and its format correctness.How can it be used:
This change allows developers to track the exact start time of streaming completions, aiding in performance diagnostics
How did you test it:
Included updated unit tests for both
Hugging Face API
andOpenAI
chat and non-chat generators to ensure the presence and correct ISO format ofcompletion_start_time
metadata. These tests verify that the timestamps are recorded and formatted correctly during streaming responses.Notes for the reviewer:
Ensure close attention to the new metadata handling and its correctness across different components. Testing has validated the format, but real integration checks are recommended for full assurance.