Add configs to Embedding docs (#1702)

This commit is contained in:
Dev Khant
2024-08-14 16:10:48 +05:30
committed by GitHub
parent aba5bb052d
commit 10cbee943c
9 changed files with 219 additions and 66 deletions

View File

@@ -1,3 +1,4 @@
import os
from typing import Optional
from openai import AzureOpenAI
@@ -13,7 +14,9 @@ class AzureOpenAIEmbedding(EmbeddingBase):
self.config.model = "text-embedding-3-small"
if self.config.embedding_dims is None:
self.config.embedding_dims = 1536
self.client = AzureOpenAI()
api_key = os.getenv("AZURE_OPENAI_API_KEY") or self.config.api_key
self.client = AzureOpenAI(api_key=api_key)
def embed(self, text):
"""