27 Commits

Author SHA1 Message Date
Alex Notov
aaa76b9c44 Fix context management for SDK 0.69.0 and improve documentation
This commit fixes the memory cookbook to work with anthropic SDK 0.69.0
and improves documentation around context clearing behavior.

Changes:
- Update context_management parameter usage for SDK 0.69.0
  - Pass as direct parameter instead of extra_body
  - Update response handling to use getattr() for Pydantic objects
- Fix context clearing configuration in notebook
  - Lower clear_at_least threshold from 3000 to 50 tokens
  - Memory tool operations have small results (~50-150 tokens)
  - Add documentation explaining why threshold is low
- Add explanatory notes about context clearing behavior
  - Explain why token savings are small in the demo
  - Provide guidance for production configurations
  - Document that larger tool results would save more tokens

The notebook now works correctly with SDK 0.69.0 and provides clear
guidance for users configuring context management in their applications.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 15:16:15 -06:00
Alex Notov
2182d5b6c4 Add reference to context engineering blog post in memory cookbook
Links to the Effective Context Engineering blog post at the start of the introduction to provide readers with background on the engineering principles demonstrated in the cookbook.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-28 21:26:12 -06:00
Alex Notov
be193457e4 Update tool_use/memory_cookbook.ipynb
Co-authored-by: Eric Harmeling <eric.harmeling@outlook.com>
2025-09-28 21:14:08 -06:00
Alex Notov
f9d1386c08 Fix type hint consistency: change any to Any in sample code
- Add Any to imports in web_scraper_v1.py, api_client_v1.py, and cache_manager.py
- Replace lowercase 'any' with 'Any' in all type hints
- Fixes syntax error: 'any' is a built-in function, not a type

Addresses PR review comments from automated bot and samj.
2025-09-28 10:52:17 -06:00
Alex Notov
920c2ca516 Update support link from support.anthropic.com to support.claude.com 2025-09-27 14:51:29 -06:00
Alex Notov
32637b59a8 Update documentation link from docs.anthropic.com to docs.claude.com 2025-09-27 14:47:11 -06:00
Alex Notov
bca188063e Updates output to have correct model name for launch 2025-09-27 14:46:00 -06:00
Alex Notov
66b61a0a08 Fixes model string for Sonnet 4.5 2025-09-27 14:42:12 -06:00
Alex Notov
1add1373a2 Address PR review comments
- Update .env.example to use claude-sonnet-4-5 model
- Remove "Always check memory first" from system prompts
- Add warning to clear_all_memory() about demonstration purposes
- Add path validation assertion in _delete() for safety
- Add notebook cell warning about memory clearing
- Clarify "Pattern Stored" section to show what Claude learns

All changes verified against official memory tool documentation.
2025-09-27 14:38:48 -06:00
Alex Notov
4d3ed1f75b Add memory & context management cookbook
Interactive notebook demonstrating Claude's memory tool and context editing capabilities with code review examples.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 20:11:13 -06:00
Alex Notov
8d1c93365b Revert CLAUDE_API_KEY to ANTHROPIC_API_KEY throughout the repository
Reverted all instances of CLAUDE_API_KEY back to ANTHROPIC_API_KEY to maintain
compatibility with existing infrastructure and GitHub secrets. This affects:
- Environment variable examples (.env.example files)
- Python scripts and notebooks
- Documentation and README files
- Evaluation scripts and test files

Other naming changes (Claude API, Claude Console, Claude Docs, Claude Cookbook) remain intact.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-16 17:02:29 -06:00
Alex Notov
bfffab4523 chore: Updates all references per new branding. 2025-09-16 16:35:49 -06:00
Ethan Dixon
b98b8e73e0 updated run, pending agents update 2025-05-28 21:57:00 -07:00
Alexander Bricken
022bcc2d06 update wording 2025-05-27 14:50:33 -04:00
Alexander Bricken
d6a05bf2d7 remove downloads folder pdf 2025-05-26 22:49:43 -04:00
Alexander Bricken
68101cbaf3 add more about context limits 2025-05-26 22:42:50 -04:00
Alexander Bricken
740073e41c suggested changes to memory introduction and agents tmp handling 2025-05-23 17:23:18 -07:00
Ethan Dixon
176aa000a2 push cookbook 2025-05-22 09:18:41 -07:00
Ben Komalo
fd56f9eaed Recipe for parallel tool use in Claude 3.7 Sonnet
Claude 3.7 Sonnet has a tendency to make tool calls serially, instead of
in parallel. This provides a potential workaround for users.
2025-03-06 12:11:56 -08:00
Cal Rueb
264feebc86 Add a tool use/JSON example where input is undefined 2024-07-25 13:45:33 -07:00
alexalbertt
9d99c5e1a1 Remove import 2024-05-30 00:32:30 -07:00
alexalbertt
41e5e7bb20 Tool use GA 2024-05-30 00:31:42 -07:00
alexalbertt
d977d419aa New tool use features 2024-05-15 18:53:40 -07:00
alexalbertt
98c4daaf79 add pydantic plus tool use 2024-04-12 14:50:26 -07:00
Carson Kahn
aa67060c29 Escape for valid notebook 2024-04-05 12:28:18 -07:00
Ben Epstein
cb3443135c Fix calculator regex and example
One of the examples was wrong. The calculator gave the wrong result, and then Claude hallucinated another result. I fixed the regex which fixed the example
2024-04-05 06:01:14 -04:00
alexalbertt
af178a25cf tool use launch 2024-04-03 20:46:32 -07:00