struct

Gemini::Part

Inherits Struct < Value < Object

A datatype containing media that is part of a multi-part Content message.

Union field data. data can be only one of the following:

  • text: string - Inline text.
  • inlineData: object (Blob) - Inline media bytes.
  • functionCall: object (FunctionCall) - A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration#name with the arguments and their values.
  • functionResponse: object (FunctionResponse) - The result output of a FunctionCall that contains a string representing the FunctionDeclaration#name and a structured JSON object containing any output from the function is used as context to the model.
  • fileData: object (FileData) - URI based data.
  • executableCode: object (ExecutableCode) - Code generated by the model that is meant to be executed.
  • codeExecutionResult: object (CodeExecutionResult) - Result of executing the ExecutableCode.

API Reference

Constructors

new(pull : JSON::PullParser)

Custom JSON deserializable

Source

Instance methods

data
data=(data : Text | FunctionCall | FunctionResponse)
function_call

Same as #function_call? but raise error if nil

Source
function_call?

if #data type is FunctionCall will return value, or nil if not

Source
function_call?

Do not yield if #data is a diferent type

Source
function_response

Same as #function_response? but raise error if nil

Source
function_response?

if #data type is FunctionResponse will return value, or nil if not

Source
function_response?

Do not yield if #data is a diferent type

Source
text

Same as #text? but raise error if nil

Source
text?

if #data type is Text will return value, or nil if not

Source
text?

Do not yield if #data is a diferent type

Source
to_json(json : JSON::Builder)

Custom JSON serializable

Source