Skip to main content

BaseGeneration

Base class for generation objects, containing common attributes and methods. Attributes:
Optional[str]
The unique identifier of the generation.
Optional[str]
The unique identifier of the prompt associated with the generation.
Optional[str]
The provider of the generation.
Optional[str]
The model used for the generation.
Optional[str]
Any error message associated with the generation.
Optional[Dict]
Settings used for the generation.
Optional[Dict]
Variables used in the generation.
Optional[List[str]]
Tags associated with the generation.
Optional[Dict]
Metadata associated with the generation.
Optional[List[Dict]]
Tools used in the generation.
Optional[int]
The total number of tokens in the generation.
Optional[int]
The number of input tokens in the generation.
Optional[int]
The number of output tokens in the generation.
Optional[float]
Time to first token in the generation.
Optional[float]
Token throughput in seconds.
Optional[float]
Duration of the generation.
Methods: from_dict(cls, generation_dict: Dict) -> Union[“ChatGeneration”, “CompletionGeneration”]: Creates a generation object from a dictionary. to_dict(self) -> Dict: Converts the generation object to a dictionary.

CompletionGeneration

Represents a completion generation with a prompt and its corresponding completion. Attributes:
Optional[str]
The prompt text for the generation.
Optional[str]
The generated completion text.
GenerationType
The type of generation, which is set to GenerationType.COMPLETION.

ChatGeneration

Represents a chat generation with a list of messages and a message completion. Attributes:
Optional[List[GenerationMessage]]
The list of messages in the chat generation.
Optional[GenerationMessage]
The completion message of the chat generation.
GenerationType
The type of generation, which is set to GenerationType.CHAT.