Generate vector embeddings for text content. Embeddings capture the semantic meaning of text and can be used for similarity search, clustering, and other NLP tasks.
Generate embeddings for text.
Gemini := TsgcHTTP_API_Gemini.Create(nil);
Gemini.GeminiOptions.ApiKey := 'API_KEY';
WriteLn(Gemini._EmbedContent('text-embedding-004', 'Hello world'));
Use the typed response classes for full control over embedding data.
Gemini := TsgcHTTP_API_Gemini.Create(nil);
Gemini.GeminiOptions.ApiKey := 'API_KEY';
oEmbedding := Gemini.EmbedContent('text-embedding-004', 'Hello world');
Try
WriteLn('Dimensions: ' + IntToStr(Length(oEmbedding.Values)));
for i := 0 to Length(oEmbedding.Values) - 1 do
WriteLn(FloatToStr(oEmbedding.Values[i]));
Finally
oEmbedding.Free;
End;