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

[Bug] Passing the api_key to OpenAIEmbedder does not work #2207

Open
kidrahdev opened this issue Feb 23, 2025 · 2 comments
Open

[Bug] Passing the api_key to OpenAIEmbedder does not work #2207

kidrahdev opened this issue Feb 23, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@kidrahdev
Copy link

Description

Passing the api_key to OpenAIEmbedder does not work

Steps to Reproduce

OpenAIEmbedder(api_key="<api_key>")

Agent Configuration (if applicable)

KnowledgeBase with pgVector

Expected Behavior

What did you expect to happen?
It should use the api_key passed as parameter, instead of depending on env variable

Actual Behavior

What actually happened instead?
It throws an error that api_key is not set

Screenshots or Logs (if applicable)

UserWarning: Failed to load OpenAIEmbeddings: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable. Falling back to default <class 'chonkie.embeddings.openai.OpenAIEmbeddings'> model

Environment

  • OS: Fedora 41
  • Browser (if relevant): (e.g. Chrome 108, Firefox 107)
  • Agno Version: 1.1.4
  • External Dependency Versions: OpenAI - 1.64.0
  • Additional Environment Details: Python 3.13)

Possible Solutions (optional)

Suggest any ideas you might have to fix or address the issue.

Additional Context

Add any other context or details about the problem here.

@kidrahdev kidrahdev added the bug Something isn't working label Feb 23, 2025
@mishramonalisha76
Copy link
Contributor

Hi @kidrahdev , Thanks for reaching out. Unfortunately we are not able to replicate the issue on our end. Can you please confirm once that you have not set your OPENAI_API_KEY to empty or something else?

@kidrah-bhq
Copy link

I can confirm that, if I set it to env variables my code works but if I don't set anything and pass the same key as a parameter the above error is thrown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants