emecii opened a new issue, #1106:
URL: https://github.com/apache/flink-agents/issues/1106

   ### Motivation
   
   Follow-up to #936 and merged #1040. The shared response path now checks 
`finish_reason`, but Anthropic still has the capture TODO identified in #936; 
Watsonx parses a reason without preserving it in message metadata. Those 
providers therefore do not consistently participate in the shared handling.
   
   #1040 explicitly checks the common path before text, structured output, or 
tool dispatch, and its approval acknowledges that design. This proposal follows 
that accepted behavior rather than moving the gate.
   
   ### Proposed scope
   
   Capture `finish_reason` in the Java and Python Anthropic and Watsonx 
connection responses, preserving content and the existing provider-specific 
content blocks.
   
   For Anthropic, propose `max_tokens` → `length`, `end_turn`/`stop_sequence` → 
`stop`, and `tool_use` → `tool_calls`. Preserve unrecognized reasons, including 
`model_context_window_exceeded` and `refusal`, verbatim for now. Mapping 
context exhaustion to `length` would currently tell users to increase output 
tokens, which may be the wrong remedy; treating a refusal as `content_filter` 
would add a new rejection decision.
   
   For Watsonx, retain its reported reason verbatim. Missing reasons should not 
add a metadata key. Keep finish-reason metadata out of outbound provider 
requests, while preserving Anthropic content-block round trips.
   
   ### Validation and scope decision
   
   Use SDK response fixtures and Java/Python tests for capture with and without 
usage, missing and unknown reasons, outbound serialization, and the existing 
shared rejection/error-strategy path. No live-provider performance or 
model-quality claims are proposed.
   
   Does this mapping and scope have committer support? In particular, should 
the two Anthropic reasons above remain native until shared diagnostics and 
rejection semantics are decided? A local implementation prototype exists, but 
no PR is being represented as approved by this issue.
   
   Prepared with OpenAI Codex assistance.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to