actrone-memory
    Preparing search index...

    Function vercelMemory

    • Vercel AI SDK: produce the system string to pass to generateText/streamText, and an onFinish callback that persists the turn. Frameworks stay optional, this returns plain values you spread into the SDK call.

      onFinish is a streamText option; generateText has none, so call the callback yourself with the result, or the turn is never saved.

      const mem = await vercelMemory(mm, { agentId, sessionId, query: prompt });
      const stream = streamText({ model, system: mem.system, prompt, onFinish: mem.onFinish(prompt) });
      // or, with generateText:
      const res = await generateText({ model, system: mem.system, prompt });
      await mem.onFinish(prompt)({ text: res.text });

      Parameters

      Returns Promise<
          {
              system: string;
              context: RetrievedContext;
              onFinish: (
                  userMessage: string,
              ) => (event: { text: string }) => Promise<void>;
          },
      >