class Turquoise::Eloquent

Defined in:

turquoise/eloquent.cr
turquoise/eloquent/extra.cr
turquoise/eloquent/messages.cr

Constant Summary

MAX_MESSAGES = 10
MODEL_CONFIG = {model_name: ENV["ELOQUENT_MODEL"], generation_config: Gemini::GenerationConfig.new(max_output_tokens: 128), safety_settings: [Gemini::SafetySetting.new(:HarmCategorySexuallyExplicit, :BlockNone), Gemini::SafetySetting.new(:HarmCategoryHateSpeech, :BlockNone), Gemini::SafetySetting.new(:HarmCategoryHarassment, :BlockNone), Gemini::SafetySetting.new(:HarmCategoryDangerousContent, :BlockNone), Gemini::SafetySetting.new(:HarmCategoryCivicIntegrity, :BlockNone)], tools: [Gemini::Tool.new([Gemini::FunctionDeclaration.new("send_selfie_image", description: "Send a selfie. Call this when you need to send a photo of yourself."), Gemini::FunctionDeclaration.new("send_custom_image", description: "Send an image using AI. Call this when you need to create a custom image, for example when they ask for 'Create an image of a dog'.", parameters: Gemini::Schema.new(type: :object, properties: {"prompt" => Gemini::Schema.new(type: :string, description: "Description of the image you want to generate. Translated to English."), "num_steps" => Gemini::Schema.new(type: :integer, description: "Image quality from 1 to 8. 1 is low quality, 8 is high, default is 4.")}, required: ["prompt"]))])]}

Constructors

Instance Method Summary

Constructor Detail

def self.new(chat_id) #

[View source]

Instance Method Detail

def chat : Models::Chat #

[View source]
def function_calling_handler(response : Pointer(Gemini::GenerateContentResponse)) #

[View source]
def generate(text : String) : String #

[View source]
def media : Array(Tourmaline::InputMediaPhoto) #

Send media using telegram API


[View source]
def media_captions? : Bool #

Check if #media has captions


[View source]
def messages : Messages #

[View source]
def random_selfie : String #

[View source]
def send_custom_image(func_call : Gemini::FunctionCall) : Gemini::Part #

[View source]
def send_selfie_image(func_call : Gemini::FunctionCall) : Gemini::Part #

[View source]
def system_role #

TODO internationalization


[View source]