pub enum GenerateContent {
Text {
text: String,
provider_metadata: Option<ProviderMetadata>,
},
ToolCall {
tool_call_id: String,
tool_name: String,
input: String,
provider_executed: Option<bool>,
dynamic: Option<bool>,
thought_signature: Option<String>,
provider_metadata: Option<ProviderMetadata>,
},
Source {
id: String,
source_type: String,
url: Option<String>,
title: Option<String>,
provider_metadata: Option<ProviderMetadata>,
},
Reasoning {
text: String,
provider_metadata: Option<ProviderMetadata>,
},
File {
data: FileData,
media_type: String,
provider_metadata: Option<ProviderMetadata>,
},
ToolResult {
tool_call_id: String,
tool_name: String,
result: Value,
is_error: Option<bool>,
preliminary: Option<bool>,
dynamic: Option<bool>,
provider_metadata: Option<ProviderMetadata>,
},
}Expand description
A content item in the generation result.
Variants§
Text
Generated text.
ToolCall
A tool call requested by the model.
Fields
input: StringThe model’s raw argument text, exactly as the provider delivered
it (possibly malformed). Providers never parse it — generate_text
owns parsing, schema validation, and repair.
Always serializes as a JSON string. Deserializes a JSON string
(the current wire shape) unchanged, and also re-serializes the
pre-refactor shape — an already-parsed JSON value — to its compact
JSON text, so a GenerateResult persisted before this field
became a String keeps loading. See docs/api/gaps.md §9.
provider_executed: Option<bool>Whether the tool call will be executed by the provider. If false/unset, the tool call is executed by the client.
thought_signature: Option<String>Provider-assigned thought signature (e.g. Google Gemini
thoughtSignature). Must be echoed back verbatim on the follow-up
turn when the tool result is sent.
provider_metadata: Option<ProviderMetadata>Additional provider-specific metadata for the tool call.
Source
A source / citation (e.g. URL citation from search-preview models).
Fields
provider_metadata: Option<ProviderMetadata>Reasoning
A reasoning / thinking segment produced by the model.
Mirrors the Vercel AI SDK reasoning content type. provider_metadata
carries provider-specific data such as the Anthropic thinking-block
signature (providerMetadata.anthropic.signature).
File
A file generated by the model (e.g. an image or document).
Mirrors the Vercel AI SDK file content type. data is a tagged union
covering base64 data, URL, or provider reference.
ToolResult
A tool result from a provider-executed tool (e.g. xAI file_search,
web_search). Emitted alongside the preceding ToolCall when the
provider executes the tool server-side.
Fields
provider_metadata: Option<ProviderMetadata>Additional provider-specific metadata for the tool result.
Trait Implementations§
Source§impl Clone for GenerateContent
impl Clone for GenerateContent
Source§impl Debug for GenerateContent
impl Debug for GenerateContent
Source§impl<'de> Deserialize<'de> for GenerateContent
impl<'de> Deserialize<'de> for GenerateContent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for GenerateContent
impl PartialEq for GenerateContent
Source§impl Serialize for GenerateContent
impl Serialize for GenerateContent
impl StructuralPartialEq for GenerateContent
Source§impl TS for GenerateContent
impl TS for GenerateContent
Source§type WithoutGenerics = GenerateContent
type WithoutGenerics = GenerateContent
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that
EXPORT_TO must be None. Read moreSource§type OptionInnerType = GenerateContent
type OptionInnerType = GenerateContent
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
Source§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export. Read more