Repository navigation
Comparing changes
Open a pull request
base repository: mem0ai/mem0
base: main
head repository: nickrahman/mem0
compare: main
- 10 commits
- 6 files changed
- 2 contributors
Commits on Mar 15, 2026
-
fix: add tool support to Anthropic LLM for graph memory compatibility
The Anthropic LLM providers (Python and TypeScript) returned plain text strings even when called with tools, causing graph memory operations to silently fail. This adds tool format conversion (OpenAI → Anthropic) and response parsing that extracts tool_use blocks into the dict/object format that graph memory expects. Also removes the redundant `structuredLlm` field from the TS `MemoryGraph` class — it was initialized identically to `llm`. Fixes #3711 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 5c2d718 - Browse repository at this point
Copy the full SHA 5c2d718View commit details -
fix: complete Anthropic provider tool_choice, top_p, and response_for…
…mat handling Address PR review feedback: - Map tool_choice correctly: "required" → {"type": "any"}, specific tool names → {"type": "tool", "name": ...}, "none" → omit param - Strip top_p from Anthropic API calls (rejects temperature + top_p combo) - Append JSON instruction to user message when response_format is json_object and no tools are provided (same pattern as Ollama provider) Applies to both Python and TypeScript implementations with full test coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Configuration menu - View commit details
-
Copy full SHA for 76843b4 - Browse repository at this point
Copy the full SHA 76843b4View commit details -
fix(anthropic): prevent message double-pass, guard empty response, fi…
…x docstring - Stop passing raw messages to _get_supported_params; filtered_messages (sans system) is set correctly via params.update below. - Raise ValueError on empty response.content instead of IndexError. - Correct response_format docstring — the param IS used, not reserved. - Only drop top_p when temperature is also present (not unconditionally). - Add tests: empty-content guard, _convert_tools validation paths, response_format suppression when tools are present, top_p behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for b0e9779 - Browse repository at this point
Copy the full SHA b0e9779View commit details -
fix(graph_memory): guard JSON.parse calls and prevent Cypher injection
- Wrap JSON.parse in _establishNodesRelationsFromData and _getDeleteEntitiesFromSearchOutput with try/catch for malformed args. - Add _sanitizeRelationshipType to reject relationship strings with characters outside [a-z0-9_] before Cypher interpolation. - Remove duplicate LLMResponse/ToolCall interfaces, simplify llmProvider init. - Extract systemContent variable in anthropic.ts. - Add TS tests: empty content guard, _convertTools validation paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 4e5d09b - Browse repository at this point
Copy the full SHA 4e5d09bView commit details -
refactor: simplify top_p handling, add runtime guards, clean up tests
- Revert top_p to unconditional drop (config always provides temperature default, so the conditional was never reachable) and remove broken test. - Add runtime typeof guard in generateChat instead of unsafe `as string` cast. - Move empty-response guard before the tools branch in _parse_response. - Remove noise comments, extract shared test helpers, deduplicate test setup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 56f47f5 - Browse repository at this point
Copy the full SHA 56f47f5View commit details -
fix: normalize relationship types before validation, add response typ…
…e guard - _sanitizeRelationshipType now lowercases and replaces spaces before validating, matching the Python behavior. Previously uppercase LLM output (e.g., "LIKES") was rejected as unsafe. - Add type guard in Python _parse_response: check content[0].type is "text" before accessing .text to avoid AttributeError on unexpected block types. - Replace cross-provider comment with self-contained explanation. - Refactor Python tests: extract llm fixture, _make_text_response helper, and SIMPLE_TOOL constant to reduce duplication. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 69b1995 - Browse repository at this point
Copy the full SHA 69b1995View commit details -
fix: skip anthropic tests when anthropic package not installed
Uses pytest.importorskip to gracefully skip the test module in CI environments where the anthropic optional dependency isn't available. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 5e9cc8a - Browse repository at this point
Copy the full SHA 5e9cc8aView commit details -
fix: add noqa E402 for imports after importorskip
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for b6f5ca7 - Browse repository at this point
Copy the full SHA b6f5ca7View commit details -
fix: add anthropic to llms optional dependency group
The anthropic package was missing from the llms extras, causing test collection to fail in CI where dev envs include the llms feature. Reverts the importorskip workaround in favor of the proper fix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 362a5ba - Browse repository at this point
Copy the full SHA 362a5baView commit details -
Merge pull request #1 from nickrahman/fix/anthropic-tool-support
fix: add tool support to Anthropic LLM for graph memory compatibility
Configuration menu - View commit details
-
Copy full SHA for 437eb77 - Browse repository at this point
Copy the full SHA 437eb77View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff main...main