embedContent method
Creates an embedding (list of float values) representing content
.
Sends a "embedContent" API request for the configured model, and waits for the response.
Example:
final promptEmbedding =
(await model.embedContent([Content.text(prompt)])).embedding.values;
Implementation
Future<EmbedContentResponse> embedContent(
Content content, {
TaskType? taskType,
String? title,
int? outputDimensionality,
}) =>
makeRequest(
Task.embedContent,
{
'content': content.toJson(),
if (taskType != null) 'taskType': taskType.toJson(),
if (title != null) 'title': title,
if (outputDimensionality != null)
'outputDimensionality': outputDimensionality,
},
parseEmbedContentResponse);