Skip to main content

Functions

FUNC as_chat_history

as_chat_history(ctx: Context) -> list[Message]
Returns a list of Messages corresponding to a Context.

Classes

CLASS Message

A single Message in a Chat history. TODO: we may want to deprecate this Component entirely. The fact that some Component gets rendered as a chat message is Formatter miscellania.
Methods:

FUNC images

images(self) -> None | list[str]
Returns the images associated with this message as list of base 64 strings.

FUNC parts

parts(self) -> list[Component | CBlock]
Returns all of the constituent parts of an Instruction.

FUNC format_for_llm

format_for_llm(self) -> TemplateRepresentation
Formats the content for a Language Model. Returns:
  • The formatted output suitable for language models.

CLASS ToolMessage

Adds the name field for function name.
Methods:

FUNC format_for_llm

format_for_llm(self) -> TemplateRepresentation
The same representation as Message with a name field added to args.