Spaces:
Runtime error
Runtime error
Update config.py
Browse files
config.py
CHANGED
|
@@ -1,24 +1,22 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
import
|
| 4 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 5 |
-
from sentence_transformers import SentenceTransformer
|
| 6 |
-
from config import EMBEDDING_MODEL_NAME
|
| 7 |
from pydantic import BaseModel, ConfigDict
|
| 8 |
|
| 9 |
class MyModel(BaseModel):
|
| 10 |
model_config = ConfigDict(arbitrary_types_allowed=True)
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
embedding_model = SentenceTransformer(EMBEDDING_MODEL_NAME, device=device)
|
| 16 |
-
return embedding_model
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# config.py
|
| 2 |
|
| 3 |
+
import os
|
|
|
|
|
|
|
|
|
|
| 4 |
from pydantic import BaseModel, ConfigDict
|
| 5 |
|
| 6 |
class MyModel(BaseModel):
|
| 7 |
model_config = ConfigDict(arbitrary_types_allowed=True)
|
| 8 |
|
| 9 |
+
# Configuraciones y variables de entorno
|
| 10 |
+
PINECONE_API_KEY = os.getenv("PINECONE_API_KEY")
|
| 11 |
+
PINECONE_ENVIRONMENT = os.getenv("PINECONE_ENVIRONMENT")
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
# Configuraciones del modelo
|
| 14 |
+
EMBEDDING_MODEL_NAME = "BAAI/bge-m3"
|
| 15 |
+
INDEX_NAME = 'neonatos2'
|
| 16 |
+
CONTEXT_FIELDS = ['Tag', 'Pregunta', 'Respuesta']
|
| 17 |
+
SIMILARITY_THRESHOLD_DEFAULT = 0.5
|
| 18 |
+
SYSTEM_PROMPT = """
|
| 19 |
+
Eres un asistente en salud neonatal en Perú, responde y saluda de forma adecuada,
|
| 20 |
+
solo responde en forma de texto de usuario no del chat completo.
|
| 21 |
+
"""
|
| 22 |
+
MAX_LENGTH_DEFAULT = 100
|