All files / src/config ai.config.ts

0% Statements 0/3
100% Branches 0/0
0% Functions 0/1
0% Lines 0/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48                                                                                               
import { registerAs } from '@nestjs/config';
 
export const AiConfig = registerAs('ai', () => ({
  huggingface: {
    apiKey: process.env.HUGGINGFACE_API_KEY,
    baseUrl: 'https://api-inference.huggingface.co',
    models: {
      embeddings: 'sentence-transformers/all-MiniLM-L6-v2',
      imageClassification: 'microsoft/resnet-50',
      textClassification: 'distilbert-base-uncased',
      zeroShotClassification: 'facebook/bart-large-mnli',
      clipModel: 'openai/clip-vit-large-patch14',
    },
  },
  openrouter: {
    apiKey: process.env.OPENROUTER_API_KEY,
    baseUrl: 'https://openrouter.ai/api/v1',
    models: {
      chat: 'anthropic/claude-3-sonnet',
      fallback: 'openai/gpt-4-turbo',
    },
  },
  anthropic: {
    apiKey: process.env.ANTHROPIC_API_KEY,
    baseUrl: 'https://api.anthropic.com',
    model: 'claude-3-sonnet-20240229',
  },
  caching: {
    embeddingsTtl: 86400, // 24 hours
    recommendationsTtl: 3600, // 1 hour
    chatResponsesTtl: 1800, // 30 minutes
  },
  rateLimits: {
    huggingface: {
      requestsPerMinute: 100,
      requestsPerDay: 10000,
    },
    openrouter: {
      requestsPerMinute: 60,
      requestsPerDay: 5000,
    },
    anthropic: {
      requestsPerMinute: 50,
      requestsPerDay: 3000,
    },
  },
}));