-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Document promptTemplate feature for AI SDK #660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pull Request Review: Document promptTemplate feature for AI SDKSummaryThis PR adds documentation for the new ✅ Strengths1. Excellent Documentation Structure
2. Comprehensive Coverage
3. Code Quality
4. Accurate Technical Details
🔍 Areas for Improvement1. Minor Consistency IssueIn const model = withSupermemory(anthropic("claude-3-sonnet"), "user-123", {However, the import { anthropic } from "@ai-sdk/anthropic"at the top of this example for consistency with other examples. 2. Test Coverage ConsiderationNo tests were found for the
Note: This is not a blocker for this PR since it's documentation-only. 3. Potential EnhancementConsider adding a note about:
🔒 Security Review✅ No security concerns identified
📊 Performance Considerations✅ No performance impact
🎯 Best Practices AlignmentFollows Repository Standards
Adheres to CLAUDE.md Guidelines
📝 Specific Line-by-Line Review
|
MaheshtheDev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Merge activity
|
Added comprehensive documentation for the new `promptTemplate` option in the AI SDK, which allows developers to customize how memories are formatted and injected into system prompts. This includes examples for XML-based prompting (Claude), custom branding, and the `MemoryPromptData` interface. ## Files Changed - `apps/docs/ai-sdk/user-profiles.mdx` - Added "Custom Prompt Templates" section with examples and interface documentation - `apps/docs/ai-sdk/overview.mdx` - Updated User Profiles section to mention customization capabilities Generated from [feat: allow prompt template for @supermemory/tools package](#655) @MaheshtheDev
385ef96 to
2dfadd3
Compare
Pull Request Review: Document promptTemplate Feature for AI SDKThank you for documenting the new promptTemplate feature! This is a valuable addition that gives developers flexibility in how memories are injected. Here is my comprehensive review: Strengths1. Excellent Documentation Structure
2. Comprehensive Coverage
3. Code QualityThe underlying implementation (from PR #655) is solid:
Observations & Suggestions1. Import Statement InconsistencyLocation: apps/docs/ai-sdk/user-profiles.mdx:129 The first example includes the type import, but later examples (lines 163, 187) omit it.
2. Missing Import in Claude ExampleLocation: apps/docs/ai-sdk/user-profiles.mdx:176 The Claude example uses anthropic() but does not show the import statement. 3. Template String FormattingAll examples use .trim() which is good practice. 4. Empty String HandlingLocation: packages/tools/src/vercel/memory-prompt.ts:178-179 When mode is not profile, empty search results will still produce a "Search results" header.
5. Error Handling DocumentationThe documentation does not mention what happens if:
Suggestion: Add a brief troubleshooting section or mention error handling behavior 6. Performance ConsiderationsThe promptTemplate function is called synchronously in the request path. Security ConsiderationsGood Practices:
Minor Consideration:If a developer accidentally includes user input in their custom template without sanitization, they could create prompt injection vulnerabilities. Suggestion: Add a security warning in the docs about not interpolating unsanitized user input into custom templates Test CoverageObservation: I checked the test files in packages/tools/test/ and did not see specific tests for the promptTemplate functionality. Suggestion: Consider adding tests to verify:
Documentation Best PracticesFollows Repository Conventions:
Minor Enhancements:
SummaryOverall Assessment: ExcellentThis PR successfully documents a powerful new feature with clear, practical examples. The code quality is solid, and the documentation is comprehensive. Action Items (Priority Order):High Priority:
Medium Priority: Low Priority: Approval RecommendationThis PR is ready to merge with minor improvements suggested above. The documentation is clear, accurate, and provides real value to developers. The underlying implementation (from PR #655) is well-designed and type-safe. Great work on giving developers more control over memory injection! Review generated by Claude Code following CLAUDE.md conventions |
Added comprehensive documentation for the new
promptTemplateoption in the AI SDK, which allows developers to customize how memories are formatted and injected into system prompts. This includes examples for XML-based prompting (Claude), custom branding, and theMemoryPromptDatainterface.Files Changed
apps/docs/ai-sdk/user-profiles.mdx- Added "Custom Prompt Templates" section with examples and interface documentationapps/docs/ai-sdk/overview.mdx- Updated User Profiles section to mention customization capabilitiesGenerated from feat: allow prompt template for @supermemory/tools package @MaheshtheDev