Class ChatSession (1.25.0)

ChatSession(
    model: vertexai.language_models._language_models.ChatModel,
    context: Optional[str] = None,
    examples: Optional[
        List[vertexai.language_models._language_models.InputOutputTextPair]
    ] = None,
    max_output_tokens: int = 128,
    temperature: float = 0.0,
    top_k: int = 40,
    top_p: float = 0.95,
)

ChatSession represents a chat session with a language model.

Within a chat session, the model keeps context and remembers the previous conversation.

Inheritance

builtins.object > ChatSession

Methods

send_message

send_message(
    message: str,
    *,
    max_output_tokens: int = 128,
    temperature: float = 0.0,
    top_k: int = 40,
    top_p: float = 0.95
)

Sends message to the language model and gets a response.