From 6b36cd55bcbbf45b1e25f7d9a66f7a0181a00149 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 30 May 2024 19:00:46 -0700 Subject: [PATCH] [CLEANUP] --- perplexity_agent.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/perplexity_agent.py b/perplexity_agent.py index 351ac48f..6390a873 100644 --- a/perplexity_agent.py +++ b/perplexity_agent.py @@ -9,11 +9,13 @@ $ pip install swarms - """ -from swarms import Agent -from swarms.models.llama3_hosted import llama3Hosted +from swarms import Agent, OpenAIChat from playground.memory.chromadb_example import ChromaDB from swarms.tools.prebuilt.bing_api import fetch_web_articles_bing_api +import os +from dotenv import load_dotenv +load_dotenv() # Let's create a text file with the provided prompt. @@ -53,7 +55,11 @@ memory = ChromaDB( ) -llm = llama3Hosted(temperature=0.2, max_tokens=3500) +llm = OpenAIChat( + temperature=0.2, + max_tokens=3500, + openai_api_key=os.getenv("OPENAI_API_KEY"), +) # Initialize the agent @@ -84,7 +90,7 @@ def perplexity_agent(task: str = None, *args, **kwargs): """ out = fetch_web_articles_bing_api( task, - subscription_key="940fe346f0a149ea9f34d9969359aed7", + subscription_key=os.getenv("BING_API_KEY"), ) # Sources @@ -97,6 +103,6 @@ def perplexity_agent(task: str = None, *args, **kwargs): out = perplexity_agent( - "What are the biggest GPU chips alternatives for transformer modelsm, look up Etched" + "What are the indian food restaurant names in standford university avenue? What are their cost ratios" ) print(out)