api_doc and calc ttft#795
Closed
369pro wants to merge 2 commits intoMemTensor:devfrom
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces API documentation generation and Time-To-First-Token (TTFT) performance tracking for LLM streaming operations. The changes enable detailed performance metrics collection during model inference.
Key Changes:
- Enhanced TTFT calculation in OpenAI streaming client with model information logging
- Added performance tracking decorator that computes content metrics including speed and length
- Modified OpenAPI export to generate documentation directly from router definitions
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/memos/utils.py | Added performance metrics logging with content length/speed calculations for LLM responses |
| src/memos/llms/openai.py | Implemented TTFT measurement for streaming responses with model version tracking |
| src/memos/cli.py | Refactored OpenAPI export to generate schema from router instead of full app |
| docs/openapi.json | Updated OpenAPI documentation reflecting new API structure and endpoints |
Comments suppressed due to low confidence (1)
src/memos/utils.py:1
- Corrected spelling of 'monitering' to 'monitoring'.
import functools
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| ], | ||
| "title": "Task Id", | ||
| "description": "Task ID for monitering async tasks" |
There was a problem hiding this comment.
Corrected spelling of 'monitering' to 'monitoring'.
Suggested change
| "description": "Task ID for monitering async tasks" | |
| "description": "Task ID for monitoring async tasks" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary: (summary)
Fix: #(issue)
Docs Issue/PR: (docs-issue-or-pr-link)
Reviewer: @(reviewer)
Checklist: