Skip to content
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 support for ttft #1161

Merged
merged 5 commits into from
Nov 9, 2024
Merged

Conversation

LastRemote
Copy link
Contributor

Related Issues

Proposed Changes:

Support TTFT by casting isoformat to a datetime object and include it in a generation.

How did you test it?

Unit test. I also have E2E tests in my version, which is almost the same but not exactly.

Notes for the reviewer

Checklist

@LastRemote LastRemote requested a review from a team as a code owner October 30, 2024 11:27
@LastRemote LastRemote requested review from shadeMe and removed request for a team October 30, 2024 11:27
@CLAassistant
Copy link

CLAassistant commented Oct 30, 2024

CLA assistant check
All committers have signed the CLA.

@vblagoje
Copy link
Member

vblagoje commented Nov 1, 2024

Hey @LastRemote it seems like you nee to sign CLA for https://github.com/deepset-ai/haystack-core-integrations - perhaps you have already? 🙏

@LastRemote
Copy link
Contributor Author

Hey @LastRemote it seems like you nee to sign CLA for https://github.com/deepset-ai/haystack-core-integrations - perhaps you have already? 🙏

No I actually haven't. But now it's done.

Copy link
Member

@vblagoje vblagoje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LastRemote looks good but let's just handle this ValueError in case the time data is invalid

span._span.update(usage=meta.get("usage") or None, model=meta.get("model"))
completion_start_time = meta.get("completion_start_time")
if completion_start_time:
completion_start_time = datetime.fromisoformat(completion_start_time)
Copy link
Member

@vblagoje vblagoje Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fromisoformat throws ValueError for irregular format provided. Let's try/catch it, log it, and skip ttft in that case, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do. Normally this won't be the case though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree, thanks for your understanding 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, and also added a new unit test for this.

@github-actions github-actions bot added the type:documentation Improvements or additions to documentation label Nov 8, 2024
@vblagoje vblagoje self-requested a review November 9, 2024 10:01
Copy link
Member

@vblagoje vblagoje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @LastRemote - thanks for another great contribution!

@vblagoje vblagoje merged commit 34ae0bd into deepset-ai:main Nov 9, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration:langfuse type:documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants