Skip to content
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

Make OPENAI_API_KEY not necessary for Azure OpenAI #137

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

SjoerdGn
Copy link

The current setup still requires you to set any OPENAI_API_KEY in the environment variables when using Azure OpenAI, although it is not used. This code removes this requirement.

@SjoerdGn SjoerdGn requested review from vinid and mertyg as code owners March 3, 2025 12:44
Copy link
Collaborator

@vinid vinid left a comment

Choose a reason for hiding this comment

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

Thanks so much for opening this PR. I understand it's kind of a pain point.

Is there any reason to not do this with the new experimental engine? they should support Azure since they are based on litellm. Let me know!

)
else:
raise ValueError("Invalid base URL provided. Please use the default OLLAMA base URL or None.")
if not azure_openai:
Copy link
Collaborator

@vinid vinid Mar 3, 2025

Choose a reason for hiding this comment

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

This is now getting a bit messy, a possible way of cleaning this up is making a create_client factory that depends on a type in the input client (which defaults to openai).

So something like

__init__(..., client_type: str ...):

self.client = _factory_client_openai(client_type)

and have the checks in the factored classes

any thoughts?

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.

3 participants