축하합니다!

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.png

MongoDB와 LangGraph로 만드는 Text-to-Query 에이전트

메모리

mongosaver.png

thread_checkpoint.png

MongoDB와 LangGraph로 만드는 Text-to-Query 에이전트

다음 단계는?

MongoDB와 LangGraph로 만드는 Text-to-Query 에이전트

축하합니다!

MongoDB와 LangGraph로 만드는 Text-to-Query 에이전트

Preparing Video For Download...