Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mem0ai/mem0
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: nickrahman/mem0
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 10 commits
  • 6 files changed
  • 2 contributors

Commits on Mar 15, 2026

  1. 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>
    nickrahman and claude committed Mar 15, 2026
    Configuration menu
    Copy the full SHA
    5c2d718 View commit details
    Browse the repository at this point in the history
  2. 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>
    nickrahman and claude committed Mar 15, 2026
    Configuration menu
    Copy the full SHA
    76843b4 View commit details
    Browse the repository at this point in the history
  3. 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>
    nickrahman and claude committed Mar 15, 2026
    Configuration menu
    Copy the full SHA
    b0e9779 View commit details
    Browse the repository at this point in the history
  4. 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>
    nickrahman and claude committed Mar 15, 2026
    Configuration menu
    Copy the full SHA
    4e5d09b View commit details
    Browse the repository at this point in the history
  5. 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>
    nickrahman and claude committed Mar 15, 2026
    Configuration menu
    Copy the full SHA
    56f47f5 View commit details
    Browse the repository at this point in the history
  6. 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>
    nickrahman and claude committed Mar 15, 2026
    Configuration menu
    Copy the full SHA
    69b1995 View commit details
    Browse the repository at this point in the history
  7. 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>
    nickrahman and claude committed Mar 15, 2026
    Configuration menu
    Copy the full SHA
    5e9cc8a View commit details
    Browse the repository at this point in the history
  8. fix: add noqa E402 for imports after importorskip

    Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
    nickrahman and claude committed Mar 15, 2026
    Configuration menu
    Copy the full SHA
    b6f5ca7 View commit details
    Browse the repository at this point in the history
  9. 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>
    nickrahman and claude committed Mar 15, 2026
    Configuration menu
    Copy the full SHA
    362a5ba View commit details
    Browse the repository at this point in the history
  10. Merge pull request #1 from nickrahman/fix/anthropic-tool-support

    fix: add tool support to Anthropic LLM for graph memory compatibility
    nickrahman authored Mar 15, 2026
    Configuration menu
    Copy the full SHA
    437eb77 View commit details
    Browse the repository at this point in the history
Loading