feat(answer-v2)!: align SDK types with the /v2/answer API - #10
Merged
Conversation
Bring the SDK type surface in line with the current api-staan Answer V2 endpoint: - language: accept 'fr' | 'en' (was 'fr' only); default stays 'fr' - drop the obsolete `style` input field — it no longer exists on the API and, with forbidNonWhitelisted validation, sending it yields a 400 - AnswerV2Result: drop `finish_reason` and `generation_ms` (never returned by the non-streaming response) - AnswerV2Event: drop the `usages` stream event — the API filters usage out of the SSE stream, so clients never receive it - fix `sources` max (10, not 20) and the `filter` domain example Docs, examples and tests updated to match. BREAKING CHANGE: `style` is removed from AnswerV2Input; `finish_reason` and `generation_ms` are removed from AnswerV2Result; the `usages` stream event is removed from AnswerV2Event. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Context
The Answer V2 API (
POST /v2/answer) has evolved and the SDK's type surface had drifted from it. This PR realigns the published types with the current API contract.Changes
Request (
AnswerV2Input)language: now accepts'fr' | 'en'(was'fr'only); default stays'fr'stylefield — it is no longer accepted by the API and sending it results in a400sources: doc fixed (max 10)filter: example fixed (example.com— bare domain, nowww/scheme)Non-streaming response (
AnswerV2Result)finish_reasonandgeneration_ms— not returned by the non-streaming responseStream events (
AnswerV2Event)usagesstream event — it is not emitted over the SSE stream, so clients never receive itREADME, examples and tests updated accordingly.
Note on streaming usages
Dropping the
usagesstream event matches current behavior. Streaming usage reporting will be added later, end to end.Validation
Removes
style(input),finish_reason/generation_ms(result) and theusagesstream event.🤖 Generated with Claude Code