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

Support API key in config for LiteLLM #1747

Closed
wants to merge 1 commit into from

Conversation

Devanshusp
Copy link

Added support for specifying the API key via the configuration object (self.config.api_key) instead of relying solely on environment variables. This change provides more flexibility in managing API keys.

Description

This update adds the ability to set the API key directly in the configuration object (self.config.api_key), instead of being limited to using environment variables. This enhancement offers more flexibility for developers by allowing API keys to be managed within their application's configuration files. This change is especially beneficial for those who prefer or require configuration-based management for sensitive information.

Fixes #1746

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

The changes were tested by updating the configuration object to include the API key (self.config.api_key) and verifying that the application correctly uses this key for API calls.

  • Unit Test
  • Test Script

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

Added support for specifying the API key via the configuration object (`self.config.api_key`) instead of relying solely on environment variables. This change provides more flexibility in managing API keys.
@CLAassistant
Copy link

CLAassistant commented Aug 25, 2024

CLA assistant check
All committers have signed the CLA.

@Dev-Khant
Copy link
Collaborator

Hey @Devanshusp you will also have to make change in mem0/llms/litellm.py where api_key can either be accepted from config or from env variables.

@Dev-Khant
Copy link
Collaborator

Hey @Devanshusp Are you working on this? I have left a comment.

@memsranga
Copy link

This should be good to go.
If there is an api_key provided explicitly in config, it will go as api_key param to litellm. Else the provider keys from environment variables do go anyway.

@memsranga memsranga mentioned this pull request Sep 17, 2024
18 tasks
@Dev-Khant
Copy link
Collaborator

@Devanshusp, I am closing this issue as tests are failing, and it has also been stale. Please feel free to open a new PR.

@Dev-Khant Dev-Khant closed this Oct 8, 2024
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.

Add support for API key configuration in LiteLLM
4 participants