DEV Community

Urvesh
Urvesh

Posted on

Getting an error while importing Langchain Packages

I want to create a RAG model for the question answer purpose. I have written the code but Langchain packages are giving an error. The part of the code which gives the error is as below:

from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.document_loaders import PyPDFLoader
from langchain_community.vectorstores import Chroma
from langchain.chains import RetrievalQA
from langchain.memory import ConversationSummaryMemory
from langchain_openai import OpenAIEmbeddings
from langchain.prompts import PromptTemplate
from langchain.llms import Ollama

The error is as below:
TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'

Please help me solving this error.

Top comments (1)

Collapse
 
mohsin_rashid_13537f11a91 profile image
Mohsin Rashid • Edited

from langchain_openai import OpenAIEmbeddings ---> from langchain_community.embeddings import OpenAIEmbeddings