trulens.providers.google.endpoint¶
trulens.providers.google.endpoint
¶
Classes¶
GoogleCallback
¶
Bases: EndpointCallback
Attributes¶
endpoint
class-attribute
instance-attribute
¶
The endpoint owning this callback.
cost
class-attribute
instance-attribute
¶
Costs tracked by this callback.
Functions¶
handle_generation
¶
handle_generation(response: Any)
Get the usage information from GoogleGenAI LLM function response's usage_metadata field.
__repr__
¶
__repr__() -> str
Safe repr that handles circular references.
Pydantic's default __repr__ does not guard against
circular references among model instances, which leads to
RecursionError (see GitHub issue #1862). This override
uses the same formatted_objects context-variable that
__rich_repr__ uses so that already-visited objects are
replaced with a short placeholder instead of recursing
infinitely.
handle_generation_chunk
¶
handle_generation_chunk(response: Any) -> None
Called after receiving a chunk from a completion request.