File size: 1,378 Bytes
bef7112
877c261
 
 
 
bef7112
 
 
 
 
 
 
2ec02f9
bef7112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2eb0f5b
bef7112
 
 
 
 
589ea23
 
ff25973
589ea23
bef7112
 
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
import os
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()

class Config:
    UPLOAD_FOLDER = 'output'
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-key-123'
    MAX_RETRIES = 3
    INITIAL_DELAY = 1
    BACKOFF_FACTOR = 2
    AI_PROVIDER = os.getenv('AI_PROVIDER', 'g4f')  # Options: g4f, huggingface, together, openai
    
    AI_PROVIDER_CONFIG = {
        'g4f': {
            # g4f specific configuration
        },
        'huggingface': {
            'api_key': os.getenv('HUGGINGFACE_API_KEY'),
            'max_tokens': 1000,
            'temperature': 0.7
        },
        'together': {
            'api_key': os.getenv('TOGETHER_API_KEY'),
            'max_tokens': 1000,
            'temperature': 0.7
        },
         'openai': {
            'api_key': os.getenv('OPENAI_API_KEY'),
            'organization': os.getenv('OPENAI_ORG_ID'),
            'base_url': os.getenv('OPENAI_BASE_URL', "https://christian-heidie-randai-0573d5c0.koyeb.app/v1"),  # Default OpenAI endpoint
            'max_tokens': 1000,
            'temperature': 0.7,
            'top_p': 0.9,
            'frequency_penalty': 0,
            'presence_penalty': 0
        },
            'g4f-api': {
            'base_url': 'https://christian-heidie-randai-0573d5c0.koyeb.app/v1',
            'default_model': 'gpt-4o-mini'
        }
    }