Skip to main content
Version: 0.4.0

Text Embeddings

Text embeddings are a way to represent text as a vector. This enables you to use strings of text in a more quantitative way. For example, with text embeddings, we can calculate the cosine similarity of two strings, use advanced similarity searches powered by vector stores and much more.

Seaplane has built-in support for text embeddings in tasks. To use them import the seaplane_embeddings from seaplane.integrations.langchain

Seaplane embeddings supports embedding a single string or a list of strings through, embed_query() and embed_documents() respectively.

The Seaplane embeddings are based on the instructor-xl model with a dimension of 768.

Embed Query

The embed_query() function embeds a single input string into a vector.

Input Variable:

  • Input query - type:string
Query Embeddings Example
from seaplane.integrations.langchain import seaplane_embeddings
from seaplane import task

@task(type='compute', id='my-embedding-task')
def my_embedding_task(context):
# embed a single string
seaplane_embeddings.embed_query("Embed this string")

Embed Documents

The embed_documents() function embeds a list of strings into vectors.

Input Variables:

  • Input query - type:list with elements of type:string
Query Embeddings Example
from seaplane.integrations.langchain import seaplane_embeddings
from seaplane import task

@task(type='compute', id='my-embedding-task')
def my_embedding_task(context):
# embed a single string
seaplane_embeddings.embed_documents(["Embed this string", "Also embed this string"])