Skip to main content
Version: 0.3.94

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 support two function calls.

  • embed_query() - Takes a single string as input and transforms it into a vector.
  • embed_documents() - Takes a list of strings and transforms them into a list of vectors.
Text Embeddings Example
from seaplane.integrations.langchain import seaplane_embeddings
from seaplane import task

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

# embed a list of strings
seaplane_embeddings.embed_documents(["embed this string", "also embed this string"])