API Reference
Generation
BaseGeneration
Base class for generation objects, containing common attributes and methods.
Attributes:
The unique identifier of the generation.
The unique identifier of the prompt associated with the generation.
The provider of the generation.
The model used for the generation.
Any error message associated with the generation.
Settings used for the generation.
Variables used in the generation.
Tags associated with the generation.
Metadata associated with the generation.
Tools used in the generation.
The total number of tokens in the generation.
The number of input tokens in the generation.
The number of output tokens in the generation.
Time to first token in the generation.
Token throughput in seconds.
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:
The prompt text for the generation.
The generated completion text.
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:
The list of messages in the chat generation.
The completion message of the chat generation.
The type of generation, which is set to GenerationType.CHAT.
Was this page helpful?