ragflow [问题]:AzureOpenAI加载嵌入模型时出错

brccelvz  于 3个月前  发布在  其他
关注(0)|答案(2)|浏览(43)

Describe your problem

Hi, I already have deployed some models and the ada and larg3 embedding models, however, when entering the API-key and endpoint, I'm receiving an error message that the encoding method was not implemented. As far as I know support was added by issue #1512 .
Upon closer insection I saw in the embedding_model.py that there is no encode method for the azure openai class, or was that added somewhere else?
Here the azure class directly inherits from Base
class AzureEmbed(Base): 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
And here the Base
`class Base(ABC):
def init(self, key, model_name):
pass

def encode(self, texts: list, batch_size=32):
    raise NotImplementedError("Please implement encode method!")

def encode_queries(self, text: str):
    raise NotImplementedError("Please implement encode method!")`
mlmc2os5

mlmc2os51#

在我看来,它似乎来自于错误的基类。可以尝试从 OpenAIEmbed 派生它。不幸的是,我没有一个开发环境来尝试它。

m528fe3b

m528fe3b2#

我可以确认将基类更改为 OpenAIEmbed 是有效的。我可以使用我的 Azure 部署的端点与它们一起使用。另外,请注意端点的名称必须是:

  • azure-text-embedding-3-large
  • azure-gpt-35-turbo

等等,所以 azure- 后面跟着模型类型。

相关问题