韩宇 commited on
Commit
ef69607
·
1 Parent(s): 0ce096d
configs/llms/text_encoder.yml CHANGED
@@ -1,3 +1,4 @@
1
  name: AzureTextEmbeddingV3
2
  endpoint: ${env| custom_openai_endpoint, https://api.openai.com/v1}
3
- api_key: ${env| custom_openai_key, openai_api_key}
 
 
1
  name: AzureTextEmbeddingV3
2
  endpoint: ${env| custom_openai_endpoint, https://api.openai.com/v1}
3
+ api_key: ${env| custom_openai_key, openai_api_key}
4
+ api_version: ${env| custom_openai_api_version, 2024-02-15-preview} # this is mandatory
omagent_core/models/encoders/azure_encoder.py CHANGED
@@ -11,7 +11,8 @@ class AzureTextEmbeddingV3(EncoderBase):
11
  model_id: str = "text-embedding-3-large"
12
  api_key: str
13
  dim: int = 3072
14
-
 
15
  class Config:
16
  """Configuration for this pydantic object."""
17
 
@@ -20,8 +21,8 @@ class AzureTextEmbeddingV3(EncoderBase):
20
 
21
  def __init__(self, /, **data: Any) -> None:
22
  super().__init__(**data)
23
- self.client = AzureOpenAI(base_url=self.endpoint, api_key=self.api_key)
24
- self.aclient = AsyncAzureOpenAI(base_url=self.endpoint, api_key=self.api_key)
25
 
26
  def _infer(self, data: List[str], **kwargs) -> List[List[float]]:
27
  res = self.client.embeddings.create(input=data, model=self.model_id)
 
11
  model_id: str = "text-embedding-3-large"
12
  api_key: str
13
  dim: int = 3072
14
+ api_version: str
15
+
16
  class Config:
17
  """Configuration for this pydantic object."""
18
 
 
21
 
22
  def __init__(self, /, **data: Any) -> None:
23
  super().__init__(**data)
24
+ self.client = AzureOpenAI(base_url=self.endpoint, api_key=self.api_key, api_version=self.api_version)
25
+ self.aclient = AsyncAzureOpenAI(base_url=self.endpoint, api_key=self.api_key, api_version=self.api_version)
26
 
27
  def _infer(self, data: List[str], **kwargs) -> List[List[float]]:
28
  res = self.client.embeddings.create(input=data, model=self.model_id)
webpage_configs/llms/text_encoder.yml CHANGED
@@ -1,3 +1,4 @@
1
  name: AzureTextEmbeddingV3
2
  endpoint: ${env| custom_openai_endpoint, https://api.openai.com/v1}
3
- api_key: ${env| custom_openai_key, openai_api_key}
 
 
1
  name: AzureTextEmbeddingV3
2
  endpoint: ${env| custom_openai_endpoint, https://api.openai.com/v1}
3
+ api_key: ${env| custom_openai_key, openai_api_key}
4
+ api_version: ${env| custom_openai_api_version, 2024-02-15-preview} # this is mandatory