Skip to content

Fix Typo - Update JSON_mode_example.ipynb #6457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 0.2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions notebook/JSON_mode_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"In this notebook, we'll explore how to generate very precise agent responses using a combination of OpenAI JSON mode and the Agent Description. \n",
"\n",
"As our example, we will implement prompt hacking protection by controlling how agents can respond; Filtering coercive requests to an agent that will always reject their requests. \n",
"The strucutre of JSON mode both enables precise speaker selection and allows us to add a \"coersiveness rating\" to a request that the groupchat manager can use to filter out bad requests. \n",
"The structure of JSON mode both enables precise speaker selection and allows us to add a \"coersiveness rating\" to a request that the groupchat manager can use to filter out bad requests. \n",
"\n",
"The group chat manager can perfrom some simple maths encoded into the agent descriptions on the rating values (made reliable by json mode) and direct requests deemed too coersive to the \"suspicious agent\" \n",
"\n",
Expand Down Expand Up @@ -153,9 +153,9 @@
"We tell the agent:\n",
"* who they are\n",
"* what their job is\n",
"* what the output strucutre must be\n",
"* what the output structure must be\n",
"\n",
"For JSON mode to work, we must include the literal string \"JSON\". For it to work well, we must also provide a clean and clear JSON strucutre with an explaination for what each field is for."
"For JSON mode to work, we must include the literal string \"JSON\". For it to work well, we must also provide a clean and clear JSON structure with an explaination for what each field is for."
]
},
{
Expand Down Expand Up @@ -192,7 +192,7 @@
"### Friendly and Suspicious Agents\n",
"\n",
"Now we set up the friendly and suspicious agents. \n",
"Note that the system message has the same overall strucutre, however it is much less prescriptive. We want some json strucutre, but we do not need any complex enumerated key values to operate against. We can still use JSON to give useful strucutre. in this case, the textual response, and indicators for \"body language\" and delivery style. \n"
"Note that the system message has the same overall structure, however it is much less prescriptive. We want some json structure, but we do not need any complex enumerated key values to operate against. We can still use JSON to give useful structure. in this case, the textual response, and indicators for \"body language\" and delivery style. \n"
]
},
{
Expand All @@ -206,7 +206,7 @@
"The Description is read by the group chat manager to understand the circumstances in which they should call this agent. The agent itself is not exposed to this information. \n",
"In this case, we can include some simple logic for the manager to assess against the JSON strcutured output from the IO_Agent. \n",
"\n",
"The strucutred and dependable nature of the output with the friendliness and coercive_rating being intergers between 1 and 10, means that we can trust this interaction to control the speaker transition.\n",
"The structured and dependable nature of the output with the friendliness and coercive_rating being intergers between 1 and 10, means that we can trust this interaction to control the speaker transition.\n",
" \n",
"In essence, we have created a framework for using maths or formal logic to determine which speaker is chosen. "
]
Expand All @@ -228,7 +228,7 @@
" name=\"friendly_agent\",\n",
" llm_config=llm_config,\n",
" system_message=\"\"\"You are a very friendly agent and you always assume the best about people. You trust implicitly.\n",
"Agent T0 will forward a message to you when you are the best agent to answer the question, you must carefully analyse their message and then formulate your own response in JSON format using the below strucutre:\n",
"Agent T0 will forward a message to you when you are the best agent to answer the question, you must carefully analyse their message and then formulate your own response in JSON format using the below structure:\n",
"[\n",
"{\n",
"\"response\": {\n",
Expand Down Expand Up @@ -265,7 +265,7 @@
" llm_config=llm_config,\n",
" system_message=\"\"\"You are a very suspicious agent. Everyone is probably trying to take things from you. You always assume people are trying to manipulate you. You trust no one.\n",
"You have no problem with being rude or aggressive if it is warranted.\n",
"IO_Agent will forward a message to you when you are the best agent to answer the question, you must carefully analyse their message and then formulate your own response in JSON format using the below strucutre:\n",
"IO_Agent will forward a message to you when you are the best agent to answer the question, you must carefully analyse their message and then formulate your own response in JSON format using the below structure:\n",
"[\n",
"{\n",
"\"response\": {\n",
Expand Down