Embeddings
create_openai_embeddings
async
¶
Create OpenAI embeddings for a list of texts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_
|
str | list[str]
|
The input text or list of texts to embed |
required |
timeout
|
int
|
The maximum time to wait for the request to complete |
60
|
model
|
str
|
The model to use for the embeddings. Defaults to the value
of |
openai_embeddings_model
|
Returns:
Type | Description |
---|---|
Embedding | list[Embedding]
|
The embeddings for the input text or list of texts |
Raises:
Type | Description |
---|---|
TypeError
|
If input_ is not a str or a list of str |
Examples:
Create an embedding for a single text:
from raggy.utilities.embeddings import create_openai_embeddings
embedding = await create_openai_embeddings("Hello, world!")
Create embeddings for a list of texts: