jarguello76 commited on
Commit
7918321
·
verified ·
1 Parent(s): 7959c7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -7
app.py CHANGED
@@ -83,14 +83,25 @@ math_tool = FunctionTool.from_defaults(
83
  TOOLS = [validate_tool, search_tool, math_tool]
84
 
85
  from llama_index.core.agent import ReActAgent
86
- from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
87
-
88
- llm = HuggingFaceInferenceAPI(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  model_name="mistralai/Mistral-7B-Instruct-v0.3",
90
- token=HF_TOKEN,
91
- context_window=3900,
92
- max_new_tokens=256,
93
- generate_kwargs={"temperature": 0.7}
94
  )
95
 
96
  agent = ReActAgent.from_tools(
 
83
  TOOLS = [validate_tool, search_tool, math_tool]
84
 
85
  from llama_index.core.agent import ReActAgent
86
+ # from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
87
+
88
+ # llm = HuggingFaceInferenceAPI(
89
+ # model_name="mistralai/Mistral-7B-Instruct-v0.3",
90
+ # token=HF_TOKEN,
91
+ # context_window=3900,
92
+ # max_new_tokens=256,
93
+ # generate_kwargs={"temperature": 0.7}
94
+ # )
95
+
96
+ from llama_index.llms import HuggingFaceLLM
97
+
98
+ llm = HuggingFaceLLM(
99
+ context_window=4096,
100
+ max_new_tokens=512,
101
+ generate_kwargs={"temperature": 0.7, "top_p": 0.95},
102
+ tokenizer_name="mistralai/Mistral-7B-Instruct-v0.3",
103
  model_name="mistralai/Mistral-7B-Instruct-v0.3",
104
+ device="cpu", # or "cuda" if available
 
 
 
105
  )
106
 
107
  agent = ReActAgent.from_tools(