Skip to content

Fix OpenAILLM and http_client type #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stellasia
Copy link
Contributor

Description

Fixes #401

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Documentation update
  • Project configuration change

Complexity

Note

Please provide an estimated complexity of this PR of either Low, Medium or High

Complexity:

How Has This Been Tested?

  • Unit tests
  • E2E tests
  • Manual tests

Checklist

The following requirements should have been met (depending on the changes in the branch):

  • Documentation has been updated
  • Unit tests have been updated
  • E2E tests have been updated
  • Examples have been updated
  • New files have copyright header
  • CLA (https://neo4j.com/developer/cla/) has been signed
  • CHANGELOG.md updated if appropriate

@stellasia stellasia requested a review from a team as a code owner August 4, 2025 15:30
Copy link
Contributor

@NathalieCharbel NathalieCharbel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments.

except ImportError:
raise ImportError(
"""Could not import httpx.
Please install it with `pip install httpx."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: there is a missing backtick at the end of the pip command.

if isinstance(http_client, self.httpx.Client)
else (None, http_client)
)
sync_client, async_client = clients
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for extracting and applying http_client is repeated in both OpenAI and AzureOpenAI constructors. this can be part of a utility function that can be called in both places.

@@ -35,6 +36,24 @@ def test_openai_llm_missing_dependency(mock_import: Mock) -> None:
OpenAILLM(model_name="gpt-4o")


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we add more tests for cases like missing http clients, wrong types...?

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.

Unable to specify http_client as a parameter to OpenAILLM
2 participants