Firebase.AI.ModelContent

A type describing data in media formats interpretable by anAI model.

Summary

Each generativeAI request or response contains a list ofModelContents, and eachModelContent value may comprise multiple heterogeneousModelContent.Parts.

Constructors and Destructors

ModelContent(paramsPart[] parts)
Creates aModelContent with the givenParts, using the defaultuser role.
ModelContent(IEnumerable<Part > parts)
Creates aModelContent with the givenParts, using the defaultuser role.
ModelContent(string role, paramsPart[] parts)
Creates aModelContent with the given role andParts.
ModelContent(string role, IEnumerable<Part > parts)
Creates aModelContent with the given role andParts.

Properties

Parts
IReadOnlyList<Part >
The data parts comprising thisModelContent value.
Role
string
The role of the entity creating theModelContent.

Public static functions

FileData(string mimeType, System.Uri uri)
Creates a newModelContent with the defaultuser role, and aFileDataPart containing the given mimeType and data.
FunctionResponse(string name, IDictionary< string, object > response, string id)
Creates a newModelContent with the defaultuser role, and aFunctionResponsePart containing the given name and args.
InlineData(string mimeType, byte[] data)
Creates a newModelContent with the defaultuser role, and anInlineDataPart containing the given mimeType and data.
Text(string text)
Creates a newModelContent with the defaultuser role, and aTextPart containing the given text.

Structs

Firebase.AI.ModelContent.CodeExecutionResultPart

A part containing the result of executing code.

Firebase.AI.ModelContent.ExecutableCodePart

A part containing code that was executed by the model.

Firebase.AI.ModelContent.FileDataPart

File data stored in CloudStorage forFirebase, referenced by a URI.

Firebase.AI.ModelContent.FunctionCallPart

A predicted function call returned from the model.

Firebase.AI.ModelContent.FunctionResponsePart

Result output from a function call.

Firebase.AI.ModelContent.InlineDataPart

Data with a specified media type.

Firebase.AI.ModelContent.TextPart

A text part containing a string value.

Interfaces

Firebase.AI.ModelContent.Part

A discrete piece of data in a media format interpretable by anAI model.

Properties

Parts

IReadOnlyList<Part>Firebase::AI::ModelContent::Parts

The data parts comprising thisModelContent value.

Role

stringFirebase::AI::ModelContent::Role

The role of the entity creating theModelContent.

For user-generated client requests, for example, the role isuser.

Public functions

ModelContent

Firebase::AI::ModelContent::ModelContent(paramsPart[]parts)

Creates aModelContent with the givenParts, using the defaultuser role.

ModelContent

Firebase::AI::ModelContent::ModelContent(IEnumerable<Part>parts)

Creates aModelContent with the givenParts, using the defaultuser role.

ModelContent

Firebase::AI::ModelContent::ModelContent(stringrole,paramsPart[]parts)

Creates aModelContent with the given role andParts.

ModelContent

Firebase::AI::ModelContent::ModelContent(stringrole,IEnumerable<Part>parts)

Creates aModelContent with the given role andParts.

Public static functions

FileData

ModelContentFirebase::AI::ModelContent::FileData(stringmimeType,System.Uriuri)

Creates a newModelContent with the defaultuser role, and aFileDataPart containing the given mimeType and data.

FunctionResponse

ModelContentFirebase::AI::ModelContent::FunctionResponse(stringname,IDictionary<string,object>response,stringid)

Creates a newModelContent with the defaultuser role, and aFunctionResponsePart containing the given name and args.

InlineData

ModelContentFirebase::AI::ModelContent::InlineData(stringmimeType,byte[]data)

Creates a newModelContent with the defaultuser role, and anInlineDataPart containing the given mimeType and data.

Text

ModelContentFirebase::AI::ModelContent::Text(stringtext)

Creates a newModelContent with the defaultuser role, and aTextPart containing the given text.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-09-25 UTC.