anthropic: adds a schema pre-processor for compatibility.#84
Closed
absoludity wants to merge 2 commits into
Closed
anthropic: adds a schema pre-processor for compatibility.#84absoludity wants to merge 2 commits into
absoludity wants to merge 2 commits into
Conversation
Not yet used, it'll be integrated in the next branch.
4 tasks
Collaborator
Author
|
Closing this PR for now, since even with the preprocessed schema, we end up getting the following error from anthropic: Trying another approach which keeps the schema with the original request prompt but uses a basic structured output schema just to ensure we get json back. |
Collaborator
Author
Re-opening since the above won't work (anthropic only returns data from the schema, and explicitly ensures |
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.
When hooking the anthropic knowledge service up with the public beta structured output support, I hit a bunch of issues for unsupported schema elements.
Their documentation lists the JSON Schema limitations but as you'll see from the diff here, it's not limited to those limitations :/
When running with structured outputs with our DPP schema, this code is some of what is required for preprocessing the schema. I'm still not finished... note to self: current error is requiring the next preprocessing step is:
julee-rba-worker-1 | temporalio.exceptions.ApplicationError: BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': "For 'string' type, format 'binary' is not supported"}, 'request_id': 'req_011CXbBgjLvvbB4BfBHsjQMw'}I will try to complete this pre-processor, but the bigger the preprocessing change, the less useful the structured output is for us I think.
This PR isolates just the preprocessor... I have a following branch which then uses this to use the structured output, which I'll push once this preprocessor is allowing the query to succeed.
Ref #60