alex-mindspace commited on
Commit
bd51fa1
·
1 Parent(s): fb38482

forget that key.json are not there for huggingface

Browse files
Files changed (1) hide show
  1. swarmai/__main__.py +15 -12
swarmai/__main__.py CHANGED
@@ -7,21 +7,24 @@ sys.path.append('..')
7
  from swarmai.Swarm import Swarm
8
 
9
  def load_keys():
10
- keys_file = Path(__file__).parent.parent / "keys.json"
11
- with open(keys_file) as f:
12
- keys = json.load(f)
13
- os.environ["OPENAI_API_KEY"] = keys["OPENAI_API_KEY"]
14
  try:
15
- os.environ["GOOGLE_API_KEY"] = keys["GOOGLE_API_KEY"]
16
- os.environ["CUSTOM_SEARCH_ENGINE_ID"] = keys["CUSTOM_SEARCH_ENGINE_ID"]
17
- os.environ["GOOGLE_CSE_ID"] = keys["CUSTOM_SEARCH_ENGINE_ID"]
18
- except:
19
- print("WARNING: GOOGLE_API_KEY and GOOGLE_CSE_ID not found in keys.json. Googler agent will be treated as a general purpose agent.")
 
 
 
 
 
20
 
21
- try:
22
- os.environ["APIFY_API_TOKEN"] = keys["APIFY_API_TOKEN"]
 
 
23
  except:
24
- print("WARNING: APIFY_API_TOKEN not found in keys.json. WebScraper agent will not work.")
25
 
26
  def run_swarm():
27
  # establishing the swarm
 
7
  from swarmai.Swarm import Swarm
8
 
9
  def load_keys():
 
 
 
 
10
  try:
11
+ keys_file = Path(__file__).parent.parent / "keys.json"
12
+ with open(keys_file) as f:
13
+ keys = json.load(f)
14
+ os.environ["OPENAI_API_KEY"] = keys["OPENAI_API_KEY"]
15
+ try:
16
+ os.environ["GOOGLE_API_KEY"] = keys["GOOGLE_API_KEY"]
17
+ os.environ["CUSTOM_SEARCH_ENGINE_ID"] = keys["CUSTOM_SEARCH_ENGINE_ID"]
18
+ os.environ["GOOGLE_CSE_ID"] = keys["CUSTOM_SEARCH_ENGINE_ID"]
19
+ except:
20
+ print("WARNING: GOOGLE_API_KEY and GOOGLE_CSE_ID not found in keys.json. Googler agent will be treated as a general purpose agent.")
21
 
22
+ try:
23
+ os.environ["APIFY_API_TOKEN"] = keys["APIFY_API_TOKEN"]
24
+ except:
25
+ print("WARNING: APIFY_API_TOKEN not found in keys.json. WebScraper agent will not work.")
26
  except:
27
+ pass
28
 
29
  def run_swarm():
30
  # establishing the swarm