C2MV commited on
Commit
afdce37
1 Parent(s): ef03810

Update config.py

Browse files
Files changed (1) hide show
  1. config.py +15 -17
config.py CHANGED
@@ -1,24 +1,22 @@
1
- # models.py
2
 
3
- import torch
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
- # Cargar el modelo de embeddings
13
- def load_embedding_model():
14
- device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
15
- embedding_model = SentenceTransformer(EMBEDDING_MODEL_NAME, device=device)
16
- return embedding_model
17
 
18
- # Cargar el modelo Yi-Coder
19
- def load_yi_coder_model():
20
- device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
21
- model_path = "01-ai/Yi-Coder-9B-Chat" # Asegúrate de que esta ruta sea correcta
22
- tokenizer = AutoTokenizer.from_pretrained(model_path)
23
- yi_coder_model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.float16).to(device).eval()
24
- return tokenizer, yi_coder_model, device
 
 
 
 
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