HonestAI / CONDA_SETUP_GUIDE.md
JatsTheAIGen's picture
Integrate Novita AI as exclusive inference provider - Add Novita AI API integration with DeepSeek-R1-Distill-Qwen-7B model - Remove all local model dependencies - Optimize token allocation for user inputs and context - Add Anaconda environment setup files - Add comprehensive test scripts and documentation
927854c

Anaconda Environment Setup Guide

Quick Start

1. Create Conda Environment

# Create environment from environment.yml
conda env create -f environment.yml

# OR create manually
conda create -n research-ai-assistant python=3.10
conda activate research-ai-assistant

2. Activate Environment

# Windows
conda activate research-ai-assistant

# Linux/Mac
source activate research-ai-assistant
# OR
conda activate research-ai-assistant

3. Install Dependencies

# Install from requirements.txt
pip install -r requirements.txt

# OR install openai package directly
pip install openai>=1.0.0

4. Set Environment Variables

# Windows (PowerShell)
$env:NOVITA_API_KEY="your_api_key_here"
$env:NOVITA_BASE_URL="https://api.novita.ai/dedicated/v1/openai"
$env:NOVITA_MODEL="deepseek-ai/DeepSeek-R1-Distill-Qwen-7B:de-1a706eeafbf3ebc2"

# Windows (CMD)
set NOVITA_API_KEY=your_api_key_here
set NOVITA_BASE_URL=https://api.novita.ai/dedicated/v1/openai
set NOVITA_MODEL=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B:de-1a706eeafbf3ebc2

# Linux/Mac
export NOVITA_API_KEY=your_api_key_here
export NOVITA_BASE_URL=https://api.novita.ai/dedicated/v1/openai
export NOVITA_MODEL=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B:de-1a706eeafbf3ebc2

5. Test Connection

# Run the test script
python test_novita_connection.py

# OR use the batch script (Windows)
test_novita_conda.bat

Using Anaconda Prompt (Windows)

  1. Open Anaconda Prompt (search for "Anaconda Prompt" in Start menu)

  2. Navigate to project directory:

    cd C:\Users\85jat\GenAI_work_V2\Prototyping\Research_AI_Assistant_V2\Research_AI_Assistant_API
    
  3. Create/activate environment:

    conda env create -f environment.yml
    conda activate research-ai-assistant
    
  4. Install dependencies:

    pip install -r requirements.txt
    
  5. Set environment variables:

    set NOVITA_API_KEY=your_api_key_here
    set NOVITA_BASE_URL=https://api.novita.ai/dedicated/v1/openai
    set NOVITA_MODEL=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B:de-1a706eeafbf3ebc2
    
  6. Run test:

    python test_novita_connection.py
    

Environment Management

List environments

conda env list

Activate environment

conda activate research-ai-assistant

Deactivate environment

conda deactivate

Remove environment (if needed)

conda env remove -n research-ai-assistant

Update environment

conda env update -f environment.yml --prune

Verification

After setup, verify everything works:

# Activate environment
conda activate research-ai-assistant

# Check Python
python --version

# Check openai package
python -c "import openai; print(openai.__version__)"

# Check configuration
python -c "from src.config import get_settings; s = get_settings(); print(f'API Key: {s.novita_api_key[:10]}...' if s.novita_api_key else 'API Key: NOT SET')"

# Run full test
python test_novita_connection.py

Troubleshooting

Conda command not found

  • Windows: Open Anaconda Prompt instead of regular PowerShell/CMD
  • Linux/Mac: Ensure conda is initialized: conda init bash or conda init zsh

Environment activation fails

  • Try: conda activate base first, then conda activate research-ai-assistant
  • On Windows: Use Anaconda Prompt instead of regular terminal

Package installation fails

  • Update conda: conda update conda
  • Update pip: pip install --upgrade pip
  • Try installing from conda-forge: conda install -c conda-forge openai

Import errors

  • Ensure environment is activated: conda activate research-ai-assistant
  • Verify package is installed: pip list | grep openai
  • Reinstall if needed: pip install --force-reinstall openai>=1.0.0