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

chore(llm): fix azure token provider signature #810

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

mspronesti
Copy link
Contributor

@mspronesti mspronesti commented Dec 10, 2023

Hi @gventuri, this PR introduces just a minor fix to the signature of the azure_ad_token_provider parameter.

Summary by CodeRabbit

  • Refactor
    • Enhanced the authentication mechanism for Azure OpenAI integration by allowing a callable to provide the access token dynamically.

Copy link
Contributor

coderabbitai bot commented Dec 10, 2023

Walkthrough

The AzureOpenAI class has been updated to enhance its authentication mechanism. Instead of directly assigning a token string or None to the azure_ad_token_provider attribute, it now accepts a function that, when called, returns a token string. This change allows for more dynamic and secure token handling, such as generating a fresh token on each call.

Changes

File Path Change Summary
pandasai/llm/azure_openai.py Modified azure_ad_token_provider to accept a callable returning a string instead of a string or None.

🐇✨
To code, to code, a change we weave,
A token's dance, in code we believe.
With functions so spry, our secrets we keep,
In Python's embrace, our security leaps. 🌟🔐
🐇✨

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

@mspronesti mspronesti marked this pull request as ready for review December 10, 2023 23:16
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 250c5fe and 7e91c2c.
Files selected for processing (1)
  • pandasai/llm/azure_openai.py (2 hunks)
Additional comments: 1
pandasai/llm/azure_openai.py (1)
  • 12-18: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [152-152]

The _client_params method should be reviewed to ensure that it correctly handles the azure_ad_token_provider now that it is a callable. If the callable needs to be invoked to get the token, this method should be updated accordingly.

pandasai/llm/azure_openai.py Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (250c5fe) 85.08% compared to head (297b3a9) 85.08%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #810   +/-   ##
=======================================
  Coverage   85.08%   85.08%           
=======================================
  Files          88       88           
  Lines        3828     3828           
=======================================
  Hits         3257     3257           
  Misses        571      571           

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

@mspronesti mspronesti force-pushed the azure-token-signature branch from 7e91c2c to 297b3a9 Compare December 10, 2023 23:23
@gventuri
Copy link
Collaborator

@mspronesti thanks a lot, merging :)

@gventuri gventuri merged commit 2af1928 into sinaptik-ai:main Dec 13, 2023
9 checks passed
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