refactor(knowledgeservices): migrate schema handling to knowledge service implementation#83
Merged
Merged
Conversation
Move schema embedding and JSON parsing responsibilities from ExtractAssembleDataUseCase to knowledge service implementations. Use case now passes schema via query_metadata and expects parsed objects. Maintains current prompt-based behavior internally. This is part 1 of a 2 part series switching the anthropic KS to use structured output.
Collaborator
Author
|
Just switching this to draft as, while working on the following branch, I've realised I need to send the whole schema to the knowledge service, not just the fragment for the query. |
monkeypants
reviewed
Feb 3, 2026
monkeypants
left a comment
Contributor
There was a problem hiding this comment.
Good move: JSON schema embedding and response parsing belongs in the infrastructure layer, not the domain layer.
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.
Move the use-case's schema embedding of the query and JSON parsing responsibilities of the query result from ExtractAssembleDataUseCase to knowledge service implementations, which can themselves have native support for this functionality. The use case uses a new
PointableJSONSchemawhich allows the knowledge service to receive the required schema for the query. When a schema is included in the request, then the response will be JSON.This is part 1 of a 2 part series switching the anthropic KS to return structured output.
I've verified that this works e2e in an integration with another project with no side effects.
Ref #60