Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/artaasd95_chat-bot-rag-showcase.json
T

1 line
18 KiB
JSON

{"repo": "artaasd95/chat-bot-rag-showcase", "files": {"pytest.ini": {"c52fe6c9e365801ecceff45b98922e43be6cd64e": {"t": 1785745384.76327, "n": 2139, "h": "3df6cd6b1ccaa600", "c": "[tool:pytest]\n# Pytest configuration file\n\n# Test discovery\npython_files = test_*.py *_test.py\npython_classes = Test*\npython_functions = test_*\n\n# Test paths\ntestpaths = tests\n\n# Minimum version\nminversion = 7.0\n\n# Add options\naddopts = \n --strict-markers\n --strict-config\n --verbose\n --tb=short\n --color=yes\n --durations=10\n --showlocals\n --disable-warnings\n\n# Markers\nmarkers =\n unit: Unit tests\n integration: Integration tests\n e2e: End-to-end tests\n slow: Slow running tests\n fast: Fast running tests\n auth: Authentication related tests\n chat: Chat functionality tests\n admin: Admin functionality tests\n api: API endpoint tests\n graph: LangGraph and AI component tests\n services: Core services tests\n database: Database related tests\n llm: LLM service tests\n websocket: WebSocket tests\n security: Security related tests\n performance: Performance tests\n\n# Async support\nasyncio_mode = auto\n\n# Coverage\n# Note: Coverage settings can also be in pyproject.toml or .coveragerc\n# These are fallback settings\n# --cov=app\n# --cov-report=term-missing\n# --cov-report=html:htmlcov\n# --cov-report=xml\n# --cov-fail-under=80\n\n# Logging\nlog_cli = true\nlog_cli_level = INFO\nlog_cli_format = %(asctime)s [%(levelname)8s] %(name)s: %(message)s\nlog_cli_date_format = %Y-%m-%d %H:%M:%S\n\n# Warnings\nfilterwarnings =\n ignore::DeprecationWarning\n ignore::PendingDeprecationWarning\n ignore::UserWarning:langchain.*\n ignore::UserWarning:openai.*\n ignore::UserWarning:httpx.*\n\n# Test timeout (in seconds)\ntimeout = 300\n\n# Parallel execution settings (for pytest-xdist)\n# -n auto # Use all available CPUs\n# -n 4 # Use 4 workers\n\n# Environment variables for testing\nenv =\n TESTING = true\n DATABASE_URL = sqlite+aiosqlite:///:memory:\n SECRET_KEY = test-secret-key-for-testing-only\n ALGORITHM = HS256\n ACCESS_TOKEN_EXPIRE_MINUTES = 30\n REFRESH_TOKEN_EXPIRE_DAYS = 7\n LLM_PROVIDER = openai\n OPENAI_API_KEY = test-openai-key\n DEEPSEEK_API_KEY = test-deepseek-key\n REDIS_URL = redis://localhost:6379/1\n CORS_ORIGINS = [\"http://localhost:3000\"]"}, "3fa81ce0511167d4e26a54e18e47b72cb7fb8934": {"t": 1785750890.9875407, "n": 2139, "h": "3df6cd6b1ccaa600", "c": "[tool:pytest]\n# Pytest configuration file\n\n# Test discovery\npython_files = test_*.py *_test.py\npython_classes = Test*\npython_functions = test_*\n\n# Test paths\ntestpaths = tests\n\n# Minimum version\nminversion = 7.0\n\n# Add options\naddopts = \n --strict-markers\n --strict-config\n --verbose\n --tb=short\n --color=yes\n --durations=10\n --showlocals\n --disable-warnings\n\n# Markers\nmarkers =\n unit: Unit tests\n integration: Integration tests\n e2e: End-to-end tests\n slow: Slow running tests\n fast: Fast running tests\n auth: Authentication related tests\n chat: Chat functionality tests\n admin: Admin functionality tests\n api: API endpoint tests\n graph: LangGraph and AI component tests\n services: Core services tests\n database: Database related tests\n llm: LLM service tests\n websocket: WebSocket tests\n security: Security related tests\n performance: Performance tests\n\n# Async support\nasyncio_mode = auto\n\n# Coverage\n# Note: Coverage settings can also be in pyproject.toml or .coveragerc\n# These are fallback settings\n# --cov=app\n# --cov-report=term-missing\n# --cov-report=html:htmlcov\n# --cov-report=xml\n# --cov-fail-under=80\n\n# Logging\nlog_cli = true\nlog_cli_level = INFO\nlog_cli_format = %(asctime)s [%(levelname)8s] %(name)s: %(message)s\nlog_cli_date_format = %Y-%m-%d %H:%M:%S\n\n# Warnings\nfilterwarnings =\n ignore::DeprecationWarning\n ignore::PendingDeprecationWarning\n ignore::UserWarning:langchain.*\n ignore::UserWarning:openai.*\n ignore::UserWarning:httpx.*\n\n# Test timeout (in seconds)\ntimeout = 300\n\n# Parallel execution settings (for pytest-xdist)\n# -n auto # Use all available CPUs\n# -n 4 # Use 4 workers\n\n# Environment variables for testing\nenv =\n TESTING = true\n DATABASE_URL = sqlite+aiosqlite:///:memory:\n SECRET_KEY = test-secret-key-for-testing-only\n ALGORITHM = HS256\n ACCESS_TOKEN_EXPIRE_MINUTES = 30\n REFRESH_TOKEN_EXPIRE_DAYS = 7\n LLM_PROVIDER = openai\n OPENAI_API_KEY = test-openai-key\n DEEPSEEK_API_KEY = test-deepseek-key\n REDIS_URL = redis://localhost:6379/1\n CORS_ORIGINS = [\"http://localhost:3000\"]"}}, "docs/ai/deepseek-integration.md": {"c52fe6c9e365801ecceff45b98922e43be6cd64e": {"t": 1785746504.1068034, "n": 6249, "h": "86797a6358570771", "c": "# DeepSeek Integration Guide\n\nThis guide explains how to use DeepSeek as an alternative LLM provider in the chat bot application.\n\n## Overview\n\nThe application now supports both OpenAI and DeepSeek as LLM providers. The system can automatically detect which provider to use based on available API keys, or you can explicitly configure your preferred provider.\n\n## Features\n\n- **Automatic Provider Detection**: The system automatically uses DeepSeek if a DeepSeek API key is available\n- **Fallback Support**: Falls back to OpenAI if DeepSeek is not available\n- **Explicit Configuration**: You can explicitly set which provider to use\n- **Model Flexibility**: Supports different models for each provider\n\n## Configuration\n\n### Environment Variables\n\nAdd these variables to your `.env` file:\n\n```bash\n# LLM Configuration\nLLM_PROVIDER=deepseek # or \"openai\" for explicit provider selection\nLLM_MODEL=deepseek-chat # or \"gpt-3.5-turbo\" for OpenAI\nLLM_TEMPERATURE=0.7\nLLM_MAX_TOKENS=1000\n\n# DeepSeek Configuration\nDEEPSEEK_API_KEY=your-deepseek-api-key-here\n\n# OpenAI Configuration (fallback)\nOPENAI_API_KEY=your-openai-api-key-here\n```\n\n### Provider Selection Logic\n\nThe system uses the following logic to select a provider:\n\n1. **Explicit Configuration**: If `LLM_PROVIDER` is set and the corresponding API key is available, use that provider\n2. **Auto-Detection**: If no explicit provider is set:\n - Use DeepSeek if `DEEPSEEK_API_KEY` is available and `langchain-deepseek` is installed\n - Fall back to OpenAI if `OPENAI_API_KEY` is available\n3. **Error**: If no valid API key is found, raise an error\n\n## Installation\n\n### Install DeepSeek Package\n\n```bash\npip install langchain-deepseek\n```\n\nOr install all requirements:\n\n```bash\npip install -r requirements.txt\n```\n\n### Get DeepSeek API Key\n\n1. Visit [DeepSeek API](https://api-docs.deepseek.com/)\n2. Create an account and get your API key\n3. Add the API key to your environment variables\n\n## Supported Models\n\n### DeepSeek Models\n\n- `deepseek-chat`: General purpose chat model (recommended)\n- `deepseek-reasoner`: Advanced reasoning model (DeepSeek-R1)\n\n### OpenAI Models (Fallback)\n\n- `gpt-3.5-turbo`: Fast and cost-effective\n- `gpt-4`: More capable but slower and more expensive\n- `gpt-4-turbo`: Latest GPT-4 variant\n\n## Usage Examples\n\n### Using DeepSeek Explicitly\n\n```bash\n# Set environment variables\nexport DEEPSEEK_API_KEY=\"your-deepseek-api-key\"\nexport LLM_PROVIDER=\"deepseek\"\nexport LLM_MODEL=\"deepseek-chat\"\n\n# Start the application\npython -m app.main\n```\n\n### Auto-Detection Mode\n\n```bash\n# Set only the API key, let the system auto-detect\nexport DEEPSEEK_API_KEY=\"your-deepseek-api-key\"\n\n# Start the application\npython -m app.main\n```\n\n### Testing the Integration\n\nUse the provided test script:\n\n```bash\n# Set your API key\nexport DEEPSEEK_API_KEY=\"your-deepseek-api-key\"\n\n# Run the test\npython test_deepseek_integration.py\n```\n\n## Code Examples\n\n### Basic Usage\n\n```python\nfrom app.services.llm import get_llm, generate_llm_response\nfrom langchain_core.messages import HumanMessage\n\n# Get LLM instance (automatically detects provider)\nllm = get_llm()\n\n# Generate response\nmessages = [HumanMessage(content=\"Hello, how are you?\")]\nresult = await generate_llm_response(llm, messages)\nprint(result['response'])\n```\n\n### Provider Detection\n\n```python\nfrom app.services.llm import _determine_provider\n\n# Check which provider will be used\nprovider = _determine_provider()\nprint(f\"Using provider: {provider}\")\n```\n\n## Configuration in Different Environments\n\n### Development\n\n```bash\n# .env.development\nLLM_PROVIDER=deepseek\nDEEPSEEK_API_KEY=your-dev-deepseek-key\nLLM_MODEL=deepseek-chat\nLLM_TEMPERATURE=0.8\n```\n\n### Production\n\n```bash\n# .env.production\nLLM_PROVIDER=deepseek\nDEEPSEEK_API_KEY=your-prod-deepseek-key\nLLM_MODEL=deepseek-chat\nLLM_TEMPERATURE=0.7\nLLM_MAX_TOKENS=2048\n```\n\n### Docker Configuration\n\nUpdate your `docker-compose.yml`:\n\n```yaml\nservices:\n chat:\n environment:\n - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}\n - LLM_PROVIDER=deepseek\n - LLM_MODEL=deepseek-chat\n```\n\n## Troubleshooting\n\n### Common Issues\n\n#### \"langchain-deepseek not installed\"\n\n```bash\npip install langchain-deepseek\n```\n\n#### \"No valid API key found\"\n\nMake sure you have set either `DEEPSEEK_API_KEY` or `OPENAI_API_KEY`:\n\n```bash\nexport DEEPSEEK_API_KEY=\"your-api-key\"\n# or\nexport OPENAI_API_KEY=\"your-api-key\"\n```\n\n#### \"Unsupported LLM provider\"\n\nCheck your `LLM_PROVIDER` setting. Valid values are:\n- `openai`\n- `deepseek`\n\n### Debugging\n\nEnable debug logging to see provider selection:\n\n```bash\nexport LOG_LEVEL=DEBUG\npython -m app.main\n```\n\nYou should see logs like:\n```\nINFO: DeepSeek API key found, using DeepSeek provider\nINFO: Using DeepSeek provider\nINFO: Initializing LLM with model deepseek-chat\n```\n\n## Performance Considerations\n\n### DeepSeek vs OpenAI\n\n| Feature | DeepSeek | OpenAI |\n|---------|----------|--------|\n| Cost | Generally lower | Higher |\n| Speed | Competitive | Fast |\n| Quality | High quality | Industry standard |\n| Reasoning | Excellent (R1 model) | Good |\n\n### Best Practices\n\n1. **Use DeepSeek for cost-sensitive applications**\n2. **Use OpenAI for maximum compatibility**\n3. **Set appropriate temperature values** (0.7 is a good default)\n4. **Monitor token usage** for cost optimization\n5. **Use caching** for repeated queries\n\n## Migration from OpenAI\n\nTo migrate from OpenAI to DeepSeek:\n\n1. **Get DeepSeek API key**\n2. **Install langchain-deepseek**: `pip install langchain-deepseek`\n3. **Update environment variables**:\n ```bash\n DEEPSEEK_API_KEY=your-deepseek-key\n LLM_PROVIDER=deepseek\n LLM_MODEL=deepseek-chat\n ```\n4. **Test the integration** using the test script\n5. **Deploy with new configuration**\n\n## API Compatibility\n\nBoth providers use the same LangChain interface, so your existing code will work without changes. The `generate_llm_response` function works identically with both providers.\n\n## Support\n\nFor issues related to:\n- **DeepSeek API**: Check [DeepSeek documentation](https://api-docs.deepseek.com/)\n- **LangChain integration**: Check [LangChain DeepSeek docs](https://python.langchain.com/docs/integrations/chat/deepseek/)\n- **Application issues**: Check the application logs and test script output"}, "c30c2b4240d93bfe4c0f76903973775333c18aab": {"t": 1785750892.2321744, "n": 6249, "h": "86797a6358570771", "c": "# DeepSeek Integration Guide\n\nThis guide explains how to use DeepSeek as an alternative LLM provider in the chat bot application.\n\n## Overview\n\nThe application now supports both OpenAI and DeepSeek as LLM providers. The system can automatically detect which provider to use based on available API keys, or you can explicitly configure your preferred provider.\n\n## Features\n\n- **Automatic Provider Detection**: The system automatically uses DeepSeek if a DeepSeek API key is available\n- **Fallback Support**: Falls back to OpenAI if DeepSeek is not available\n- **Explicit Configuration**: You can explicitly set which provider to use\n- **Model Flexibility**: Supports different models for each provider\n\n## Configuration\n\n### Environment Variables\n\nAdd these variables to your `.env` file:\n\n```bash\n# LLM Configuration\nLLM_PROVIDER=deepseek # or \"openai\" for explicit provider selection\nLLM_MODEL=deepseek-chat # or \"gpt-3.5-turbo\" for OpenAI\nLLM_TEMPERATURE=0.7\nLLM_MAX_TOKENS=1000\n\n# DeepSeek Configuration\nDEEPSEEK_API_KEY=your-deepseek-api-key-here\n\n# OpenAI Configuration (fallback)\nOPENAI_API_KEY=your-openai-api-key-here\n```\n\n### Provider Selection Logic\n\nThe system uses the following logic to select a provider:\n\n1. **Explicit Configuration**: If `LLM_PROVIDER` is set and the corresponding API key is available, use that provider\n2. **Auto-Detection**: If no explicit provider is set:\n - Use DeepSeek if `DEEPSEEK_API_KEY` is available and `langchain-deepseek` is installed\n - Fall back to OpenAI if `OPENAI_API_KEY` is available\n3. **Error**: If no valid API key is found, raise an error\n\n## Installation\n\n### Install DeepSeek Package\n\n```bash\npip install langchain-deepseek\n```\n\nOr install all requirements:\n\n```bash\npip install -r requirements.txt\n```\n\n### Get DeepSeek API Key\n\n1. Visit [DeepSeek API](https://api-docs.deepseek.com/)\n2. Create an account and get your API key\n3. Add the API key to your environment variables\n\n## Supported Models\n\n### DeepSeek Models\n\n- `deepseek-chat`: General purpose chat model (recommended)\n- `deepseek-reasoner`: Advanced reasoning model (DeepSeek-R1)\n\n### OpenAI Models (Fallback)\n\n- `gpt-3.5-turbo`: Fast and cost-effective\n- `gpt-4`: More capable but slower and more expensive\n- `gpt-4-turbo`: Latest GPT-4 variant\n\n## Usage Examples\n\n### Using DeepSeek Explicitly\n\n```bash\n# Set environment variables\nexport DEEPSEEK_API_KEY=\"your-deepseek-api-key\"\nexport LLM_PROVIDER=\"deepseek\"\nexport LLM_MODEL=\"deepseek-chat\"\n\n# Start the application\npython -m app.main\n```\n\n### Auto-Detection Mode\n\n```bash\n# Set only the API key, let the system auto-detect\nexport DEEPSEEK_API_KEY=\"your-deepseek-api-key\"\n\n# Start the application\npython -m app.main\n```\n\n### Testing the Integration\n\nUse the provided test script:\n\n```bash\n# Set your API key\nexport DEEPSEEK_API_KEY=\"your-deepseek-api-key\"\n\n# Run the test\npython test_deepseek_integration.py\n```\n\n## Code Examples\n\n### Basic Usage\n\n```python\nfrom app.services.llm import get_llm, generate_llm_response\nfrom langchain_core.messages import HumanMessage\n\n# Get LLM instance (automatically detects provider)\nllm = get_llm()\n\n# Generate response\nmessages = [HumanMessage(content=\"Hello, how are you?\")]\nresult = await generate_llm_response(llm, messages)\nprint(result['response'])\n```\n\n### Provider Detection\n\n```python\nfrom app.services.llm import _determine_provider\n\n# Check which provider will be used\nprovider = _determine_provider()\nprint(f\"Using provider: {provider}\")\n```\n\n## Configuration in Different Environments\n\n### Development\n\n```bash\n# .env.development\nLLM_PROVIDER=deepseek\nDEEPSEEK_API_KEY=your-dev-deepseek-key\nLLM_MODEL=deepseek-chat\nLLM_TEMPERATURE=0.8\n```\n\n### Production\n\n```bash\n# .env.production\nLLM_PROVIDER=deepseek\nDEEPSEEK_API_KEY=your-prod-deepseek-key\nLLM_MODEL=deepseek-chat\nLLM_TEMPERATURE=0.7\nLLM_MAX_TOKENS=2048\n```\n\n### Docker Configuration\n\nUpdate your `docker-compose.yml`:\n\n```yaml\nservices:\n chat:\n environment:\n - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}\n - LLM_PROVIDER=deepseek\n - LLM_MODEL=deepseek-chat\n```\n\n## Troubleshooting\n\n### Common Issues\n\n#### \"langchain-deepseek not installed\"\n\n```bash\npip install langchain-deepseek\n```\n\n#### \"No valid API key found\"\n\nMake sure you have set either `DEEPSEEK_API_KEY` or `OPENAI_API_KEY`:\n\n```bash\nexport DEEPSEEK_API_KEY=\"your-api-key\"\n# or\nexport OPENAI_API_KEY=\"your-api-key\"\n```\n\n#### \"Unsupported LLM provider\"\n\nCheck your `LLM_PROVIDER` setting. Valid values are:\n- `openai`\n- `deepseek`\n\n### Debugging\n\nEnable debug logging to see provider selection:\n\n```bash\nexport LOG_LEVEL=DEBUG\npython -m app.main\n```\n\nYou should see logs like:\n```\nINFO: DeepSeek API key found, using DeepSeek provider\nINFO: Using DeepSeek provider\nINFO: Initializing LLM with model deepseek-chat\n```\n\n## Performance Considerations\n\n### DeepSeek vs OpenAI\n\n| Feature | DeepSeek | OpenAI |\n|---------|----------|--------|\n| Cost | Generally lower | Higher |\n| Speed | Competitive | Fast |\n| Quality | High quality | Industry standard |\n| Reasoning | Excellent (R1 model) | Good |\n\n### Best Practices\n\n1. **Use DeepSeek for cost-sensitive applications**\n2. **Use OpenAI for maximum compatibility**\n3. **Set appropriate temperature values** (0.7 is a good default)\n4. **Monitor token usage** for cost optimization\n5. **Use caching** for repeated queries\n\n## Migration from OpenAI\n\nTo migrate from OpenAI to DeepSeek:\n\n1. **Get DeepSeek API key**\n2. **Install langchain-deepseek**: `pip install langchain-deepseek`\n3. **Update environment variables**:\n ```bash\n DEEPSEEK_API_KEY=your-deepseek-key\n LLM_PROVIDER=deepseek\n LLM_MODEL=deepseek-chat\n ```\n4. **Test the integration** using the test script\n5. **Deploy with new configuration**\n\n## API Compatibility\n\nBoth providers use the same LangChain interface, so your existing code will work without changes. The `generate_llm_response` function works identically with both providers.\n\n## Support\n\nFor issues related to:\n- **DeepSeek API**: Check [DeepSeek documentation](https://api-docs.deepseek.com/)\n- **LangChain integration**: Check [LangChain DeepSeek docs](https://python.langchain.com/docs/integrations/chat/deepseek/)\n- **Application issues**: Check the application logs and test script output"}}}}