stivenDR14 commited on
Commit
ce74d46
·
1 Parent(s): 77773f3
Files changed (1) hide show
  1. pdf_processor.py +14 -4
pdf_processor.py CHANGED
@@ -24,6 +24,8 @@ OLLAMA_EMBEDDINGS = "granite-embedding:278m"
24
 
25
  load_dotenv()
26
 
 
 
27
  api_key_watsonx = os.getenv('WATSONX_APIKEY')
28
  projectid_watsonx = os.getenv('WATSONX_PROJECT_ID')
29
  endpoint_watsonx = "https://us-south.ml.cloud.ibm.com"
@@ -132,10 +134,18 @@ class PDFProcessor:
132
  else:
133
  current_llm, embeding_model = set_up_watsonx()
134
  else:
135
- current_llm = HuggingFaceEndpoint(
136
- repo_id= AI_MODELS[ai_model],
137
- temperature=0.5,
138
- )
 
 
 
 
 
 
 
 
139
  embeding_model = HuggingFaceEmbeddings(
140
  model_name="ibm-granite/granite-embedding-278m-multilingual",
141
  )
 
24
 
25
  load_dotenv()
26
 
27
+ ENVIRONMENT = os.getenv("ENVIRONMENT")
28
+ HUGGINGFACE_TOKEN = os.getenv("HUGGINGFACE_TOKEN")
29
  api_key_watsonx = os.getenv('WATSONX_APIKEY')
30
  projectid_watsonx = os.getenv('WATSONX_PROJECT_ID')
31
  endpoint_watsonx = "https://us-south.ml.cloud.ibm.com"
 
134
  else:
135
  current_llm, embeding_model = set_up_watsonx()
136
  else:
137
+ if ENVIRONMENT != "dev":
138
+ print("HUGGINGFACE accessing")
139
+ current_llm = HuggingFaceEndpoint(
140
+ repo_id= AI_MODELS[ai_model],
141
+ temperature=0.2,
142
+ huggingfacehub_api_token=HUGGINGFACE_TOKEN,
143
+ )
144
+ else:
145
+ current_llm = HuggingFaceEndpoint(
146
+ repo_id= AI_MODELS[ai_model],
147
+ temperature=0.2,
148
+ )
149
  embeding_model = HuggingFaceEmbeddings(
150
  model_name="ibm-granite/granite-embedding-278m-multilingual",
151
  )