pub enum Content {
Text(TextPart),
Reasoning(ReasoningPart),
File(FilePart),
Source(SourcePart),
ToolCall(ToolCallPart),
ToolResult(ToolResultPart),
}Expand description
Represents a single content element in a language model’s response or message.
Content can take multiple forms depending on what the model generates or what is included in a message. This enum provides a unified interface for handling different types of content including text, files, tool calls, and citations.
§Variants
Text- Plain text content generated by the modelReasoning- Internal reasoning content from specialized reasoning models (e.g., o1)File- Media content including images, audio, video, or other file typesSource- Citation or reference to an external source documentToolCall- A tool/function call invocation from the modelToolResult- The result of executing a tool or function
§Usage
Content elements are typically generated as part of a larger response and should be examined to determine the appropriate handling for each type.
Variants§
Text(TextPart)
Plain text content generated by the model
Reasoning(ReasoningPart)
Internal reasoning content from specialized reasoning models
File(FilePart)
Media content including images, audio, video, or other file types
Source(SourcePart)
Citation or reference to an external source document
ToolCall(ToolCallPart)
A tool or function call invocation from the model
ToolResult(ToolResultPart)
The result of executing a tool or function