Embedding Models

Embedding models transform text into vector representations, enabling semantic search capabilities in OneNode. These vectors capture the meaning and context of text, allowing you to find documents based on semantic similarity rather than exact keyword matches.

When working with Text in OneNode, you can specify which embedding model to use via the emb_model parameter.

Supported Embedding Models

ModelProviderDimensionsDescription
text-embedding-3-smallOpenAI1536Smaller, faster model with excellent performance-to-cost ratio
text-embedding-3-largeOpenAI3072Highest quality model for the most demanding use cases
text-embedding-ada-002OpenAI1536Legacy model with good performance for general use cases

Using Embedding Models in OneNode

To specify an embedding model when working with Text, use the emb_model parameter:

from onenode import Text, Models

{
    "description": Text("This is a sample text that will be embedded.").enable_index(
        emb_model=Models.TextToEmbedding.OpenAI.TEXT_EMBEDDING_3_LARGE
    )
}

In the example above, we're using the TEXT_EMBEDDING_3_LARGE model from OpenAI to embed the text.

Best Practices

  • Use text-embedding-3-small for most general-purpose applications where cost-efficiency is important.
  • Choose text-embedding-3-large for applications requiring the highest quality embeddings, such as complex semantic retrieval tasks.
  • Consider using the same embedding model throughout your application for consistent results.
  • For text fields that don't require semantic search, you can omit the embedding model to save on processing costs.

How can we improve this documentation?

Got question? Email us and we'll get back to you within 24 hours.