Spaces:
Runtime error

File size: 1,623 Bytes
2f91746
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
49
50
51
52
53
54
55
56
57
58
"""
Configuraci贸n del Agente de Creaci贸n de Tutoriales.

Este m贸dulo contiene la configuraci贸n para el agente de creaci贸n de tutoriales.
"""

import os
from typing import Dict, Any

# Configuraci贸n por defecto
DEFAULT_CONFIG: Dict[str, Any] = {
    # Configuraci贸n de OpenAI
    "OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", ""),
    "OPENAI_MODEL": os.environ.get("OPENAI_MODEL", "gpt-4"),
    
    # Configuraci贸n de generaci贸n de tutoriales
    "MAX_TOKENS": 4000,
    "TEMPERATURE": 0.7,
    "TOP_P": 1.0,
    "FREQUENCY_PENALTY": 0.0,
    "PRESENCE_PENALTY": 0.0,
    
    # Configuraci贸n de formato
    "DEFAULT_LANGUAGE": "es",
    "INCLUDE_COMMANDS": True,
    "INCLUDE_CODE_BLOCKS": True,
    "INCLUDE_TROUBLESHOOTING": True,
    
    # Configuraci贸n de logging
    "LOG_LEVEL": "INFO",
}

def get_config() -> Dict[str, Any]:
    """
    Obtiene la configuraci贸n del agente de creaci贸n de tutoriales.
    
    Returns:
        Diccionario con la configuraci贸n.
    """
    config = DEFAULT_CONFIG.copy()
    
    # Sobrescribir con variables de entorno si existen
    for key in config:
        env_value = os.environ.get(key)
        if env_value is not None:
            # Convertir tipos si es necesario
            if isinstance(config[key], int):
                config[key] = int(env_value)
            elif isinstance(config[key], float):
                config[key] = float(env_value)
            elif isinstance(config[key], bool):
                config[key] = env_value.lower() in ("true", "1", "yes")
            else:
                config[key] = env_value
    
    return config