Update unit1/dummy_agent_library.ipynb
Hello,
This commit corrects a prompt formatting issue in the unit1/dummy_agent_library.ipynb notebook.
The Problem:
The original code that builds the prompt for the second LLM call (after executing the tool) was missing the required "Observation:" prefix before adding the tool's output. This was happening in the cell where the messages history is updated.
This incorrect formatting breaks the Thought -> Action -> Observation cycle that the system prompt explicitly instructs the model to follow. As a result, the model would get confused and generate incorrect or unpredictable responses, such as hallucinating its own Observation: line instead of reasoning on the one provided.
The Solution:
I have updated the code to explicitly add the "Observation:\n" string between the first model output (Thought/Action) and the result of the get_weather() function call.
Before
{"role": "assistant", "content": output.choices[0].message.content + get_weather('London')}
After
{"role": "assistant", "content": output.choices[0].message.content + "Observation:\n" + get_weather('London')}
This change ensures that the prompt sent back to the model strictly adheres to the ReAct-style format. It makes the agent's behavior more reliable and leads to the correct final answer.
This also aligns the notebook's code with the concepts explained on the course webpage, resolving a key inconsistency.
Thank you!