ai: unify claude JSON instructions and error handling#174
Conversation
|
Tested PR #174 on Vertex AI with The Claude API requires lowercase ( This is the same issue as #107. PR #108 (closed) fixed both problems (response_format + uppercase schemas), but only the response_format half made it into this PR. Quick fix -- in Also check |
eab940f to
09b0464
Compare
09b0464 to
b27f7e1
Compare
Co-authored-by: Gemini CLI <noreply@google.com> Signed-off-by: derekbarbosa <derekasobrab@gmail.com>
Co-authored-by: Gemini CLI <noreply@google.com> Signed-off-by: derekbarbosa <derekasobrab@gmail.com>
b27f7e1 to
9bf0d40
Compare
|
Reworded some commits, added some more error handling for claude_cli, and unified JSON prompt building/formatting for claude responses. |
Co-authored-by: Gemini CLI <noreply@google.com> Signed-off-by: derekbarbosa <derekasobrab@gmail.com>
Co-authored-by: Gemini CLI <noreply@google.com> Signed-off-by: derekbarbosa <derekasobrab@gmail.com>
Co-authored-by: Gemini CLI <noreply@google.com> Signed-off-by: derekbarbosa <derekasobrab@gmail.com>
9bf0d40 to
9b49275
Compare
|
Addressed some Tested using us-east5 endpoint, E2E patch submission successful with sonnet & opus models via vertex. ready for review! @rgushchin |
|
Hi @rgushchin, sorry for the noise. Seems like there are others encountering the JSON encoding issue. Kindly asking for a review :-) |
|
Hi Derek, Thanks for the PR. I ran a check against the JSON-format failures collected from my various benchmark runs. The response-format side looks useful and centralizing the JSON response-format instruction should help cases where the model returns prose or JSON that misses the required top-level schema fields. I also replayed a small matrix of observed JSON/format failure classes. The PR helps with the instruction/schema side. Br, Anders |
|
Hey Anders, Thank you for posting your findings, it certainly helps. I'm glad the proposed changes address some of the formatting issues. Hopefully pairing this with TodoWrite may increase the consistency wrt failures across the board |
Centralizes JSON instruction logic in src/ai/mod.rs by adding AiResponseFormat::format_json_schema_instruction().
Improves claude-cli in src/ai/claude_cli.rs:
Unifies Claude API in src/ai/claude.rs:
Updates error classification in src/ai/mod.rs to support the new ClaudeCliError.
fixes #171