恭喜您!

使用 MongoDB 和 LangGraph 的 Text-to-Query 代理

Apoorva Joshi

Senior AI/ML Developer Advocate, MongoDB

成品!

agentic10.jpg

使用 MongoDB 和 LangGraph 的 Text-to-Query 代理

代理的工具箱

from langchain_mongodb.agent_toolkit.toolkit import MongoDBDatabaseToolkit

# Initialize the MongoDB database toolkit
toolkit = MongoDBDatabaseToolkit(db=db, llm=llm)

# Extract the tools from the toolkit
tools = toolkit.get_tools()
使用 MongoDB 和 LangGraph 的 Text-to-Query 代理

提示工程

from langchain_mongodb.agent_toolkit import MONGODB_AGENT_SYSTEM_PROMPT

# Create a templated prompt for the LLM
prompt = ChatPromptTemplate.from_messages(
    [
        ("system", MONGODB_AGENT_SYSTEM_PROMPT),
        ("system", "Do not re-run tools unless absolutely necessary. If you are not
                    able to get enough information using the tools, reply with
                    I DON'T KNOW. You have access to the following tools: {tool_names}."),
        MessagesPlaceholder(variable_name="messages"),
    ]
)
使用 MongoDB 和 LangGraph 的 Text-to-Query 代理

代理编排

LangGraph 徽标

使用 MongoDB 和 LangGraph 的 Text-to-Query 代理

记忆

MongoDB 存储适配器图标

线程检查点示意图

使用 MongoDB 和 LangGraph 的 Text-to-Query 代理

下一步?

 

更多关于 MongoDB 和文本到查询代理

更多关于 LangChain 和 LangGraph

使用 MongoDB 和 LangGraph 的 Text-to-Query 代理

恭喜您!

使用 MongoDB 和 LangGraph 的 Text-to-Query 代理

Preparing Video For Download...