chat_models library

Contains core abstractions related to chat models.

Classes

AIChatMessage
Type of message that is spoken by the AI.
AIChatMessageToolCall
A tool that the model wants to call.
BaseChatModel<Options extends ChatModelOptions>
Chat models base class. It should take in chat messages and return a chat message.
ChatExample
An example of a conversation between the end-user and the model.
ChatMessage
A message that is part of a chat conversation.
ChatMessageContent
The content of a message.
ChatMessageContentImage
The content of a message that is an image.
ChatMessageContentMultiModal
{@template chat_message_content_multi_modal} The content of a message that is multi-modal. {@endtemplate
ChatMessageContentText
The content of a message that is text.
ChatModelOptions
Generation options to pass into the Chat Model.
ChatResult
Result returned by the Chat Model.
ChatToolChoice
Controls how the model responds to tool calls.
ChatToolChoiceAuto
The model can pick between responding to the end-user or calling a tool.
ChatToolChoiceForced
The model is forced to to call the specified tool.
ChatToolChoiceNone
The model does not call a tool, and responds to the end-user.
ChatToolChoiceRequired
The model must call at least one tool, but doesn’t force a particular tool.
CustomChatMessage
Chat message with custom role.
FakeChatModel
Fake Chat Model for testing. You can pass in a list of responses to return in order when called.
FakeChatModelOptions
Fake Echo Chat Model Options for testing.
FakeEchoChatModel
Fake Chat Model for testing. It just returns the content of the last message of the prompt or streams it char by char.
FakeEchoChatModelOptions
Fake Echo Chat Model Options for testing.
HumanChatMessage
Type of message that is spoken by the human.
SimpleChatModel<Options extends ChatModelOptions>
SimpleChatModel provides a simplified interface for working with chat models, rather than expecting the user to implement the full SimpleChatModel.invoke method.
SystemChatMessage
Type of message that is a system message.
ToolChatMessage
Type of message that is the response of calling a tool.

Enums

ChatMessageContentImageDetail
Specifies the detail level of the image.
ChatMessageRole
Role of a chat message

Extensions

ChatMessagesX on List<ChatMessage>
Extensions on List<ChatMessage>.