Text Embedding
Basic Usage
float[] embedding = await "Hello, world!"
.GENEmbed()
.ExecuteAsync();
Debug.Log($"Embedding dimensions: {embedding.Length}");Configuration
Model Selection
// OpenAI - Small (1536 dimensions, faster)
float[] embedding = await "Search query"
.GENEmbed()
.SetModel(OpenAIModel.TextEmbedding3Small)
.ExecuteAsync();
// OpenAI - Large (3072 dimensions, more accurate)
float[] embedding = await "Search query"
.GENEmbed()
.SetModel(OpenAIModel.TextEmbedding3Large)
.ExecuteAsync();
// Google
float[] embedding = await "Search query"
.GENEmbed()
.SetModel(GoogleModel.TextEmbedding004)
.ExecuteAsync();Unity Integration Examples
Example 1: Document Search Engine
Example 2: FAQ Matcher
Example 3: Content Deduplication
Example 4: Smart Categorization
Provider Support
OpenAI
Google
Similarity Calculation
Cosine Similarity
Euclidean Distance
Best Practices
✅ Good Practices
❌ Bad Practices
Use Cases
Use Case
Description
Performance Tips
Next Steps
Last updated