Skip to content

fix(openai-sdk): use AsyncSupermemory and correct client API calls#1063

Open
icyzh wants to merge 1 commit into
supermemoryai:mainfrom
icyzh:fix/openai-sdk-client-init-and-serialization
Open

fix(openai-sdk): use AsyncSupermemory and correct client API calls#1063
icyzh wants to merge 1 commit into
supermemoryai:mainfrom
icyzh:fix/openai-sdk-client-init-and-serialization

Conversation

@icyzh

@icyzh icyzh commented Jun 8, 2026

Copy link
Copy Markdown

The openai-sdk SupermemoryTools class initializes a sync Supermemory() client but all its methods are async and await it TypeError at runtime. On top of that, every .add() call targets the top-level client, but AsyncSupermemory exposes add() on the .memories sub-resource (client.memories.add(...)). Confirmed locally with the installed SDK:

`client.add(...)` raises `AttributeError: 'AsyncSupermemory' object has no attribute 'add'`
`client.memories.add(...)` works correctly
`client.memories` exists, `client` does not have `add`

That missing method means every memory-add call silently hits the except Exception handler and returns {"success": false, "error": "..."}. Even if it did reach the API, the raw Pydantic response gets fed to json.dumps() without .model_dump() another TypeError.

This rewrites the client init to use AsyncSupermemory, changes all .add() calls to .memories.add(), and calls .model_dump() on Pydantic responses before serialization. Test imports are also fixed ,the first fallback referenced a non-existent package name (supermemory_openai_sdk) and the second used a wrong module path.

@graphite-app graphite-app Bot requested a review from Dhravya June 8, 2026 04:38
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.

1 participant