Replies: 1 comment 2 replies
-
Hello @jonarser! I'm here to help you with any bugs, questions, or contributions you may have while we wait for a human maintainer. To resolve the issue of the LangChain agent not recognizing and using the
Here is an updated version of your code with these considerations: from langchain_community.chat_models import ChatLlamaCpp
from langgraph.prebuilt import create_react_agent
from langchain_core.tools import tool
from langgraph.checkpoint.sqlite import SqliteSaver
llm = ChatLlamaCpp(model_path='...')
memory = SqliteSaver.from_conn_string(":memory:")
prompt = 'I need oceanic specialist'
@tool
def create_new_specialist(text):
'''Describe some specialist who you want.'''
# some code
print('working')
return 'Specialist was created successfully'
tools = [create_new_specialist]
def create_conversation(prompt):
conversation1 = create_react_agent(llm, tools, messages_modifier=prompt, checkpointer=memory)
return conversation1
conversation1 = create_conversation(prompt)
answer = conversation1.invoke({"messages": [("user", "Hello, create some specialist from prompt.")]}, config={'configurable':{'thread_id':1}})["messages"][-1].content
print(answer) Additional Considerations:
Known Issues with
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I use mistral-7b-instruct-v0.2.Q2_K.
Specialist isn't created and I receive answer from conversation1: Hello, I'm an assistant designed to help answer questions and provide assistance. The instrument you mention, "create_new_specialist," is not recognized in this context. If you meant something else or if you have a specific question, please let me know and I will do my best to help. Some times an agent asks for some more context, but I wrote very understandable context. When I asked the model "what tools you can access", the model answered "I dont have access to tools'.
I also realized that the prompt agent does not see it either when I wrote the agent's name in prompt, and then asked.
System Info
OS Windows 11
Python 3.12.4
langchain_core 0.2.13
langchain 0.2.7
langchain_community 0.2.7
langsmith 0.1.85
langchain_text_splitters 0.2.2
langgraph 0.1.7
Beta Was this translation helpful? Give feedback.
All reactions