feat(llm): implement resilient streaming and native structured output#402
Open
feat(llm): implement resilient streaming and native structured output#402
Conversation
Introduce a provider-agnostic resilience layer for LLM requests and enable native structured output support across all providers. This overhaul replaces the previous tool-based schema enforcement with native provider capabilities (OpenAI Strict Mode, Anthropic Structured Outputs, Gemini JSON Schema). It includes a robust error classification system (`StreamError`) that automatically handles retries with exponential backoff for transient network errors and rate limits. The tool execution layer is refactored to support asynchronous cancellation, improved parameter validation with automatic default injection, and a new builtin tool system starting with `describe_tools`. Additional enhancements include: - Support for adaptive reasoning in Claude Opus 4.6+. - Complete rewrite of the `llamacpp` provider to use SSE and support deepseek-style reasoning content. - A new `MockProvider` and `ExecutorSource` to facilitate side-effect free testing of conversation flows. - Automated description splitting for generating concise tool summaries. Signed-off-by: Jean Mertz <git@jeanmertz.com>
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.
Introduce a provider-agnostic resilience layer for LLM requests and enable native structured output support across all providers.
This overhaul replaces the previous tool-based schema enforcement with native provider capabilities (OpenAI Strict Mode, Anthropic Structured Outputs, Gemini JSON Schema). It includes a robust error classification system (
StreamError) that automatically handles retries with exponential backoff for transient network errors and rate limits.The tool execution layer is refactored to support asynchronous cancellation, improved parameter validation with automatic default injection, and a new builtin tool system starting with
describe_tools.Additional enhancements include:
llamacppprovider to use SSE and support deepseek-style reasoning content.MockProviderandExecutorSourceto facilitate side-effect free testing of conversation flows.