Skip to content

Commit 4de0d6e

Browse files
committed
LangChain: Use general CrateDB usage instructions from cratedb-about
1 parent 42edeb1 commit 4de0d6e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

topic/machine-learning/llm-langchain/agent_with_mcp.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"""
2626
import asyncio
2727

28+
from cratedb_about.instruction import GeneralInstructions
2829
from langchain_mcp_adapters.client import MultiServerMCPClient
2930
from langgraph.prebuilt import create_react_agent
3031

@@ -39,7 +40,11 @@ async def amain():
3940
}
4041
)
4142
tools = await client.get_tools()
42-
agent = create_react_agent("openai:gpt-4.1", tools)
43+
agent = create_react_agent(
44+
model="openai:gpt-4.1",
45+
tools=tools,
46+
prompt=GeneralInstructions().render(),
47+
)
4348

4449
QUERY_STR = "What is the average value for sensor 1?"
4550
response = await agent.ainvoke({"messages": QUERY_STR})

topic/machine-learning/llm-langchain/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
crash
2+
cratedb-about==0.0.6
23
google-cloud-aiplatform<2
34
langchain-cratedb<0.1.2
45
langchain-mcp-adapters<0.2

0 commit comments

Comments
 (0)