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
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ async def main() -> None:
default_options={"store": False},
) as agent:
try:
# note that we will use the service side storage, nor load messsages from the history provider,
# but we include it to demonstrate that it can be used alongside the Foundry provider for other use cases.
# note that we will use the service side storage and not load messages from the history
# provider, but we include it to demonstrate that it can be used alongside the Foundry
# provider for other use cases.
session = agent.create_session()

# First interaction - establish some preferences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""
Tool exceptions handled by returning the error for the agent to recover from.

Shows how a tool that throws an exception creates gracefull recovery and can keep going.
Shows how a tool that throws an exception creates graceful recovery and can keep going.
The LLM decides whether to retry the call or to respond with something else, based on the exception.
"""

Expand All @@ -37,7 +37,7 @@ def safe_divide(
try:
result = a / b # Will raise ZeroDivisionError
except ZeroDivisionError as exc:
print(f" Tool failed: with error: {exc}")
print(f" Tool failed with error: {exc}")
raise

return f"{a} / {b} = {result}"
Expand Down Expand Up @@ -79,7 +79,7 @@ async def main():
Expected Output:
============================================================
Step 1: Call divide(10, 0) - tool raises exception
Tool failed: with error: division by zero
Tool failed with error: division by zero
Response: Division by zero is undefined in standard arithmetic, so 10 ÷ 0 has no meaning.

If you’re curious about limits: as x approaches 0 from the positive side, 10/x tends to +∞; from the negative side,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ async def main() -> None:
instructions=(
"You are a programming expert in a workgroup. "
f"Your job is to review the answer provided by {expert.name} and point "
"out statements that are technically true but practically dangerous."
"If there is nothing woth pointing out, respond with 'The answer looks good to me.'"
"out statements that are technically true but practically dangerous. "
"If there is nothing worth pointing out, respond with 'The answer looks good to me.'"
),
client=client,
)
Expand Down
Loading