KalooAI commited on
Commit
fa4a07c
·
verified ·
1 Parent(s): dc4fcd7

Update app.py

Browse files

added: client_kwargs={
"max_retries": 3,
"timeout": 30
}

Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -16,15 +16,21 @@ from langchain_classic.chains import RetrievalQA
16
 
17
  # 1. LLM SETUP (Using Granite via HF API)
18
  def get_llm():
19
- return HuggingFaceEndpoint(
 
 
20
  repo_id="ibm-granite/granite-3.1-8b-instruct",
21
  task="text-generation",
22
  max_new_tokens=512,
23
  temperature=0.1,
24
- huggingfacehub_api_token=os.getenv("HF_TOKEN"),
25
- max_retries=3,
26
- timeout=30
 
 
 
27
  )
 
28
 
29
  # 2. DOCUMENT PROCESSING
30
  def process_pdf(file_path):
 
16
 
17
  # 1. LLM SETUP (Using Granite via HF API)
18
  def get_llm():
19
+ token = os.getenv("HF_TOKEN")
20
+
21
+ llm = HuggingFaceEndpoint(
22
  repo_id="ibm-granite/granite-3.1-8b-instruct",
23
  task="text-generation",
24
  max_new_tokens=512,
25
  temperature=0.1,
26
+ huggingfacehub_api_token=token,
27
+
28
+ client_kwargs={
29
+ "max_retries": 3,
30
+ "timeout": 30
31
+ }
32
  )
33
+ return llm
34
 
35
  # 2. DOCUMENT PROCESSING
36
  def process_pdf(file_path):