jesusgj commited on
Commit
9a1c771
·
1 Parent(s): a4fe62f

Modified files

Browse files
Files changed (2) hide show
  1. agent.py +4 -4
  2. requirements.txt +2 -1
agent.py CHANGED
@@ -22,10 +22,10 @@ def initialize_agent():
22
  load_dotenv()
23
 
24
  # 1. Load the model
25
- # Make sure to set HF_TOKEN in your Hugging Face Space secrets
26
  model_name = "mistralai/Mixtral-8x7B-Instruct-v0.1"
27
  try:
28
- model = InferenceClientModel(model_id=model_name, token=os.environ.get("HF_TOKEN"), provider="together")
29
  except Exception as e:
30
  print(f"Error loading model: {e}")
31
  model = None
@@ -161,7 +161,7 @@ def initialize_agent():
161
  tools=[],
162
  model=model,
163
  managed_agents=[web_agent],
164
- additional_authorized_imports=["time", "numpy", "pandas", "requests", "serpapi", "llama_index", "beautifulsoup4", "markdownify", "lxml", "json", "urllib.parse", "youtube_transcript_api"],
165
  instructions='''You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the a new line and the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
166
 
167
  To achieve the best results, follow these steps:
@@ -174,4 +174,4 @@ To achieve the best results, follow these steps:
174
  )
175
  return manager_agent
176
  else:
177
- return None
 
22
  load_dotenv()
23
 
24
  # 1. Load the model
25
+ # Make sure to set TOGETHER_API_KEY in your environment variables
26
  model_name = "mistralai/Mixtral-8x7B-Instruct-v0.1"
27
  try:
28
+ model = InferenceClientModel(model_id=model_name, token=os.environ.get("TOGETHER_API_KEY"), provider="together")
29
  except Exception as e:
30
  print(f"Error loading model: {e}")
31
  model = None
 
161
  tools=[],
162
  model=model,
163
  managed_agents=[web_agent],
164
+ additional_authorized_imports=["time", "numpy", "pandas", "requests", "serpapi", "llama_index", "beautifulsoup4", "markdownify", "lxml", "json", "urllib.parse", "youtube_transcript_api", "together"],
165
  instructions='''You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the a new line and the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
166
 
167
  To achieve the best results, follow these steps:
 
174
  )
175
  return manager_agent
176
  else:
177
+ return None
requirements.txt CHANGED
@@ -8,4 +8,5 @@ duckduckgo-search
8
  wikipedia
9
  serpapi
10
  llama-index
11
- youtube-transcript-api
 
 
8
  wikipedia
9
  serpapi
10
  llama-index
11
+ youtube-transcript-api
12
+ together