@@ -789,8 +789,46 @@ class ModelResponse:
789
789
For OpenAI models, this may include 'logprobs', 'finish_reason', etc.
790
790
"""
791
791
792
- vendor_id : str | None = None
793
- """Vendor ID as specified by the model provider. This can be used to track the specific request to the model."""
792
+ id : str | None = None
793
+ """Unique identifier for the model response, e.g. as returned by the model provider (OpenAI, etc)."""
794
+
795
+ finish_reason : str | None = None
796
+ """The reason the model finished generating this response, e.g. 'stop', 'length', etc."""
797
+
798
+ @property
799
+ def vendor_id (self ) -> str | None :
800
+ """Vendor ID as specified by the model provider. This can be used to track the specific request to the model.
801
+
802
+ This is deprecated, use `id` instead.
803
+ """
804
+ import warnings
805
+ warnings .warn (
806
+ "vendor_id is deprecated, use id instead" ,
807
+ DeprecationWarning ,
808
+ stacklevel = 2
809
+ )
810
+ return self .id
811
+
812
+ @vendor_id .setter
813
+ def vendor_id (self , value : str | None ) -> None :
814
+ """Set the vendor ID.
815
+
816
+ This is deprecated, use `id` instead.
817
+ """
818
+ import warnings
819
+ warnings .warn (
820
+ "vendor_id is deprecated, use id instead" ,
821
+ DeprecationWarning ,
822
+ stacklevel = 2
823
+ )
824
+ self .id = value
825
+
826
+ def __post_init__ (self ) -> None :
827
+ """Ensure vendor_details contains finish_reason for backward compatibility."""
828
+ if self .finish_reason and self .vendor_details is None :
829
+ self .vendor_details = {}
830
+ if self .finish_reason and self .vendor_details is not None :
831
+ self .vendor_details ['finish_reason' ] = self .finish_reason
794
832
795
833
def otel_events (self , settings : InstrumentationSettings ) -> list [Event ]:
796
834
"""Return OpenTelemetry events for the response."""
0 commit comments