mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-13 02:24:34 +00:00
fix: docs
This commit is contained in:
parent
698bd0e1cd
commit
c65f4e97ac
7 changed files with 12 additions and 29 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
})
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})
|
||||
```
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ async function chatWithTools(userMessage: string) {
|
|||
],
|
||||
tools: {
|
||||
...supermemoryTools(supermemoryApiKey, {
|
||||
projectId: 'my-project'
|
||||
containerTags: ['my-user-id']
|
||||
})
|
||||
},
|
||||
maxToolRoundtrips: 5
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue