Closed babelpainterwell closed 2 months ago
Hi @babelpainterwell - thanks for raising this issue. Do you have a code snippet of what your actual graph looks like? Hard to give specific advice without it.
It seems from what you've shared that you're trying to instruct the LLM to never generate a response using the system message. Depending on the model, it's sometimes quite hard to get them actually to not respond (i.e., immediately generate a stop token) - it's sometimes easier to have them generate a canned "end" phrase before it like "NO RESPONSE" or something, though even that is imperfect.
IIRC, this is more of a prompt engineering / machine learning problem that you're running into rather than an issue with the actual LangGraph framework. With these problems, I typically recommend writing tests and then modifying the prompt to pass these tests (i.e., eval-driven development). LangSmith is one such tool that makes this quite convenient.
Gonna move this to discussions since at first glance it appears there isn't an actual bug with LangGraph associated with this ticket. Open to being convinced otherwise (can re-open if so)
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
****% python tutorial.py Please provide your student ID so I can assist you in calculating the total number of students in your class.
StateSnapshot(values={'messages': [SystemMessage(content="Don't say antyhing.", id='ffc8061c-796f-430e-9d7f-9c82852e4a12'), HumanMessage(content='The total number of students in my class is to use my student id and plus 10. So how many students are there in my class? ', id='a1e0d963-eda8-46f4-b3c3-3ae26780c08b'), AIMessage(content='Please provide your student ID so I can assist you in calculating the total number of students in your class.', response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 150, 'total_tokens': 172}, 'model_name': 'gpt-4o', 'system_fingerprint': 'fp_319be4768e', 'finish_reason': 'stop', 'logprobs': None}, id='run-f5cdb365-3cc9-4025-80f0-0d80fd2d6d34-0', usage_metadata={'input_tokens': 150, 'output_tokens': 22, 'total_tokens': 172})], 'query_human': False}, next=(), config={'configurable': {'thread_id': '1', 'thread_ts': '1ef26ada-893a-6892-8001-0bd642095671'}}, metadata={'source': 'loop', 'step': 1, 'writes': {'llm': {'messages': [AIMessage(content='Please provide your student ID so I can assist you in calculating the total number of students in your class.', response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 150, 'total_tokens': 172}, 'model_name': 'gpt-4o', 'system_fingerprint': 'fp_319be4768e', 'finish_reason': 'stop', 'logprobs': None}, id='run-f5cdb365-3cc9-4025-80f0-0d80fd2d6d34-0', usage_metadata={'input_tokens': 150, 'output_tokens': 22, 'total_tokens': 172})], 'query_human': False}}}, created_at='2024-06-09T22:14:37.122152+00:00', parent_config={'configurable': {'thread_id': '1', 'thread_ts': '1ef26ada-80c4-6d52-8000-dd00aa835319'}})
Description
System Info
System Information
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found: