diff options
| -rw-r--r-- | apps/docs/ai-sdk/examples.mdx | 13 | ||||
| -rw-r--r-- | apps/docs/cookbook/ai-sdk-integration.mdx | 14 | ||||
| -rw-r--r-- | apps/docs/cookbook/personal-assistant.mdx | 4 | ||||
| -rw-r--r-- | apps/docs/memory-api/sdks/openai-plugins.mdx | 2 | ||||
| -rw-r--r-- | packages/ai-sdk/README.md | 2 | ||||
| -rw-r--r-- | packages/ai-sdk/src/tools.ts | 2 | ||||
| -rw-r--r-- | packages/tools/README.md | 4 |
7 files changed, 12 insertions, 29 deletions
diff --git a/apps/docs/ai-sdk/examples.mdx b/apps/docs/ai-sdk/examples.mdx index a0827e6c..cb2b1a7f 100644 --- a/apps/docs/ai-sdk/examples.mdx +++ b/apps/docs/ai-sdk/examples.mdx @@ -101,9 +101,7 @@ export async function POST(request: Request) { model: openai('gpt-4-turbo'), messages, tools: supermemoryTools(process.env.SUPERMEMORY_API_KEY!, { - headers: { - 'x-sm-user-id': customerId - } + containerTags: [customerId] }), system: `You are a customer support agent. Before responding to any query: 1. Search for the customer's previous interactions and issues @@ -192,10 +190,7 @@ export async function POST(request: Request) { model: anthropic('claude-3-haiku-20240307'), messages, tools: supermemoryTools(process.env.SUPERMEMORY_API_KEY!, { - headers: { - 'x-sm-user-id': userId, - 'x-sm-conversation-id': `course-${courseId}` - } + containerTags: [userId] }), system: `You are a learning assistant. Help students with their coursework by: 1. Remembering their learning progress and struggles @@ -230,9 +225,7 @@ export async function POST(request: Request) { model: openai('gpt-4-turbo'), messages, tools: supermemoryTools(process.env.SUPERMEMORY_API_KEY!, { - headers: { - 'x-sm-conversation-id': projectId - } + containerTags: [projectId] }), system: `You are a research assistant. You can: 1. Search through uploaded research papers and documents diff --git a/apps/docs/cookbook/ai-sdk-integration.mdx b/apps/docs/cookbook/ai-sdk-integration.mdx index 1bf217af..9bde2f42 100644 --- a/apps/docs/cookbook/ai-sdk-integration.mdx +++ b/apps/docs/cookbook/ai-sdk-integration.mdx @@ -100,10 +100,7 @@ export async function POST(request: Request) { model: openai('gpt-4-turbo'), messages, tools: supermemoryTools(process.env.SUPERMEMORY_API_KEY!, { - headers: { - 'x-sm-user-id': customerId, - 'x-sm-conversation-id': 'customer-support' - } + containerTags: [customerId] }), system: `You are a customer support agent. Before responding to any query: 1. Search for the customer's previous interactions and issues @@ -192,10 +189,7 @@ export async function POST(request: Request) { model: anthropic('claude-3-haiku-20240307'), messages, tools: supermemoryTools(process.env.SUPERMEMORY_API_KEY!, { - headers: { - 'x-sm-user-id': userId, - 'x-sm-conversation-id': `course-${courseId}` - } + containerTags: [userId] }), system: `You are a learning assistant. Help students with their coursework by: 1. Remembering their learning progress and struggles @@ -230,9 +224,7 @@ export async function POST(request: Request) { model: openai('gpt-4-turbo'), messages, tools: supermemoryTools(process.env.SUPERMEMORY_API_KEY!, { - headers: { - 'x-sm-conversation-id': projectId - } + containerTags: [projectId] }), system: `You are a research assistant. You can: 1. Search through uploaded research papers and documents diff --git a/apps/docs/cookbook/personal-assistant.mdx b/apps/docs/cookbook/personal-assistant.mdx index edaeed83..db999100 100644 --- a/apps/docs/cookbook/personal-assistant.mdx +++ b/apps/docs/cookbook/personal-assistant.mdx @@ -627,9 +627,7 @@ Check that memories are being stored properly: ```typescript // Always use user-specific container tags const tools = supermemoryTools(apiKey, { - headers: { - 'x-sm-user-id': userId - } + containerTags: [userId] }) ``` diff --git a/apps/docs/memory-api/sdks/openai-plugins.mdx b/apps/docs/memory-api/sdks/openai-plugins.mdx index 2fb0a789..6550cee3 100644 --- a/apps/docs/memory-api/sdks/openai-plugins.mdx +++ b/apps/docs/memory-api/sdks/openai-plugins.mdx @@ -142,7 +142,7 @@ tools = SupermemoryTools( import { supermemoryTools } from "@supermemory/tools/openai" const tools = supermemoryTools(process.env.SUPERMEMORY_API_KEY!, { - projectId: "your-project-id", + containerTags: ["your-user-id"], baseUrl: "https://custom-endpoint.com", // optional }) ``` diff --git a/packages/ai-sdk/README.md b/packages/ai-sdk/README.md index 8f96d438..17525667 100644 --- a/packages/ai-sdk/README.md +++ b/packages/ai-sdk/README.md @@ -154,7 +154,7 @@ async function chatWithTools(userMessage: string) { ], tools: { ...supermemoryTools(supermemoryApiKey, { - projectId: 'my-project' + containerTags: ['my-user-id'] }) }, maxToolRoundtrips: 5 diff --git a/packages/ai-sdk/src/tools.ts b/packages/ai-sdk/src/tools.ts index d0461924..f04df10b 100644 --- a/packages/ai-sdk/src/tools.ts +++ b/packages/ai-sdk/src/tools.ts @@ -26,7 +26,7 @@ export function supermemoryTools( const containerTags = config?.projectId ? [`sm_project_${config?.projectId}`] - : (config?.containerTags ?? ["sm_project_default"]) + : config?.containerTags const searchMemories = tool({ description: diff --git a/packages/tools/README.md b/packages/tools/README.md index f981e44c..bdf510dd 100644 --- a/packages/tools/README.md +++ b/packages/tools/README.md @@ -35,7 +35,7 @@ const openai = createOpenAI({ // Create all tools const tools = supermemoryTools(process.env.SUPERMEMORY_API_KEY!, { - projectId: "your-project-id", + containerTags: ["your-user-id"], }) // Use with AI SDK @@ -100,7 +100,7 @@ if (completion.choices[0]?.message.tool_calls) { // Or create individual function-based tools const tools = supermemoryTools(process.env.SUPERMEMORY_API_KEY!, { - projectId: "your-project-id", + containerTags: ["your-user-id"], }) const searchResult = await tools.searchMemories({ |