Skip to content

PydanticAI: allow registering Agent/model + improve error message and docs#282

Open
colygon wants to merge 1 commit intoMemoriLabs:mainfrom
colygon:fix/pydanticai-agent-register
Open

PydanticAI: allow registering Agent/model + improve error message and docs#282
colygon wants to merge 1 commit intoMemoriLabs:mainfrom
colygon:fix/pydanticai-agent-register

Conversation

@colygon
Copy link
Contributor

@colygon colygon commented Jan 29, 2026

Fixes #276.

The docs currently show passing a pydantic_ai.Agent into Memori(...).llm.register(...), but the SDK expected an OpenAI-compatible client object (with .chat.completions.create). That mismatch causes a runtime error and blocks first success.

This PR:

  • Unwraps common PydanticAI wrapper shapes (.client or .model.client) to find the underlying OpenAI-compatible client.
  • Improves the error message to be actionable when unwrapping fails.
  • Updates docs to clarify what Memori registers against and shows both options.

Net effect: the docs example works and users get a clear next step when it doesn’t.

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.

[Bug] Pydantic AI support not working as documented

1 participant