diff --git a/src/oss/langgraph/agentic-rag.mdx b/src/oss/langgraph/agentic-rag.mdx index 46ea6e1411..89c3531fc5 100644 --- a/src/oss/langgraph/agentic-rag.mdx +++ b/src/oss/langgraph/agentic-rag.mdx @@ -150,15 +150,17 @@ Now that we have our split documents, we can index them into a vector store that ) retriever = vectorstore.as_retriever() ``` -2. Create a retriever tool using LangChain's prebuilt `create_retriever_tool`: +2. Create a retriever tool using the `@tool` decorator: ```python - from langchain_classic.tools.retriever import create_retriever_tool + from langchain.tools import tool - retriever_tool = create_retriever_tool( - retriever, - "retrieve_blog_posts", - "Search and return information about Lilian Weng blog posts.", - ) + @tool + def retrieve_blog_posts(query: str) -> str: + """Search and return information about Lilian Weng blog posts.""" + docs = retriever.invoke(query) + return "\n\n".join([doc.page_content for doc in docs]) + + retriever_tool = retrieve_blog_posts ``` 3. Test the tool: ```python