Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 2 KB

File metadata and controls

48 lines (37 loc) · 2 KB

Refactoring Summary

Changes Made

  1. Created .env.template file - Added a template file for environment variables with the following variables:

    • LITELLM_API_KEY
    • LITELLM_API_URL
    • LITELLM_API_BASE
    • AICHAT_CONFIG_PATH
    • AZURE_SUBSCRIPTION_ID
  2. Updated aichat_config_setup.py:

    • Added python-dotenv import and load_dotenv() call
    • Replaced hardcoded API key with os.getenv("LITELLM_API_KEY")
    • Replaced hardcoded API URL with os.getenv("LITELLM_API_URL", "http://localhost:4141/v1/model/info")
    • Replaced hardcoded API base with os.getenv("LITELLM_API_BASE", "http://localhost:4141")
    • Replaced hardcoded file path with os.getenv("AICHAT_CONFIG_PATH", "./config.yaml")
  3. Updated check_auzre_llm_in_litellm.py:

    • Added python-dotenv import and load_dotenv() call
    • Replaced hardcoded API key with os.getenv("LITELLM_API_KEY")
    • Replaced hardcoded API URL with os.getenv("LITELLM_API_URL", "http://localhost:4141/v1/model/info")
  4. Updated README.md:

    • Added setup instructions for creating and configuring the .env file
    • Added instructions for installing required packages
    • Added instructions for running the scripts
  5. Created requirements.txt:

    • Added python-dotenv, requests, azure-identity, and azure-mgmt-cognitiveservices packages
  6. Created test_env_vars.py:

    • Added a test script to verify that environment variables are loaded correctly

Environment Variables Used

  • LITELLM_API_KEY: The API key for LiteLLM
  • LITELLM_API_URL: The URL for the LiteLLM model info endpoint
  • LITELLM_API_BASE: The base URL for LiteLLM API
  • AICHAT_CONFIG_PATH: The path to the aichat config file
  • AZURE_SUBSCRIPTION_ID: The Azure subscription ID for Azure AI services

Benefits of These Changes

  1. Security: No more hardcoded secrets in the source code
  2. Flexibility: Easy to configure for different environments
  3. Portability: Works across different systems without code changes
  4. Maintainability: Centralized configuration in .env file