linjungz / chat-with-your-doc

Chat with your docs in PDF/PPTX/DOCX format, using LangChain and GPT4/ChatGPT from both Azure OpenAI Service and OpenAI
140 stars 48 forks source link

当升级langchain==0.0.292时,会报错openai.error.InvalidRequestError: Resource not found #30

Open SawanoHao opened 1 year ago

SawanoHao commented 1 year ago

报错位置chatbot的get answer函数: result = self.chatchain({ "question": query, "chat_history": chat_history_for_chain }, return_only_outputs=True)

SawanoHao commented 1 year ago

已解决,升级langchain后需要声明Embedding里关于azure的资源,否则,找的是openai的Embedding,会报错

    self.embeddings = OpenAIEmbeddings(
        deployment="text-en-ada-002",
        model="text-embedding-ada-002",
        openai_api_base="https://xxx.openai.azure.com/",
        openai_api_type="azure",
        chunk_size=1
    )