fix embeding model for Azure (#1601)

### What problem does this PR solve?

#1599

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu 2024-07-19 09:22:59 +08:00 committed by GitHub
parent fb21efd77d
commit be6d5b76c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -111,11 +111,12 @@ class OpenAIEmbed(Base):
return np.array(res.data[0].embedding), res.usage.total_tokens
class AzureEmbed(Base):
class AzureEmbed(OpenAIEmbed):
def __init__(self, key, model_name, **kwargs):
self.client = AzureOpenAI(api_key=key, azure_endpoint=kwargs["base_url"], api_version="2024-02-01")
self.model_name = model_name
class BaiChuanEmbed(OpenAIEmbed):
def __init__(self, key,
model_name='Baichuan-Text-Embedding',