Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion AmazonBedrock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ Each chapter consists of a lesson and a set of exercises.
- **Appendix:** Beyond Standard Prompting
- Chaining Prompts
- Tool Use
- Empriical Performance Evaluations
- Empirical Performance Evaluations
- Search & Retrieval
2 changes: 1 addition & 1 deletion AmazonBedrock/anthropic/01_Basic_Prompt_Structure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"`user` and `assistant` messages **MUST alternate**, and messages **MUST start with a `user` turn**. You can have multiple `user` & `assistant` pairs in a prompt (as if simulating a multi-turn conversation). You can also put words into a terminal `assistant` message for Claude to continue from where you left off (more on that in later chapters).\n",
"While the traditional approach of alternating `user` and `assistant` messages is still recommended for optimal conversation flow, consecutive user messages are now allowed and will work. Messages should still start with a `user` turn. You can have multiple `user` & `assistant` pairs in a prompt (as if simulating a multi-turn conversation). You can also put words into a terminal `assistant` message for Claude to continue from where you left off (more on that in later chapters).\n",
"\n",
"#### System Prompts\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion AmazonBedrock/boto3/01_Basic_Prompt_Structure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"`user` and `assistant` messages **MUST alternate**, and messages **MUST start with a `user` turn**. You can have multiple `user` & `assistant` pairs in a prompt (as if simulating a multi-turn conversation). You can also put words into a terminal `assistant` message for Claude to continue from where you left off (more on that in later chapters).\n",
"While the traditional approach of alternating `user` and `assistant` messages is still recommended for optimal conversation flow, consecutive user messages are now allowed and will work. Messages should still start with a `user` turn. You can have multiple `user` & `assistant` pairs in a prompt (as if simulating a multi-turn conversation). You can also put words into a terminal `assistant` message for Claude to continue from where you left off (more on that in later chapters).\n",
"\n",
"#### System Prompts\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions Anthropic 1P/01_Basic_Prompt_Structure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"`user` and `assistant` messages **MUST alternate**, and messages **MUST start with a `user` turn**. You can have multiple `user` & `assistant` pairs in a prompt (as if simulating a multi-turn conversation). You can also put words into a terminal `assistant` message for Claude to continue from where you left off (more on that in later chapters).\n",
"While the traditional approach of alternating `user` and `assistant` messages is still recommended for optimal conversation flow, consecutive user messages are now allowed and will work. Messages should still start with a `user` turn. You can have multiple `user` & `assistant` pairs in a prompt (as if simulating a multi-turn conversation). You can also put words into a terminal `assistant` message for Claude to continue from where you left off (more on that in later chapters).\n",
"\n",
"#### System Prompts\n",
"\n",
Expand Down Expand Up @@ -219,7 +219,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Why use a system prompt? A **well-written system prompt can improve Claude's performance** in a variety of ways, such as increasing Claude's ability to follow rules and instructions. For more information, visit our documentation on [how to use system prompts](https://docs.anthropic.com/claude/docs/how-to-use-system-prompts) with Claude.\n",
"Why use a system prompt? A **well-written system prompt can improve Claude's performance** in a variety of ways, such as increasing Claude's ability to follow rules and instructions. For more information, visit our documentation on [how to use system prompts](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/system-prompts) with Claude.\n",
"\n",
"Now we'll dive into some exercises. If you would like to experiment with the lesson prompts without changing any content above, scroll all the way to the bottom of the lesson notebook to visit the [**Example Playground**](#example-playground)."
]
Expand Down
10 changes: 5 additions & 5 deletions Anthropic 1P/10.2_Appendix_Tool Use.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"# Rewrittten to call Claude 3 Sonnet, which is generally better at tool use, and include stop_sequences\n",
"def get_completion(messages, system_prompt=\"\", prefill=\"\",stop_sequences=None):\n",
" message = client.messages.create(\n",
" model=\"claude-3-sonnet-20240229\",\n",
" model=\"claude-3-5-sonnet-20241022\",\n",
" max_tokens=2000,\n",
" temperature=0.0,\n",
" system=system_prompt,\n",
Expand All @@ -55,10 +55,10 @@
"\n",
"While it might seem conceptually complex at first, tool use, a.k.a. function calling, is actually quite simple! You already know all the skills necessary to implement tool use, which is really just a combination of substitution and prompt chaining.\n",
"\n",
"In previous substitution exercises, we substituted text into prompts. With tool use, we substitute tool or function results into prompts. Claude can't literally call or access tools and functions. Instead, we have Claude:\n",
"1. Output the tool name and arguments it wants to call\n",
"2. Halt any further response generation while the tool is called\n",
"3. Then we reprompt with the appended tool results"
"In previous substitution exercises, we substituted text into prompts. With tool use, we substitute tool or function results into prompts. Claude now outputs structured tool calls automatically:\n",
"1. Claude outputs the tool name and arguments it wants to call\n",
"2. API handles parsing and execution\n",
"3. Built-in error handling and more reliable, consistent performance"
]
},
{
Expand Down