class ACP::PromptBuilder

Overview

A small DSL helper for constructing arrays of content blocks in a readable way. Used by Session#prompt(&block).

Defined in:

acp/session.cr

Instance Method Summary

Instance Method Detail

def audio(data : String, mime_type : String = "audio/wav") : self #

Adds an audio content block from base64 data.


[View source]
def audio_data(data : String, mime_type : String = "audio/wav") : self #

Adds an audio content block from base64 data (alias).


[View source]
def build : Array(Protocol::ContentBlock) #

Returns the assembled array of content blocks.


[View source]
def empty? : Bool #

Returns true if no blocks have been added.


[View source]
def file(path : String, mime_type : String | Nil = nil) : self #

Adds a resource link content block from a file path.


[View source]
def image(data : String, mime_type : String = "image/png") : self #

Adds an image content block from base64 data.


[View source]
def image_data(data : String, mime_type : String = "image/png") : self #

Adds an image content block from base64 data (alias).


[View source]
def resource(uri : String, text : String, mime_type : String | Nil = nil) : self #

Adds an embedded resource content block with text content.


[View source]
def resource_link(uri : String, name : String, mime_type : String | Nil = nil) : self #

Adds a resource link content block.


[View source]
def size : Int32 #

Returns the number of blocks added so far.


[View source]
def text(content : String) : self #

Adds a text content block.


[View source]