Download agents/tutorial_agent/config.py from gusmoon/TutorIA: direct link, hf CLI and curl.
- Browser
- Download file 1.62 kB
-
https://huggingface.co/spaces/gusmoon/TutorIA/resolve/main/agents/tutorial_agent/config.py
- Command line
-
hf download hf://spaces/gusmoon/TutorIA/agents/tutorial_agent/config.py
-
curl -L -o config.py https://huggingface.co/spaces/gusmoon/TutorIA/resolve/main/agents/tutorial_agent/config.py
1.62 kB
| """ | |
| 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 | |