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

Update Model Client Docs to Mention API Key from Environment Variables #5515

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

victordibia
Copy link
Collaborator

Adds the following blurb to the model clients docs

API Keys From Environment Variables

In the examples above, we show that you can provide the API key through the api_key argument. Importantly, the OpenAI and Azure OpenAI clients use the openai package, which will automatically read an api key from the environment variable if one is not provided.

  • For OpenAI, you can set the OPENAI_API_KEY environment variable.
  • For Azure OpenAI, you can set the AZURE_OPENAI_API_KEY environment variable.

This is a good practice to explore, as it avoids including sensitive api keys in your code.

Why are these changes needed?

Related issue number

Checks

Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.21%. Comparing base (676b611) to head (4492df3).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5515       +/-   ##
===========================================
- Coverage   78.35%   60.21%   -18.15%     
===========================================
  Files         167      167               
  Lines        9926     9926               
===========================================
- Hits         7778     5977     -1801     
- Misses       2148     3949     +1801     
Flag Coverage Δ
unittests 60.21% <ø> (-18.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@victordibia victordibia requested a review from ekzhu February 12, 2025 21:01
@victordibia victordibia merged commit 559aea9 into main Feb 12, 2025
52 checks passed
@victordibia victordibia deleted the api_key_notes_model_client branch February 12, 2025 21:59
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