Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Fix TypeScript build error (#3535)

Mrinank Bhowmick335a7d786240
diff --git a/mem0-ts/src/oss/src/llms/anthropic.ts b/mem0-ts/src/oss/src/llms/anthropic.ts
index b2cc695e1..f1b13baf9 100644
--- a/mem0-ts/src/oss/src/llms/anthropic.ts
+++ b/mem0-ts/src/oss/src/llms/anthropic.ts
@@ -39,7 +39,12 @@ export class AnthropicLLM implements LLM {
max_tokens: 4096,
});
- return response.content[0].text;
+ const firstBlock = response.content[0];
+ if (firstBlock.type === "text") {
+ return firstBlock.text;
+ } else {
+ throw new Error("Unexpected response type from Anthropic API");
+ }
}
async generateChat(messages: Message[]): Promise<LLMResponse> {