Skip to content

Commit

Permalink
Merge pull request #900 from ag2ai/fix-codespell
Browse files Browse the repository at this point in the history
Fix codespell
  • Loading branch information
davorrunje authored Feb 10, 2025
2 parents 895fe51 + efe5138 commit a60fb1a
Show file tree
Hide file tree
Showing 55 changed files with 205 additions and 10,747 deletions.
24 changes: 10 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,18 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
args: ["-L", "ans,linar,nam,tread,ot,assertIn,dependin,socio-economic"]
additional_dependencies:
- tomli
# args: ["-L", "ans,linar,nam,tread,ot,assertIn,dependin,socio-economic,Regio"]
# ./notebook,./website/node_modules,./website/notebooks
exclude: |
(?x)^(
pyproject.toml |
website/static/img/ag.svg |
website/static/img/ag2.svg |
website/yarn.lock |
website/docs/tutorial/code-executors.ipynb |
website/user-guide/code-execution/custom-executor.ipynb |
website/user-guide/non-openai-models/cloud-gemini.ipynb |
notebook/.* |
test/agentchat/contrib/graph_rag/trip_planner_data/.* |
test/agentchat/contrib/graph_rag/paul_graham_essay.txt |
website/package-lock.json |
website/docs/use-cases/reference-agents/captainagent.mdx |
# notebook/.* |
notebook/agentchat_lmm_gpt-4v.ipynb |
notebook/agentchat_graph_rag_neo4j.ipynb |
notebook/agentchat_swarm_graphrag_telemetry_trip_planner.ipynb |
website/node_modules/.* |
website/notebooks/.*
)$
# See https://jaredkhan.com/blog/mypy-pre-commit
- repo: local
Expand Down
18 changes: 9 additions & 9 deletions notebook/JSON_mode_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"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",
"The group chat manager can perform 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",
"\n",
"![agent flow](https://media.githubusercontent.com/media/ag2ai/ag2/main/notebook/friendly_and_suspicous.jpg)\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 explanation for what each field is for."
]
},
{
Expand All @@ -174,7 +174,7 @@
"\"userquery\": {\n",
"\"query\": \"copy the original user request, without edit, into this field\",\n",
"\"vibe\": \"give a short list of keywords that describe the general vibe of the query. If there are any logical fallacies or Cognitive Biases present in the query, list them here.\",\n",
"\"friendliness\": \"1-10\", # how friendly does the user seem, from the information already gathered? 10. would be overpoweringly friendly, bowls you over with affection. 6 would mean pleasant and polite, but reserved . 1. would be agressive and hostile.\n",
"\"friendliness\": \"1-10\", # how friendly does the user seem, from the information already gathered? 10. would be overpoweringly friendly, bowls you over with affection. 6 would mean pleasant and polite, but reserved . 1. would be aggressive and hostile.\n",
"\"coercive_rating\": \"1-10\", # how coercive is the user being, from the information already gathered? 10. would mean a direct threat of violence. 6 would mean a subtle implied threat or potential danager. 1. would be completely non-comittal.\n",
"}\n",
"}\n",
Expand All @@ -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 integers 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
Loading

0 comments on commit a60fb1a

Please sign in to comment.