Skip to content

Commit 3f2b7fd

Browse files
committed
Merge remote-tracking branch 'origin/main' into henry/11-24-tst-cookbook
2 parents 914d754 + 7fd2ac6 commit 3f2b7fd

13 files changed

+5600
-26
lines changed

multimodal/crop_tool.ipynb

Lines changed: 771 additions & 0 deletions
Large diffs are not rendered by default.

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ dependencies = [
99
"numpy>=2.3.4",
1010
"pandas>=2.3.3",
1111
"jupyter>=1.1.1",
12+
"rich>=14.2.0",
13+
"python-dotenv>=1.2.1",
1214
"voyageai>=0.3.5",
1315
]
1416

15-
[tool.uv.sources]
16-
1717
[build-system]
1818
requires = ["hatchling"]
1919
build-backend = "hatchling.build"
@@ -41,7 +41,11 @@ indent-style = "space"
4141
line-ending = "auto"
4242

4343
[tool.ruff.lint]
44+
select = ["E", "F", "I", "W", "UP", "S", "B"]
4445
ignore = [
46+
"E501", # line too long
47+
"S101", # assert used (ok in tests)
48+
"S311", # pseudo-random generators ok for non-crypto
4549
"N806", # variable in function should be lowercase (allow for API responses)
4650
]
4751

tool_use/__init__.py

Whitespace-only changes.

tool_use/automatic-context-compaction.ipynb

Lines changed: 1242 additions & 0 deletions
Large diffs are not rendered by default.

tool_use/ptc.ipynb

Lines changed: 1831 additions & 0 deletions
Large diffs are not rendered by default.

tool_use/requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
anthropic>=0.18.0
22
python-dotenv>=1.0.0
3-
ipykernel>=6.29.0 # For Jupyter in VSCode
3+
ipykernel>=6.29.0 # For Jupyter in VSCode
4+
rich>=13.0.0
5+
pandas>=2.0.0

tool_use/tool_search_with_embeddings.ipynb

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
{
3838
"cell_type": "code",
39-
"execution_count": 56,
39+
"execution_count": 68,
4040
"metadata": {},
4141
"outputs": [
4242
{
@@ -77,7 +77,7 @@
7777
},
7878
{
7979
"cell_type": "code",
80-
"execution_count": 57,
80+
"execution_count": 69,
8181
"metadata": {},
8282
"outputs": [
8383
{
@@ -130,7 +130,7 @@
130130
},
131131
{
132132
"cell_type": "code",
133-
"execution_count": 58,
133+
"execution_count": 70,
134134
"metadata": {},
135135
"outputs": [
136136
{
@@ -318,7 +318,7 @@
318318
},
319319
{
320320
"cell_type": "code",
321-
"execution_count": 59,
321+
"execution_count": 71,
322322
"metadata": {},
323323
"outputs": [
324324
{
@@ -375,7 +375,7 @@
375375
},
376376
{
377377
"cell_type": "code",
378-
"execution_count": 60,
378+
"execution_count": 72,
379379
"metadata": {},
380380
"outputs": [
381381
{
@@ -424,7 +424,7 @@
424424
},
425425
{
426426
"cell_type": "code",
427-
"execution_count": 61,
427+
"execution_count": 73,
428428
"metadata": {},
429429
"outputs": [
430430
{
@@ -497,7 +497,7 @@
497497
},
498498
{
499499
"cell_type": "code",
500-
"execution_count": 62,
500+
"execution_count": 74,
501501
"metadata": {},
502502
"outputs": [
503503
{
@@ -541,7 +541,7 @@
541541
},
542542
{
543543
"cell_type": "code",
544-
"execution_count": 63,
544+
"execution_count": 75,
545545
"metadata": {},
546546
"outputs": [
547547
{
@@ -606,7 +606,7 @@
606606
},
607607
{
608608
"cell_type": "code",
609-
"execution_count": 64,
609+
"execution_count": 76,
610610
"metadata": {},
611611
"outputs": [
612612
{
@@ -813,7 +813,7 @@
813813
},
814814
{
815815
"cell_type": "code",
816-
"execution_count": 65,
816+
"execution_count": 77,
817817
"metadata": {},
818818
"outputs": [
819819
{
@@ -944,7 +944,7 @@
944944
},
945945
{
946946
"cell_type": "code",
947-
"execution_count": 66,
947+
"execution_count": 78,
948948
"metadata": {},
949949
"outputs": [
950950
{
@@ -961,22 +961,21 @@
961961
"\n",
962962
"🔧 Tool invocation: get_weather\n",
963963
" Input: {\n",
964-
" \"location\": \"Tokyo, Japan\"\n",
964+
" \"location\": \"Tokyo\"\n",
965965
"}\n",
966-
" ✅ Mock result: {\"location\": \"Tokyo, Japan\", \"temperature\": 60, \"unit\": \"fahrenheit\", \"conditions\": \"rainy\", \"humidity\": 58, \"wind_speed\": 7}\n",
966+
" ✅ Mock result: {\"location\": \"Tokyo\", \"temperature\": 75, \"unit\": \"fahrenheit\", \"conditions\": \"partly cloudy\", \"humidity\": 61, \"wind_speed\": 9}\n",
967967
"\n",
968968
"--- Turn 2 ---\n",
969969
"\n",
970970
"✓ Conversation complete\n",
971971
"\n",
972-
"ASSISTANT: The current weather in Tokyo, Japan is:\n",
972+
"ASSISTANT: The weather in Tokyo is currently:\n",
973+
"- **Temperature:** 75°F (about 24°C)\n",
974+
"- **Conditions:** Partly cloudy\n",
975+
"- **Humidity:** 61%\n",
976+
"- **Wind Speed:** 9 mph\n",
973977
"\n",
974-
"- **Temperature:** 60°F (about 16°C)\n",
975-
"- **Conditions:** Rainy\n",
976-
"- **Humidity:** 58%\n",
977-
"- **Wind Speed:** 7 mph\n",
978-
"\n",
979-
"It's a rainy day in Tokyo, so you'd want to bring an umbrella if you're heading out!\n",
978+
"It's a pleasant day with comfortable temperatures and some cloud cover!\n",
980979
"\n",
981980
"================================================================================\n",
982981
"\n"
@@ -998,7 +997,7 @@
998997
},
999998
{
1000999
"cell_type": "code",
1001-
"execution_count": 67,
1000+
"execution_count": 79,
10021001
"metadata": {},
10031002
"outputs": [
10041003
{
@@ -1030,9 +1029,9 @@
10301029
"\n",
10311030
"**Final Amount: $16,470.09**\n",
10321031
"\n",
1033-
"This means you'll earn **$6,470.09 in interest** over the 10-year period.\n",
1032+
"This means you'll earn **$6,470.09** in interest over the 10-year period.\n",
10341033
"\n",
1035-
"The monthly compounding helps your investment grow faster than simple interest or less frequent compounding, as the interest earned each month gets added to your principal and also starts earning interest.\n",
1034+
"The monthly compounding means that interest is calculated and added to your principal every month, which allows your investment to grow faster than with annual compounding due to the effect of earning \"interest on interest\" more frequently.\n",
10361035
"\n",
10371036
"================================================================================\n",
10381037
"\n"

tool_use/utils/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
Shared utilities for Claude tool use cookbooks.
3+
4+
This package contains reusable components for creating cookbook demonstrations:
5+
- visualize: Rich terminal visualization for Claude API responses
6+
- team_expense_api: Example mock API for team expense management demonstrations
7+
"""
8+
9+
from .visualize import show_response, visualize
10+
11+
__all__ = ["visualize", "show_response"]

0 commit comments

Comments
 (0)