Untitled

 avatar
unknown
plain_text
10 days ago
6.8 kB
13
No Index
@echo off
setlocal enabledelayedexpansion

echo ======================================
echo LiteLLM Environment Setup
echo ======================================
echo This script will:
echo 1. Check if Git exists and install if needed
echo 2. Clone the LiteLLM repository
echo 3. Modify requirements.txt to remove uvloop
echo 4. Install DSPy and other dependencies
echo 5. Create necessary text files for configuration
echo ======================================
echo.

:: Step 1: Check if Git is already installed
echo [Step 1/9] Checking if Git is installed...
where git >nul 2>nul
if %ERRORLEVEL% EQU 0 (
    echo SUCCESS: Git is already installed.
    for /f "tokens=*" %%a in ('git --version') do echo Detected: %%a
) else (
    echo Git not found. Starting installation...

    :: Create temp directory for downloads
    if not exist "%TEMP%\litellm_setup" mkdir "%TEMP%\litellm_setup"

    :: Set Git version to download
    set "GIT_VERSION=2.43.0"
    set "GIT_INSTALLER=Git-%GIT_VERSION%-64-bit.exe"
    set "GIT_URL=https://github.com/git-for-windows/git/releases/download/v%GIT_VERSION%.windows.1/%GIT_INSTALLER%"

    echo Downloading Git installer...
    powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%GIT_URL%' -OutFile '%TEMP%\litellm_setup\%GIT_INSTALLER%'}"

    if not exist "%TEMP%\litellm_setup\%GIT_INSTALLER%" (
        echo ERROR: Failed to download Git installer. Please check your internet connection.
        echo You can manually download Git from https://git-scm.com/download/win
        pause
        goto :eof
    )

    :: Install Git silently with default options
    echo Installing Git...
    start /wait "" "%TEMP%\litellm_setup\%GIT_INSTALLER%" /VERYSILENT /NORESTART

    :: Verify Git installation
    where git >nul 2>nul
    if %ERRORLEVEL% NEQ 0 (
        echo ERROR: Git installation may have failed. Please try installing manually.
        echo Visit https://git-scm.com/download/win
        pause
        goto :eof
    )

    echo SUCCESS: Git installed successfully.
    for /f "tokens=*" %%a in ('git --version') do echo Version: %%a
)

echo.
echo [Step 2/9] Cloning the LiteLLM repository...
if exist "litellm" (
    echo WARNING: LiteLLM directory already exists. Skipping clone.
) else (
    git clone https://github.com/BerriAI/litellm
    if %ERRORLEVEL% NEQ 0 (
        echo ERROR: Failed to clone the LiteLLM repository.
        pause
        goto :eof
    )
    echo SUCCESS: LiteLLM repository cloned successfully.
)

echo.
echo [Step 3/9] Entering LiteLLM directory...
cd litellm
if %ERRORLEVEL% NEQ 0 (
    echo ERROR: Failed to enter the LiteLLM directory.
    pause
    goto :eof
)
echo SUCCESS: Now in LiteLLM directory.

echo.
echo [Step 4/9] Checking requirements.txt for uvloop...
if not exist "requirements.txt" (
    echo ERROR: requirements.txt not found in the LiteLLM directory.
    pause
    goto :eof
)

:: Create a temporary file without the uvloop line
echo Creating temporary requirements file without uvloop...
type nul > temp_requirements.txt
for /f "tokens=*" %%a in (requirements.txt) do (
    echo %%a | findstr /i /c:"uvloop" > nul
    if !ERRORLEVEL! NEQ 0 (
        echo %%a >> temp_requirements.txt
    ) else (
        echo Removing line: %%a
    )
)

:: Replace the original file
echo Replacing requirements.txt...
move /y temp_requirements.txt requirements.txt
echo SUCCESS: Removed uvloop from requirements.txt.

echo.
echo [Step 5/9] Installing DSPy from GitHub...
pip install git+https://github.com/stanfordnlp/dspy.git
if %ERRORLEVEL% NEQ 0 (
    echo WARNING: There might have been issues installing DSPy. Please check the output above.
) else (
    echo SUCCESS: DSPy installed successfully.
)

echo.
echo [Step 6/9] Installing requirements from requirements.txt...
pip install -r requirements.txt
if %ERRORLEVEL% NEQ 0 (
    echo WARNING: There might have been issues installing the requirements. Please check the output above.
) else (
    echo SUCCESS: Requirements installed successfully.
)

echo.
echo [Step 7/9] Going back to parent directory...
cd ..
if %ERRORLEVEL% NEQ 0 (
    echo ERROR: Failed to go back to parent directory.
    pause
    goto :eof
)
echo SUCCESS: Now back in parent directory.

echo.
echo [Step 8/9] Creating necessary text files for configuration...

:: Create GeminiKeys.txt (empty for user to fill in)
echo Creating GeminiKeys.txt...
type nul > GeminiKeys.txt
echo SUCCESS: Created GeminiKeys.txt (please add your API keys)

:: Create GeminiModels.txt with the specific models
echo Creating GeminiModels.txt with predefined models...
(
echo Gemini 2.5 Pro Experimental 2025-03-25;gemini/gemini-2.5-pro-exp-03-25
echo Gemini 2.0 Pro Experimental;gemini/gemini-2.0-pro-exp
echo Gemini 2.0 Flash;gemini/gemini-2.0-flash
echo Gemini 2.0 Flash Thinking Experimental 2025-01-21;gemini/gemini-2.0-flash-thinking-exp-01-21
echo Gemini 2.0 Flash Thinking Experimental 2024-12-19;gemini/gemini-2.0-flash-thinking-exp-1219
echo Gemini Experimental 2024-12-06;gemini/gemini-exp-1206
echo Gemini Experimental 2024-11-21;gemini/gemini-exp-1121
echo Gemini Experimental 2024-11-14;gemini/gemini-exp-1114
echo Gemini 1.5 Pro;gemini/gemini-1.5-pro
) > GeminiModels.txt
echo SUCCESS: Created GeminiModels.txt with predefined models

:: Create OpenRouterKeys.txt (empty for user to fill in)
echo Creating OpenRouterKeys.txt...
type nul > OpenRouterKeys.txt
echo SUCCESS: Created OpenRouterKeys.txt (please add your API keys)

:: Create OpenRouterModels.txt with the specific models
echo Creating OpenRouterModels.txt with predefined models...
(
echo DeepSeek R1;deepseek/deepseek-r1:free
echo DeepSeek V3 0324;deepseek-chat-v3-0324:free
echo DeepSeek R1 Zero;deepseek/deepseek-r1-zero:free
echo DeepSeek V3 Base;deepseek/deepseek-v3-base:free
echo Quasar Alpha;openrouter/quasar-alpha
echo Llama 4 Maverick;meta-llama/llama-4-maverick:free
) > OpenRouterModels.txt
echo SUCCESS: Created OpenRouterModels.txt with predefined models

echo.
echo [Step 9/9] Setup complete!
echo ======================================
echo LiteLLM has been set up successfully!
echo.
echo The following files were created:
echo - GeminiKeys.txt (empty - please add your API keys)
echo - GeminiModels.txt (with 9 predefined Gemini models)
echo - OpenRouterKeys.txt (empty - please add your API keys)
echo - OpenRouterModels.txt (with 4 predefined DeepSeek models)
echo.
echo Please add your API keys to the key files.
echo Then, run generate_config.bat to create your configuration.
echo ======================================

pause 
Editor is loading...
Leave a Comment