struct Gemini::Content

Overview

The base structured datatype containing multi-part content of a message.

API Reference

Included Modules

Defined in:

gemini/types.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

def self.new(parts : Array(Part), role : Gemini::Content::Role | Nil = nil) #

Create using existing parts or new empty array


def self.new(*parts : Part, role : Gemini::Content::Role | Nil = nil) #

Create content with one or more Part


def self.new(*data, role : Gemini::Content::Role | Nil = nil) #

Create content with one or more data of Part


Instance Method Detail

def after_initialize #

Remove empty texts Part from JSON to fix: "Unable to submit request because it has an empty text parameter."


def parts : Array(Part) #

Ordered Parts that constitute a single message. Parts may have different MIME types.


def parts=(parts : Array(Part)) #

Ordered Parts that constitute a single message. Parts may have different MIME types.


def role : Role | Nil #

The producer of the content. (Optional)


def role=(role : Role | Nil) #

The producer of the content. (Optional)