mirror of
https://github.com/tiennm99/litellm.git
synced 2026-06-18 07:33:58 +00:00
d501c33a9d
When a provider's finish_reason is mapped to a different OpenAI-compatible value (e.g. "MALFORMED_FUNCTION_CALL" → "stop"), the original value is now preserved in choices[].provider_specific_fields["native_finish_reason"]. This allows agent loops to distinguish between different stop conditions without breaking the unified OpenAI-compatible finish_reason mapping. Also returns a defensive copy from get_finish_reason_mapping() to prevent accidental mutation of the global _FINISH_REASON_MAP.