v2025.6.2
All Bundles

Model

Gemini model interactions

content := Content->New("user")->AddPart(TextPart->New("What number is this image showing?"))
  ->AddPart(BinaryPart->New(FileReader->ReadBinaryFile("thirdteen.png"), "image/png"));
candidates := Model->GenerateContent("models/gemini-1.5-flash", content, EndPoint->GetApiKey());
each(candidate in candidates) {
  candidate->ToString()->PrintLine();
};

Operations

CountTokens

Runs a model's tokenizer on input content and returns the token count

function : CountTokens(model_name:String, content:Content, key:String) ~ Int

Parameters

NameTypeDescription
model_nameStringmodel name
contentContentcontent for the model
keyStringAPI key

CountTokens

Runs a model's tokenizer on input content and returns the token count

function : CountTokens(model_name:String, contents:Vector<Content>, key:String) ~ Int

Parameters

NameTypeDescription
model_nameStringmodel name
contentsVector<Content>list of content for the model
keyStringAPI key

EmbedContent

Generates an embedding from the model given an input Content

function : EmbedContent(content:Content, key:String) ~ Float[]

Parameters

NameTypeDescription
contentContentmodel content=
keyStringAPI key

EmbedContent

Generates an embedding from the model given an input Content

function : EmbedContent(content:Content, title:String, type:Model->TaskType, key:String) ~ Float[]

Parameters

NameTypeDescription
contentContentmodel content=
titleStringtitle for the text. Only applicable when TaskType is RETRIEVAL_DOCUMENT
typeModel->TaskTypetask type for which the embeddings will be used
keyStringAPI key

GenerateContent

Generates a response from the model given an input

function : GenerateContent(model_name:String, content:Content, key:String) ~ Vector<Candidate>

Parameters

NameTypeDescription
model_nameStringmodel name
contentContentcontent for the model
keyStringAPI key

GenerateContent

Generates a response from the model given an input

function : GenerateContent(model_name:String, content:Content, resp_schema:Pair<String,ParameterType>, key:String) ~ Vector<Candidate>

Parameters

NameTypeDescription
model_nameStringmodel name
contentContentcontent for the model
resp_schemaPair<String,ParameterType>response format
keyStringAPI key

GenerateContent

Generates a response from the model given an input

function : GenerateContent(model_name:String, content:Content, funcs:Map<String,Pair<FunctionType,Func2Ref<JsonElement,JsonElement>>>) ~ Vector<Candidate>

Parameters

NameTypeDescription
model_nameStringmodel name
contentContentcontent for the model
funcsMap<String,Pair<FunctionType,Func2Ref<JsonElement,JsonElement>>>map of function callbacks, name must to map to function callback name

GenerateContent

Generates a response from the model given an input

function : GenerateContent(model_name:String, content:Content, funcs:Map<String,Pair<FunctionType,Func2Ref<JsonElement,JsonElement>>>) ~ Vector<Candidate>

Parameters

NameTypeDescription
model_nameStringmodel name
contentContentmodel content
funcsMap<String,Pair<FunctionType,Func2Ref<JsonElement,JsonElement>>>map of function callbacks, name must to map to function callback name

GenerateContent

Generates a response from the model given an input

function : GenerateContent(model_name:String, contents:Vector<Content>, funcs:Map<String,Pair<FunctionType,Func2Ref<JsonElement,JsonElement>>>) ~ Vector<Candidate>

Parameters

NameTypeDescription
model_nameStringmodel name
contentsVector<Content>list of content for the model
funcsMap<String,Pair<FunctionType,Func2Ref<JsonElement,JsonElement>>>map of function callbacks, name must to map to function callback name

Get

Gets a model by name

function : Get(model_name:String, key:String) ~ Model

Parameters

NameTypeDescription
model_nameStringmodel name
keyStringAPI key

Return

TypeDescription
Modelavailable models

GetDescription

Get the model's description

method : public : GetDescription() ~ String

Return

TypeDescription
Stringmodel's description

GetDisplayName

Get the model's display name

method : public : GetDisplayName() ~ String

Return

TypeDescription
Stringmodel's display name

GetGenerationMethods

The model's supported generation methods.

method : public : GetGenerationMethods() ~ Vector<String>

Return

TypeDescription
Vector<String>generation methods

GetInputTokenLimit

Get the model's input token limit

method : public : GetInputTokenLimit() ~ Int

Return

TypeDescription
Intmodel's input token limit

GetName

Get the model's name

method : public : GetName() ~ String

Return

TypeDescription
Stringmodel's name

GetOutputTokenLimit

Maximum number of output tokens available for this model

method : public : GetOutputTokenLimit() ~ Int

Return

TypeDescription
Intmaximum number of output tokens

GetTemperature

Controls the randomness of the output. Values can range over [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied, while a value closer to 0.0 will typically result in less surprising responses from the model.

method : public : GetTemperature() ~ Float

Return

TypeDescription
Floatmodel temperature

GetTopK

Get the top-k sampling of the most probable tokens.

method : public : GetTopK() ~ Int

Return

TypeDescription
Inttop-k sampling

GetTopP

Nucleus sampling considers the smallest set of tokens whose probability sum is at least topP.

method : public : GetTopP() ~ Float

GetVersion

Get the model version

method : public : GetVersion() ~ String

Return

TypeDescription
Stringmodel version

List

Lists available models

function : List(key:String) ~ Vector<Model>

Parameters

NameTypeDescription
keyStringAPI key

Return

TypeDescription
Vector<Model>available models

ToString

String representation of the object

method : public : ToString() ~ String

Return

TypeDescription
Stringstring representation