Skip to content

Conversation

@harshalmore31
Copy link
Collaborator

This pull request improves the detection and registration of OpenAI and AzureOpenAI clients within the Memori system. The main change updates the client detection logic to recognize all OpenAI-related modules, including AzureOpenAI, and adds a comprehensive test suite to ensure correct behavior and prevent false positives with unrelated clients.

Client detection improvements:

  • Updated the registration logic in memori/llm/_clients.py so that the OpenAi client is registered for any client whose type's module path starts with "openai", rather than matching exactly "openai". This allows AzureOpenAI (whose module is "openai.lib.azure") to be detected and registered properly.

Testing enhancements:

  • Added a new test suite in tests/llm/test_llm_azure_openai.py that:
    • Verifies correct module path detection for OpenAI and AzureOpenAI classes.
    • Ensures AzureOpenAI inherits from OpenAI and has the required attributes.
    • Confirms that the Memori registry correctly detects and registers both OpenAI and AzureOpenAI clients, and does not falsely detect unrelated clients (such as Anthropic, Google, or langchain_openai).
    • Tests that the OpenAi handler properly wraps required methods for both OpenAI and AzureOpenAI clients.
    • Checks that only modules starting with "openai" are matched, preventing false positives.

@harshalmore31 harshalmore31 marked this pull request as ready for review December 29, 2025 16:48
@devwdave devwdave merged commit 8c4f2da into MemoriLabs:main Jan 5, 2026
6 checks passed
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