-
Notifications
You must be signed in to change notification settings - Fork 76
LCORE-461: sequence diagram for streaming query endpoint #792
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -80,6 +80,7 @@ The service includes comprehensive user data collection capabilities for various | |||||||||||||
| * [REST API](#rest-api) | ||||||||||||||
| * [Sequence diagrams](#sequence-diagrams) | ||||||||||||||
| * [Query endpoint REST API handler](#query-endpoint-rest-api-handler) | ||||||||||||||
| * [Streaming query endpoint REST API handler](#streaming-query-endpoint-rest-api-handler) | ||||||||||||||
|
|
||||||||||||||
| <!-- vim-markdown-toc --> | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -900,3 +901,7 @@ For complete integration setup, deployment options, and configuration details, s | |||||||||||||
| ### Query endpoint REST API handler | ||||||||||||||
|
|
||||||||||||||
|  | ||||||||||||||
|
|
||||||||||||||
| ## Streaming query endpoint REST API handler | ||||||||||||||
|
|
||||||||||||||
|  | ||||||||||||||
|
Comment on lines
+905
to
+907
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix heading level to match document structure. The heading uses Apply this diff to fix the heading level: -## Streaming query endpoint REST API handler
+### Streaming query endpoint REST API handler📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| @startuml | ||
|
|
||
| participant Client | ||
| participant Endpoint as "Streaming query endpoint handler" | ||
| participant Auth | ||
| participant LlamaStack as "Llama Stack Client" | ||
| participant EventHandler as "Stream build event" | ||
| participant SSE as "SSE Response Stream" | ||
|
|
||
| Client->>Endpoint: HTTP POST /stream_query | ||
| Endpoint->>Auth: Validate auth, user, conversation access | ||
| Auth-->>Endpoint: Access granted | ||
| Endpoint->>LlamaStack: Call retrieve_response(model, query) | ||
| LlamaStack-->>Endpoint: AsyncIterator[AgentTurnResponseStreamChunk] | ||
|
|
||
| Endpoint->>SSE: stream_start_event(conversation_id) | ||
| SSE-->>Client: SSE: start | ||
|
|
||
| loop For each chunk from LlamaStack | ||
| Endpoint->>EventHandler: stream_build_event(chunk, chunk_id, metadata) | ||
| alt Chunk Type: turn_start | ||
| EventHandler->>SSE: emit turn_start event | ||
| else Chunk Type: inference | ||
| EventHandler->>SSE: emit inference (token) event | ||
| else Chunk Type: tool_execution | ||
| EventHandler->>SSE: emit tool_call + tool_result events | ||
| else Chunk Type: shield | ||
| EventHandler->>SSE: emit shield validation event | ||
| else Chunk Type: turn_complete | ||
| EventHandler->>SSE: emit turn_complete event | ||
| else Error | ||
| EventHandler->>SSE: emit error event | ||
| end | ||
| SSE-->>Client: SSE event(s) | ||
| end | ||
|
|
||
| Endpoint->>SSE: stream_end_event(metadata, summary, token_usage) | ||
| SSE-->>Client: SSE: end (with metadata) | ||
|
|
||
| Endpoint->>Endpoint: Conditionally persist transcript & cache | ||
| Endpoint-->>Client: Close stream | ||
|
|
||
| @enduml |
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.
Minor: Indentation inconsistent with markdown linting standards.
The 4-space indentation is consistent with the existing ToC entry on line 82, but markdownlint expects 2 spaces for nested list items. While this maintains consistency with the current style, consider updating both entries to use 2-space indentation in a follow-up to comply with markdown standards.
Apply this diff to fix the indentation:
* [Sequence diagrams](#sequence-diagrams) * [Query endpoint REST API handler](#query-endpoint-rest-api-handler) - * [Streaming query endpoint REST API handler](#streaming-query-endpoint-rest-api-handler) + * [Streaming query endpoint REST API handler](#streaming-query-endpoint-rest-api-handler)Note: You may also want to fix line 82 in the same way for full compliance.
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
83-83: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
🤖 Prompt for AI Agents