Skip to content

Anthropic chat model doesn't return the "finish reason" when in streaming mode #1248

Closed
@ThomasVitale

Description

@ThomasVitale

Bug description
When calling the Anthropic chat model in a blocking way, the final completion comes with an "end_turn" finish reason. The same is not true when using the streaming mode (the finishReason field is null).

Environment
Spring AI 1.0.0-SNAPSHOT

Steps to reproduce
See this auto-tests which demonstrate the difference:

.hasHighCardinalityKeyValue(HighCardinalityKeyNames.RESPONSE_FINISH_REASONS.asString(), finishReasons)

Expected behavior
The same finish reason ("end_turn") is returned both when using the blocking and streaming option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions