VermaPankaj123 commited on
Commit
7f4d897
·
verified ·
1 Parent(s): 058645c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -0
main.py CHANGED
@@ -17,9 +17,16 @@ class ResearchResponse(BaseModel):
17
  sources: list[str]
18
  tools_used: list[str]
19
 
 
 
20
  # ✅ Use HuggingFace Mistral model (free)
 
 
 
 
21
  llm = HuggingFaceHub(
22
  repo_id="mistralai/Mistral-7B-Instruct-v0.3",
 
23
  model_kwargs={"temperature": 0.7, "max_new_tokens": 500},
24
  )
25
 
 
17
  sources: list[str]
18
  tools_used: list[str]
19
 
20
+
21
+
22
  # ✅ Use HuggingFace Mistral model (free)
23
+
24
+ if hf_token is None:
25
+ raise ValueError("Missing Hugging Face API token. Please set the 'HUGGINGFACEHUB_API_TOKEN' secret in your HF space settings.")
26
+
27
  llm = HuggingFaceHub(
28
  repo_id="mistralai/Mistral-7B-Instruct-v0.3",
29
+ huggingfacehub_api_token=hf_token,
30
  model_kwargs={"temperature": 0.7, "max_new_tokens": 500},
31
  )
32