Edurag_beta / app /config.py
Nugh75's picture
update ip
03e1062
raw
history blame
1.65 kB
import os
from dotenv import load_dotenv
from enum import Enum
from openai import OpenAI
from pathlib import Path
# Carica le variabili d'ambiente dal file .env
load_dotenv()
# Configurazione del modello
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
if not OPENAI_API_KEY:
raise ValueError("OPENAI_API_KEY non trovata. Verifica il file .env")
class LLMType(Enum):
OPENAI_GPT_4O_MINI = "openai - GPT-4o-mini"
LOCAL_QWEN = "local - Qwen 7B"
LOCAL_PHI = "local - Phi-3 Mini"
# Configurazione modelli
LLM_CONFIGS = {
LLMType.OPENAI_GPT_4O_MINI: {
"client": lambda: OpenAI(api_key=OPENAI_API_KEY),
"model": "gpt-4o-mini",
"base_url": None
},
LLMType.LOCAL_QWEN: {
"client": lambda: OpenAI(base_url="http://192.168.43.199:1234/v1", api_key="not-needed"),
"model": "qwen2.5-coder-7b-instruct",
"base_url": "http://192.168.43.199:1234/v1"
},
LLMType.LOCAL_PHI: {
"client": lambda: OpenAI(base_url="http://192.168.43.199:1234/v1", api_key="not-needed"),
"model": "phi-3.5-mini-ita",
"base_url": "http://192.168.43.199:1234/v1"
}
}
EMBEDDING_CONFIG = {
"model_name": "sentence-transformers/multi-qa-mpnet-base-dot-v1",
"chunk_size": 2000,
"chunk_overlap": 100,
"k_documents": 5,
"min_similarity": 0.7
}
# Aggiungi questa costante
EMBEDDING_MODEL = "sentence-transformers/multi-qa-mpnet-base-dot-v1"
# Definisci il percorso base per i database
BASE_DB_PATH = "db"
# Voci italiane edge-tts
VOICE_USER = "it-IT-DiegoNeural" # Voce maschile utente
VOICE_ASSISTANT = "it-IT-ElsaNeural" # Voce femminile assistente