Skip to content

Comments

Replace None assignments with stub classes for optional dependencies#61

Draft
Copilot wants to merge 2 commits intoadkfrom
copilot/sub-pr-35-b9331e10-b4a4-4133-ac41-bc9eeb192454
Draft

Replace None assignments with stub classes for optional dependencies#61
Copilot wants to merge 2 commits intoadkfrom
copilot/sub-pr-35-b9331e10-b4a4-4133-ac41-bc9eeb192454

Conversation

Copy link

Copilot AI commented Feb 6, 2026

Addresses feedback from #35 to improve error messages when optional Google Cloud dependencies are not installed.

Changes

Before: Conditional imports set classes to None when dependencies are missing, causing confusing TypeError: 'NoneType' object is not callable errors.

After: Stub classes raise clear ImportError messages with installation instructions on instantiation.

Modified: src/neo4j_agent_memory/__init__.py

  • VertexAIEmbedder: Stub raises ImportError with pip install neo4j-agent-memory[vertex-ai]
  • Neo4jMemoryService: Stub raises ImportError with pip install neo4j-agent-memory[google-adk]
  • Neo4jMemoryMCPServer: Use existing stub from mcp/server.py (already implements this pattern)

Example

from neo4j_agent_memory import VertexAIEmbedder

# Before: TypeError: 'NoneType' object is not callable
# After: ImportError: Vertex AI package not installed. Install with: pip install neo4j-agent-memory[vertex-ai]
embedder = VertexAIEmbedder()

Pattern follows existing implementation in mcp/server.py lines 230-243.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link

vercel bot commented Feb 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-memory Ready Ready Preview, Comment Feb 6, 2026 5:33pm

- VertexAIEmbedder: Raises ImportError with instruction to install neo4j-agent-memory[vertex-ai]
- Neo4jMemoryService: Raises ImportError with instruction to install neo4j-agent-memory[google-adk]
- Neo4jMemoryMCPServer: Use existing stub class from mcp/server.py (no longer needs try/except)

This addresses the poor UX issue where attempting to use unavailable features
results in confusing "TypeError: 'NoneType' object is not callable" errors
instead of clear ImportError messages with installation instructions.

Co-authored-by: johnymontana <1222454+johnymontana@users.noreply.github.com>
Copilot AI changed the title [WIP] Add stub classes for ADK and Vertex AI integrations Replace None assignments with stub classes for optional dependencies Feb 6, 2026
Copilot AI requested a review from johnymontana February 6, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants