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.

LLMTraceAPI ¶

LLMTraceAPI()

get_key ¶

get_key() -> str

Get the unique identifier for this trace

get_metadata ¶

get_metadata() -> Dict[str, JSONEncodable]

Get trace metadata

get_name ¶

get_name() -> Optional[str]

Get the name of the trace

log_metadata ¶

log_metadata(metadata: Dict[str, JSONEncodable]) -> None

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

Parameters:

  • metadata_dict –

    Dict in the form of {"metadata_name": value, ...}. Nested metadata is supported.

log_user_feedback ¶

log_user_feedback(score: float) -> None

Log user feedback

Parameters:

  • score (float) –

    The feedback score. Can be either 0, 0.0, 1 or 1.0

Jul. 25, 2024