Skip to content

LLMTraceAPI

The LLMTraceAPI object is returned by the API class and can be used to either update trace metadata or access all the data stored for a given trace.

Note it is not possible to instanciate a LLMTraceAPI object directly.

API.get_name

get_name()

Get the name of the trace.

API.get_key

get_key()

Get the unique identifier for this trace.

API.log_user_feedback

log_user_feedback(score: float)

Log user feedback.

Args:

  • score: float, the feedback score. Can be either 0, 0.0, 1 or 1.0

API.get_metadata

get_metadata() -> Dict[str, JSONEncodable]

Get trace metadata.

API.log_metadata

log_metadata(metadata: Dict[str, JSONEncodable])

Update the metadata field for a trace, can be used to set or update metadata fields.

Args:

  • metadata: dict, the metadata field should be in the form of {"metadata_name": value, ...}. Nested metadata are supported.
Apr. 25, 2024