Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant import create_retrieval_chain on new version of langchain==0.3.0 #26692

Open
5 tasks done
Pochomo opened this issue Sep 20, 2024 · 4 comments
Open
5 tasks done

Cant import create_retrieval_chain on new version of langchain==0.3.0 #26692

Pochomo opened this issue Sep 20, 2024 · 4 comments
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed

Comments

@Pochomo
Copy link

Pochomo commented Sep 20, 2024

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

from app.services.document_loader import PDFLoader
from app.services.vector_store import VectorStore
from langchain_community.chat_models import ChatOpenAI
from langchain.chains import create_retrieval_chain 
from langchain.memory import ConversationBufferMemory
from pydantic import BaseModel
from typing import List

router = APIRouter()

pdf_loader = PDFLoader()
vector_store = VectorStore()

class ChatRequest(BaseModel):
    message: str


@router.post("/upload-pdf")
async def upload_pdf(files: List[UploadFile] = File(...)):



@router.post("/chat")
async def chat(request: ChatRequest):

@router.get("/check-vector-store")
async def check_vector_store(is_law_related: bool = False):

Error Message and Stack Trace (if applicable)

"create_retrieval_chain" is unknown import symbol

Description

I have an error here "from langchain.chains import create_retrieval_chain"
, the contents of the error are as follows ""create_retrieval_chain" is unknown import symbol". my version of langchains are

[langchain 0.3.0
langchain-anthropic 0.2.1
langchain-chroma 0.1.4
langchain-community 0.3.0
langchain-core 0.3.2
langchain-openai 0.2.0
langchain-text-splitters 0.3.0]

can window cause an error?? I really need to fix this, please help.

System Info

python 3.12.6
langchain 0.3.0
langchain-anthropic 0.2.1
langchain-chroma 0.1.4
langchain-community 0.3.0
langchain-core 0.3.2
langchain-openai 0.2.0
langchain-text-splitters 0.3.0

@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label Sep 20, 2024
@Pochomo
Copy link
Author

Pochomo commented Sep 20, 2024

when i used "from langchain.chains import ConversationalRetrievalChain" it was working, but not now lanchain let me change to create_retrieval_chain

@binhnd102
Copy link
Contributor

@Pochomo Could you use this instead?
from langchain.chains.retrieval import create_retrieval_chain

@Pochomo
Copy link
Author

Pochomo commented Sep 22, 2024

@Pochomo Could you use this instead? from langchain.chains.retrieval import create_retrieval_chain

I I solved it using venv thx:)

Copy link

dosubot bot commented Dec 22, 2024

Hi, @Pochomo. I'm Dosu, and I'm helping the LangChain team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You reported an "unknown import symbol" error with create_retrieval_chain in version 0.3.0.
  • The import ConversationalRetrievalChain worked previously but not currently.
  • User binhnd102 suggested a correct import statement, which resolved the issue.
  • You confirmed that using a virtual environment (venv) also helped resolve the issue.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of LangChain. If so, you can keep the discussion open by commenting here.
  • Otherwise, this issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed
Projects
None yet
Development

No branches or pull requests

2 participants