Skip to content

refactor(knowledgeservices): migrate schema handling to knowledge service implementation#83

Merged
absoludity merged 3 commits into
masterfrom
feat/anthropic-ks-structured-output-1
Feb 3, 2026
Merged

refactor(knowledgeservices): migrate schema handling to knowledge service implementation#83
absoludity merged 3 commits into
masterfrom
feat/anthropic-ks-structured-output-1

Conversation

@absoludity

@absoludity absoludity commented Jan 28, 2026

Copy link
Copy Markdown
Collaborator

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 PointableJSONSchema which 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

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.
@absoludity absoludity marked this pull request as draft January 29, 2026 00:27
@absoludity

Copy link
Copy Markdown
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.

@absoludity absoludity marked this pull request as ready for review February 2, 2026 02:33
@absoludity absoludity changed the title use_cases: migrate schema handling to knowledge service layer refactor(knowledgeservices): migrate schema handling to knowledge service implementation Feb 3, 2026

@monkeypants monkeypants left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good move: JSON schema embedding and response parsing belongs in the infrastructure layer, not the domain layer.

@absoludity absoludity merged commit ffba1cb into master Feb 3, 2026
6 checks passed
@absoludity absoludity deleted the feat/anthropic-ks-structured-output-1 branch February 3, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants