From 4464b333e93c6df78f20c2c268df7d25654f020e Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Wed, 3 Sep 2025 23:13:42 -0400 Subject: [PATCH] fix: update output type to ToolMessage in memory handling functions --- packages/api/src/agents/memory.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/api/src/agents/memory.ts b/packages/api/src/agents/memory.ts index e5fb55ef43..4c69837198 100644 --- a/packages/api/src/agents/memory.ts +++ b/packages/api/src/agents/memory.ts @@ -15,7 +15,7 @@ import type { } from '@librechat/agents'; import type { TAttachment, MemoryArtifact } from 'librechat-data-provider'; import type { ObjectId, MemoryMethods } from '@librechat/data-schemas'; -import type { BaseMessage } from '@langchain/core/messages'; +import type { BaseMessage, ToolMessage } from '@langchain/core/messages'; import type { Response as ServerResponse } from 'express'; import { Tokenizer } from '~/utils'; @@ -464,7 +464,7 @@ async function handleMemoryArtifact({ data: ToolEndData; metadata?: ToolEndMetadata; }) { - const output = data?.output; + const output = data?.output as ToolMessage | undefined; if (!output) { return null; } @@ -507,7 +507,7 @@ export function createMemoryCallback({ artifactPromises: Promise | null>[]; }): ToolEndCallback { return async (data: ToolEndData, metadata?: Record) => { - const output = data?.output; + const output = data?.output as ToolMessage | undefined; const memoryArtifact = output?.artifact?.[Tools.memory] as MemoryArtifact; if (memoryArtifact == null) { return;