AIDevKit - AI Suite for Unity
API ReferencesDiscordGlitch9
  • Introduction
    • AI Dev Kit 3.7.0
    • Troubleshooting
    • FAQ
    • Update Logs
      • AI Dev Kit v2
      • AI Dev Kit v1
  • Quick Start
    • API Key Setup
      • OpenAI
      • Google Gemini
      • ElevenLabs
      • OpenRouter
    • Adding Models & Voices
      • Quick Add Guide
      • Creating Snippets
    • Self-Hosting with Ollama
  • Editor Tools
    • Editor Chat
    • Asset Generators
    • Asset Managers
      • Prompt History
      • File Manager
      • Chatbot Manager
      • Assistant Manager
  • GEN Tasks
    • Overview
      • Prefixes
      • Sequence
    • Response
    • Image
    • Video
    • SoundFX
    • Speech
    • Transcript
    • Voice Change
    • Audio Isolation
  • Components
    • Chatbot
    • Chatbot (Assistants API)
    • Realtime Assistant
    • Modules
    • Event Receivers
  • Platform API
    • OpenAI
      • 💬Chat completions
      • 🖼️Image operations
      • 🗣️Text to speech
      • 🎙️Speech to text
        • Recording real-time in Unity
      • 💾Files
      • 🔎Embeddings
      • 🛡️Moderations
      • ⚙️Fine-tuning
      • Assistants API
        • How it works
        • Creating custom functions
        • Creating assistants API
    • Google Gemini
      • 📝System instructions
      • 💬Text generation
      • ⚙️Fine-tuning
      • ▶️Fucntion calling
      • 🔎Embeddings
      • 🛡️Safety
      • 💻Code execution
  • Legacy Documents
    • AI Dev Kit 1.0
      • Preperation
      • Scriptable Toolkits
        • Chat Streamer
        • Image Generator
        • Voice Transcriber
        • Voice Generator
      • Editor Tools
      • Troubleshooting (Legacy)
        • ❗Build Error: The name 'UnityMenu' does not exist in the current context
        • ❗The type or namespace name 'AndroidJavaObject' could not be found
        • ❗The type or namaspace name 'Plastic' does not exist
        • ❗Build Error: The name 'Asset Database' does not exist in the current context
        • ❗'ModelData.Create(Provider, string, UnixTime?, string)': not all code paths return a value
      • Code Generators
        • C# Script Generator
        • Unity Component Generator
    • AI Dev Kit 2.0
      • Event Handlers
      • Editor Chat
      • Editor Vision (TTI, ITI)
      • Editor Speech (TTS)
      • Management Tools
        • Prompt History Viewer
        • AI Model Manager
        • TTS Voice Manager
        • OpenAI File Manager
        • OpenAI Assistant Manager
        • ElevenLabs Voice Library
Powered by GitBook
On this page
  • Embeddings Operations Overview:
  • Sample Code for Embeddings Requests:
  1. Platform API
  2. OpenAI

Embeddings

PreviousFilesNextModerations

Last updated 11 months ago

Integrating OpenAI's Embeddings into your Unity project allows you to tap into advanced machine learning capabilities for understanding and processing natural language data. These embeddings transform text into high-dimensional vectors, enabling a wide range of applications like semantic search, text clustering, and more sophisticated natural language understanding tasks.

For a comprehensive understanding of the Embeddings API, including available models, parameter options, and usage scenarios, please refer to the .

Embeddings Operations Overview:

  • Semantic Text Analysis: Convert text into vector space to understand its underlying meaning and context.

  • Text Similarity and Clustering: Compare and cluster text data based on semantic similarity, ideal for organizing large datasets or creating recommendation systems.

Sample Code for Embeddings Requests:

To use embeddings in your project, you'll need to create an EmbeddingRequest and execute it asynchronously. Here's how you can do it:

Semantic Analysis Request:

Generate embeddings for given text to analyze its semantics. You need to specify the text and choose an appropriate model.

var request = new EmbeddingRequest.Builder()
    .SetModel(EmbeddingModel.TextEmbeddingAda002)
    .SetInput("The food was delicious and the waiter...")
    .SetEncodingFormat(EncodingFormat.Float)
    .Build();

var result = await request.ExecuteAsync();

float[] embeddings = result.EmbeddingVector;
from openai import OpenAI
client = OpenAI()

client.embeddings.create(
  model="text-embedding-ada-002",
  input="The food was delicious and the waiter...",
  encoding_format="float"
)

This request will return a high-dimensional vector representation of your text, which you can then use for further analysis or comparison against other vectors.

By integrating Embeddings into your Unity applications, you unlock powerful capabilities for advanced text analysis and interpretation, enhancing the intelligence and interactivity of your projects.

🔎
Embeddings API Reference