aws-samples / amazon-bedrock-workshop

This is a workshop designed for Amazon Bedrock a foundational model service.
https://catalog.us-east-1.prod.workshops.aws/workshops/a4bdb007-5600-4368-81c5-ff5b4154f518/en-US/20-intro
MIT No Attribution
1.27k stars 545 forks source link

Amazon Bedrock Workshop - [Bug] - in 01_tools_agents.ipynb #252

Closed codekiln closed 2 months ago

codekiln commented 2 months ago

Describe the bug In running 06_OpenSource_examples/05_OpenSource_agents/01_tools_agents.ipynb, I get JSONDecodeError: Expecting value: line 1 column 1 (char 0) in the cell after ### Tooling and Agents. None of the prior cells error.

To Reproduce

  1. Check out commit 9adce91).
  2. Complete all the steps necessary to execute every cell above ### Tooling and Agents in 06_OpenSource_examples/05_OpenSource_agents/01_tools_agents.ipynb
  3. Execute the cell below that line.

Expected behavior No JSONDecodeError

Actual Behavior

Output

The prompt:template:used:was ---- >

input_variables=['agent_scratchpad', 'input']
messages=[SystemMessagePromptTemplate(prompt=PromptTemplate(input_variables=[], template='Respond to
the human as helpfully and accurately as possible. You have access to the following
tools:\n\nget_lat_long: get_lat_long(place: str) -> dict - Returns the latitude and longitude for a
given place name as a dict object of python., args: {{\'place\': {{\'title\': \'Place\', \'type\':
\'string\'}}}}\nget_weather: get_weather(latitude: str, longitude: str) -> dict - Returns weather
data for a given latitude and longitude., args: {{\'latitude\': {{\'title\': \'Latitude\', \'type\':
\'string\'}}, \'longitude\': {{\'title\': \'Longitude\', \'type\': \'string\'}}}}\nCalculator:
Useful for when you need to answer questions about math., args: {{\'tool_input\': {{\'type\':
\'string\'}}}}\n\nUse a json blob to specify a tool by providing an action key (tool name) and an
action_input key (tool input).\n\nValid "action" values: "Final Answer" or get_lat_long,
get_weather, Calculator\n\nProvide only ONE action per $JSON_BLOB, as shown:\n\n```\n{{\n  "action":
$TOOL_NAME,\n  "action_input": $INPUT\n}}\n```\n\nFollow this format:\n\nQuestion: input question to
answer\nThought: consider previous and subsequent steps\nAction:\n```\n$JSON_BLOB\n```\nObservation:
action result\n... (repeat Thought/Action/Observation N times)\nThought: I know what to
respond\nAction:\n```\n{{\n  "action": "Final Answer",\n  "action_input": "Final response to
human"\n}}\n```\n\nBegin! Reminder to ALWAYS respond with a valid json blob of a single action. Use
tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then
Observation:.\nThought:')),
HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['agent_scratchpad', 'input'],
template='{input}\n\n{agent_scratchpad}'))]

> Entering new AgentExecutor chain...
Action:
\`\`\`json
{
  "action": "get_lat_long",
  "action_input": "Marysville WA"
}
\`\`\`

Actual Behavior Screenshots

image

Desktop (please complete the following information):

w601sxs commented 2 months ago

@mttanke can you take a look and repro?

w601sxs commented 2 months ago

Closing based on #254