OpenAiEmbeddingClient
db-ally provides an OpenAIEmbeddingClient
class that can be used to create text embeddings using the OpenAI API.
dbally.embedding_client.OpenAiEmbeddingClient
OpenAiEmbeddingClient(api_key: str, model: str = 'text-embedding-3-small', openai_options: Optional[Dict] = None)
Bases: EmbeddingClient
Client for creating text embeddings using OpenAI API.
Initializes the OpenAiEmbeddingClient.
PARAMETER | DESCRIPTION |
---|---|
api_key |
The OpenAI API key.
TYPE:
|
model |
The model to use for embeddings.
TYPE:
|
openai_options |
Additional options to pass to the OpenAI API.
TYPE:
|
Source code in src/dbally/embedding_client/openai.py
get_embeddings
async
For a given list of strings returns a list of embeddings.
PARAMETER | DESCRIPTION |
---|---|
data |
List of strings to get embeddings for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[List[float]]
|
List of embeddings for the given strings. |