Describe the feature you want to add
Add an optional finish_reason field to the Response class to indicate why an LLM stopped generating a response. The field should support both predefined finish reasons (e.g., stop, length, tool_calls) and custom provider-specific values. It should be fully supported by constructors, serialization (to_dict(), to_json()), deserialization (from_json()), equality checks, and public accessors.
Describe your proposed solution
Introduce an optional finish_reason attribute that accepts either a FinishReason enum or a string. Internally, always store the value as a string to simplify serialization and ensure compatibility with existing and future LLM providers. When an enum is provided, store its corresponding string value. This implementation should be fully backward-compatible, allowing existing code and response objects to continue working without modification.
Describe alternatives you've considered, if relevant
No response
Additional context
No response
Describe the feature you want to add
Add an optional
finish_reasonfield to theResponseclass to indicate why an LLM stopped generating a response. The field should support both predefined finish reasons (e.g.,stop,length,tool_calls) and custom provider-specific values. It should be fully supported by constructors, serialization (to_dict(),to_json()), deserialization (from_json()), equality checks, and public accessors.Describe your proposed solution
Introduce an optional
finish_reasonattribute that accepts either aFinishReasonenum or a string. Internally, always store the value as a string to simplify serialization and ensure compatibility with existing and future LLM providers. When an enum is provided, store its corresponding string value. This implementation should be fully backward-compatible, allowing existing code and response objects to continue working without modification.Describe alternatives you've considered, if relevant
No response
Additional context
No response