mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-08 03:08:21 +00:00
Merge pull request #501 from supermemoryai/10-19-fix_tools_update_the_docs_for_conversational
fix(tools): update the docs for conversational
This commit is contained in:
commit
d9a9ce00f8
2 changed files with 24 additions and 4 deletions
|
|
@ -62,9 +62,6 @@ const addTool = addMemoryTool(process.env.SUPERMEMORY_API_KEY!, {
|
|||
|
||||
#### AI SDK Middleware with Supermemory
|
||||
|
||||
> [!CAUTION]
|
||||
> `withSupermemory` is in beta
|
||||
|
||||
- `withSupermemory` will take advantage supermemory profile v4 endpoint personalized based on container tag
|
||||
- Make sure you have `SUPERMEMORY_API_KEY` in env
|
||||
|
||||
|
|
@ -83,6 +80,27 @@ const result = await generateText({
|
|||
console.log(result.text)
|
||||
```
|
||||
|
||||
#### Conversation Grouping
|
||||
|
||||
Use the `conversationId` option to group messages into a single document for contextual memory generation:
|
||||
|
||||
```typescript
|
||||
import { generateText } from "ai"
|
||||
import { withSupermemory } from "@supermemory/tools/ai-sdk"
|
||||
import { openai } from "@ai-sdk/openai"
|
||||
|
||||
const modelWithMemory = withSupermemory(openai("gpt-5"), "user_id_life", {
|
||||
conversationId: "conversation-456"
|
||||
})
|
||||
|
||||
const result = await generateText({
|
||||
model: modelWithMemory,
|
||||
messages: [{ role: "user", content: "where do i live?" }],
|
||||
})
|
||||
|
||||
console.log(result.text)
|
||||
```
|
||||
|
||||
#### Verbose Mode
|
||||
|
||||
Enable verbose logging to see detailed information about memory search and transformation:
|
||||
|
|
@ -280,12 +298,14 @@ The `withSupermemory` middleware accepts additional configuration options:
|
|||
|
||||
```typescript
|
||||
interface WithSupermemoryOptions {
|
||||
conversationId?: string
|
||||
verbose?: boolean
|
||||
mode?: "profile" | "query" | "full"
|
||||
addMemory?: "always" | "never"
|
||||
}
|
||||
```
|
||||
|
||||
- **conversationId**: Optional conversation ID to group messages into a single document for contextual memory generation
|
||||
- **verbose**: Enable detailed logging of memory search and injection process (default: false)
|
||||
- **mode**: Memory search mode - "profile" (default), "query", or "full"
|
||||
- **addMemory**: Automatic memory storage mode - "always" or "never" (default: "never")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@supermemory/tools",
|
||||
"type": "module",
|
||||
"version": "1.2.13",
|
||||
"version": "1.2.15",
|
||||
"description": "Memory tools for AI SDK and OpenAI function calling with supermemory",
|
||||
"scripts": {
|
||||
"build": "tsdown",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue