Checked other resources
Example Code
def create_gemini_react_agent(system_prompt):
llm = init_llm()
system_prompt = system_prompt
agent = create_react_agent(
llm.bind_tools(tools),
tools=tools,
prompt=system_prompt,
checkpointer=checkpointer
)
def generate_answer_with_gemini(system_prompt, query: str, thread_id: str = "default") -> str:
if not query or len(query.strip()) == 0:
return "Please provide a valid question or request."
agent = create_gemini_react_agent(system_prompt)
config = {"configurable": {"thread_id": thread_id}}
try:
response = agent.invoke(
{"messages": [{"role": "user", "content": query}]},
config
)
print(response)
last_assistant_message = None
for msg in reversed(response["messages"]):
if hasattr(msg, "role") and msg.role == "assistant":
last_assistant_message = msg.content
break
if last_assistant_message:
return last_assistant_message
else:
return "No assistant response found in the reply."
except Exception as e:
return f"Error generating response: {str(e)}"
Error Message and Stack Trace (if applicable)
TypeError Traceback (most recent call last)
Cell In[111], line 1
----> 1 run_gemini_ner_rag_demo(system_prompt)
Cell In[102], line 10
7 break
9 print(f"Query: {query}\n")
---> 10 answer = generate_answer_with_gemini(system_prompt, query, thread_id)
11 print(f"Answer: {answer}\n")
Cell In[110], line 5
2 if not query or len(query.strip()) == 0:
3 return "Please provide a valid question or request."
----> 5 agent = create_gemini_react_agent(system_prompt)
6 config = {"configurable": {"thread_id": thread_id}}
7 try:
8
Cell In[109], line 4
2 llm = init_llm()
3 system_prompt = system_prompt
----> 4 agent = create_react_agent(
5 llm.bind_tools(tools),
6 tools=tools,
7 prompt=system_prompt,
8 checkpointer=checkpointer
9 )
11 return agent
File .... Lib\site-packages\langgraph_api\deprecation.py:80, in deprecated_parameter..decorator..wrapper(*args, **kwargs)
72 if arg_name in kwargs:
73 warnings.warn(
74 f"Parameter '{arg_name}' in function '{func.name}' is "
75 f"deprecated as of version {since} and will be removed in version {removal}. "
(...)
78 stacklevel=2,
79 )
---> 80 return func(*args, **kwargs)
TypeError: create_react_agent() got an unexpected keyword argument 'prompt'
Description
I do not understand with this error since i use the tutorial from Langchain and Langgraph. The prompt can't be passed to parameter prompt but it can be passed to parameter state_modifier which is based on my exploration that parameter had already depreciated
System Info
System Information
OS: Windows
OS Version: 10.0.26100
Python Version: 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]
Package Information
langchain_core: 0.3.59
langchain: 0.3.25
langchain_community: 0.3.3
langsmith: 0.1.135
langchain_experimental: 0.3.2
langchain_google_genai: 2.0.11
langchain_groq: 0.2.0
langchain_mongodb: 0.1.7
langchain_ollama: 0.2.0
langchain_openai: 0.2.3
langchain_postgres: 0.0.12
langchain_qdrant: 0.2.0
langchain_text_splitters: 0.3.8
langgraph_sdk: 0.1.69
Optional packages not installed
langserve
Other Dependencies
aiohttp: 3.9.5
async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.
dataclasses-json: 0.6.7
fastembed: Installed. No version info available.
filetype: 1.2.0
google-ai-generativelanguage: 0.6.16
groq: 0.11.0
httpx: 0.28.1
jsonpatch<2.0,>=1.33: Installed. No version info available.
langchain-anthropic;: Installed. No version info available.
langchain-aws;: Installed. No version info available.
langchain-azure-ai;: Installed. No version info available.
langchain-cohere;: Installed. No version info available.
langchain-community;: Installed. No version info available.
langchain-core<1.0.0,>=0.3.51: Installed. No version info available.
langchain-core<1.0.0,>=0.3.58: Installed. No version info available.
langchain-deepseek;: Installed. No version info available.
langchain-fireworks;: Installed. No version info available.
langchain-google-genai;: Installed. No version info available.
langchain-google-vertexai;: Installed. No version info available.
langchain-groq;: Installed. No version info available.
langchain-huggingface;: Installed. No version info available.
langchain-mistralai;: Installed. No version info available.
langchain-ollama;: Installed. No version info available.
langchain-openai;: Installed. No version info available.
langchain-perplexity;: Installed. No version info available.
langchain-text-splitters<1.0.0,>=0.3.8: Installed. No version info available.
langchain-together;: Installed. No version info available.
langchain-xai;: Installed. No version info available.
langsmith<0.4,>=0.1.125: Installed. No version info available.
langsmith<0.4,>=0.1.17: Installed. No version info available.
numpy: 1.26.4
ollama: 0.3.3
openai: 1.55.3
orjson: 3.10.3
packaging<25,>=23.2: Installed. No version info available.
pgvector: 0.2.5
psycopg: 3.2.4
psycopg-pool: 3.2.4
pydantic: 2.11.4
pydantic-settings: 2.5.2
pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
pydantic<3.0.0,>=2.7.4: Installed. No version info available.
pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
pymongo: 4.8.0
PyYAML: 6.0.2
PyYAML>=5.3: Installed. No version info available.
qdrant-client: 1.12.1
requests: 2.32.3
requests-toolbelt: 1.0.0
requests<3,>=2: Installed. No version info available.
sqlalchemy: 2.0.31
SQLAlchemy: 2.0.31
SQLAlchemy<3,>=1.4: Installed. No version info available.
tenacity: 8.4.2
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tiktoken: 0.7.0
typing-extensions>=4.7: Installed. No version info available.
Checked other resources
Example Code
def create_gemini_react_agent(system_prompt):
llm = init_llm()
system_prompt = system_prompt
agent = create_react_agent(
llm.bind_tools(tools),
tools=tools,
prompt=system_prompt,
checkpointer=checkpointer
)
def generate_answer_with_gemini(system_prompt, query: str, thread_id: str = "default") -> str:
if not query or len(query.strip()) == 0:
return "Please provide a valid question or request."
Error Message and Stack Trace (if applicable)
TypeError Traceback (most recent call last)
Cell In[111], line 1
----> 1 run_gemini_ner_rag_demo(system_prompt)
Cell In[102], line 10
7 break
9 print(f"Query: {query}\n")
---> 10 answer = generate_answer_with_gemini(system_prompt, query, thread_id)
11 print(f"Answer: {answer}\n")
Cell In[110], line 5
2 if not query or len(query.strip()) == 0:
3 return "Please provide a valid question or request."
----> 5 agent = create_gemini_react_agent(system_prompt)
6 config = {"configurable": {"thread_id": thread_id}}
7 try:
8
Cell In[109], line 4
2 llm = init_llm()
3 system_prompt = system_prompt
----> 4 agent = create_react_agent(
5 llm.bind_tools(tools),
6 tools=tools,
7 prompt=system_prompt,
8 checkpointer=checkpointer
9 )
11 return agent
File .... Lib\site-packages\langgraph_api\deprecation.py:80, in deprecated_parameter..decorator..wrapper(*args, **kwargs)
72 if arg_name in kwargs:
73 warnings.warn(
74 f"Parameter '{arg_name}' in function '{func.name}' is "
75 f"deprecated as of version {since} and will be removed in version {removal}. "
(...)
78 stacklevel=2,
79 )
---> 80 return func(*args, **kwargs)
TypeError: create_react_agent() got an unexpected keyword argument 'prompt'
Description
I do not understand with this error since i use the tutorial from Langchain and Langgraph. The prompt can't be passed to parameter prompt but it can be passed to parameter state_modifier which is based on my exploration that parameter had already depreciated
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies