Vercel AI SDK Integration — Phase 1: Python HTTP API#64
Open
johnymontana wants to merge 1 commit intomainfrom
Open
Vercel AI SDK Integration — Phase 1: Python HTTP API#64johnymontana wants to merge 1 commit intomainfrom
johnymontana wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This is the first phase of a three-layer integration that will bridge
neo4j-agent-memory(Python) with the Vercel AI SDK ecosystem (TypeScript). The full architecture:@neo4j-labs/agent-memory-client) — auto-generated from OpenAPI spec@neo4j-labs/ai-sdk-memory) — implements Vercel AI SDK memory provider interfaceThis PR implements Layer 1: a new
neo4j-agent-memory[server]optional module that wraps the entire MemoryClient API in a production-ready FastAPI server with auto-generated OpenAPI 3.1 spec, API key authentication, and CORS support.What's Included
New server module (
src/neo4j_agent_memory/server/) with 25 REST endpoints covering all three memory layers:POST /api/v1/contextreturns both formatted context text and structured data (messages, entities, preferences, traces) in a single call;POST /api/v1/context/textfor plain text;GET /api/v1/statsNew
MemoryClient.get_context_structured()method — The existingget_context()only returns a formatted string. The new method returns aStructuredContextobject with both the text and raw domain objects, enabling the criticalPOST /contextendpoint that Layer 2 clients will depend on.[server]optional dependency group —fastapi,uvicorn[standard],sse-starletteare only required when using the server module. The core library remains dependency-light.CLI
servecommand —neo4j-memory serve --port 8000 --api-key <key>starts the server. Uses lazy imports so the server dependencies aren't required for other CLI commands.API key authentication — Opt-in
X-API-Keyheader middleware, configurable via--api-keyflag orServerConfig.35 unit tests with mocked MemoryClient covering all endpoints, auth middleware, and request validation.
Key Design Decisions
from_domain()classmethods — exclude embedding vectors, serialize UUIDs as strings, separate from domain modelsDepends(get_memory_client)ServerConfiglives inconfig/settings.py(notserver/config.py) to avoid requiring FastAPI as an import for the core config moduleadd_entityreturns entity + deduplication result sinceLongTermMemory.add_entity()returns a tupleStats
How to Test