Skip to content

Conversation

@supmo668
Copy link
Contributor

Description

This PR fixes issue #1006 where OpenAIRerankerClient failed to properly support AzureOpenAILLMClient.

Problem

The OpenAIRerankerClient only checked for OpenAIClient instances when unwrapping the client, causing AzureOpenAILLMClient to be passed through without unwrapping. This resulted in:

AttributeError: 'AzureOpenAILLMClient' object has no attribute 'chat'

Solution

Updated the type detection to use BaseOpenAIClient which is the parent class of both OpenAIClient and AzureOpenAILLMClient. This allows both client types to be properly unwrapped to their underlying AsyncOpenAI or AsyncAzureOpenAI instances.

Changes

  • Modified graphiti_core/cross_encoder/openai_reranker_client.py:
    • Added import for BaseOpenAIClient
    • Updated type hint from OpenAIClient to BaseOpenAIClient
    • Changed isinstance check to use BaseOpenAIClient
  • Added comprehensive test coverage in tests/cross_encoder/test_openai_reranker_client.py:

Testing

All tests pass:

✓ 5 tests in test_openai_reranker_client.py
✓ 25 tests in tests/cross_encoder/ (full suite)

Fixes #1006

- Updated type detection to use BaseOpenAIClient instead of OpenAIClient
- This allows both OpenAIClient and AzureOpenAILLMClient to be properly unwrapped
- Added comprehensive test coverage for all client types
- Fixes getzep#1006
@danielchalef
Copy link
Member

danielchalef commented Nov 18, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@supmo668
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@supmo668 supmo668 closed this Nov 19, 2025
@supmo668 supmo668 reopened this Nov 19, 2025
@getzep getzep locked and limited conversation to collaborators Nov 19, 2025
Fixes pyright type checking error by declaring the client attribute
in the base class. All concrete implementations (OpenAIClient,
AzureOpenAILLMClient, OpenAIGenericClient) initialize this attribute,
and it needs to be accessible for type checking in OpenAIRerankerClient.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] OpenAIRerankerClient does not support AzureOpenAILLMClient

2 participants