-
Notifications
You must be signed in to change notification settings - Fork 276
Thinking blocks support #1219
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
Thinking blocks support #1219
Conversation
ThinkingBlocks abstraction suppot PromptRunner API withThinking Introduced ChatResponseWithThinking for PromptRunner createObject APIs Delegation from OperationContextPromptRunner to ChatClientLLMOperations for thinking support Comprehensive unit and integration testing
…separate functions to reduce complexity
johnsonr
left a comment
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.
Great stuff. Really important functionality.
embabel-agent-api/src/main/java/com/embabel/agent/api/thinking/ThinkingPromptRunnerBuilder.java
Outdated
Show resolved
Hide resolved
...ent-api/src/main/kotlin/com/embabel/agent/api/common/support/OperationContextPromptRunner.kt
Outdated
Show resolved
Hide resolved
...ent-api/src/main/kotlin/com/embabel/agent/api/common/support/OperationContextPromptRunner.kt
Show resolved
Hide resolved
embabel-agent-api/src/main/kotlin/com/embabel/agent/api/common/thinking/ThinkingExtensions.kt
Outdated
Show resolved
Hide resolved
embabel-agent-api/src/main/kotlin/com/embabel/chat/ChatResponseWithThinking.kt
Outdated
Show resolved
Hide resolved
renamed and moved Reponse With Thinking and Thinking Exception to recommended package factored API withThinking into PromptRunner introduced tag interface Thinking Capability to ensure thinking gets applied only to proper prompt runner operations ensure createObject and other APIs will not compile on prompt runners that do not implement thinking functionality more fluent java builder API
PromptRunner withThinking returns ThinkingPromptRunnerOperations - single critical change Removed Thinking Extensions Renamed ResponseWithThinking to ThinkingResponse Updated java Thinking IT tests to use Core PromptRunner API, rather than builder Thinking Builder - not deprecated, for supporting builder pattern, does not rely on extensions anylonger Updated documentation with reference to Core API rather than builder
|
commit 688a53a (HEAD -> thinking-blocks-support, origin/thinking-blocks-support) |
johnsonr
left a comment
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.
Very close now. Good stuff
embabel-agent-api/src/main/kotlin/com/embabel/agent/api/common/PromptRunner.kt
Outdated
Show resolved
Hide resolved
embabel-agent-api/src/main/java/com/embabel/agent/api/thinking/ThinkingPromptRunnerBuilder.java
Outdated
Show resolved
Hide resolved
...ent-api/src/main/kotlin/com/embabel/agent/api/common/support/OperationContextPromptRunner.kt
Outdated
Show resolved
Hide resolved
embabel-agent-api/src/main/java/com/embabel/agent/api/thinking/ThinkingPromptRunnerBuilder.java
Outdated
Show resolved
Hide resolved
Enhanced documentation Updated multi-line text
|



Add Comprehensive Thinking Extraction Support
Summary
This PR implements complete end-to-end thinking extraction functionality,
enabling LLMs clients with reasoning content alongside structured outputs.
The implementation spans API design, integration with Spring AI, manual
converter chains, and comprehensive test coverage.
New API Surface
Execution Flow
Key Components
withThinkingoperations
operations
blocks
ChatClientLlmOperations
methods
thinking blocks
definitions
Technical Approach
Manual Converter Chain Pattern
Thinking Block Preservation
ThinkingException for createObjectIfPossible
Test Coverage
Unit Tests
validation
Integration Tests
Files Modified
Usage Examples
Java
Addressed code complexity in ChatClientLlmOperations by moving exception handling blocks and prompt builders into separate private methods,
This implementation provides complete thinking extraction capabilities
while maintaining backward compatibility and comprehensive test coverage
across multiple LLM providers
Note: this PR depends on another PR:
embabel/embabel-common#99