Generates embeddings for the given texts using the configured embedding model.
Available in Embedded and Python SDK. The JS/TS SDK handles embedding generation internally.
get_embeddings(texts: Union[str, List[str]]) -> np.ndarray
Parameters
| Parameter | Type | Description |
|---|
texts | Union[str, List[str]] | Single text string or list of text strings to embed |
Returns
np.ndarray: NumPy array of embeddings
- If single text: 1-D array of shape
(dimension,)
- If list of texts: 2-D array of shape
(num_texts, dimension)
Exceptions
- Throws if no embedding model is available
- Throws if embedding model type is not supported
Example Usage
# Single text embedding
embedding = store.get_embeddings("Hello, world!")
print(f"Embedding shape: {embedding.shape}") # (384,)
# Multiple text embeddings
texts = ["First document", "Second document", "Third document"]
embeddings = store.get_embeddings(texts)
print(f"Embeddings shape: {embeddings.shape}") # (3, 384)
get_embeddings(texts: Union[str, List[str]]) -> np.ndarray
Parameters
| Parameter | Type | Description |
|---|
texts | Union[str, List[str]] | Single text string or list of text strings to embed |
Returns
np.ndarray: NumPy array of embeddings
- If single text: 1-D array of shape
(dimension,)
- If list of texts: 2-D array of shape
(num_texts, dimension)
Delegates to the configured LangChain Embeddings object for embedding generation.Example Usage
embedding = store.get_embeddings("Hello, world!")
print(f"Embedding shape: {embedding.shape}") # (384,)
texts = ["First document", "Second document"]
embeddings = store.get_embeddings(texts)
print(f"Embeddings shape: {embeddings.shape}") # (2, 384)