This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import streamlit as st | |
| from agent import SimpleAgent | |
| st.set_page_config(page_title="AI Agent", page_icon="🤖", layout="centered") | |
| st.title("🤖 AI Agent") | |
| st.markdown("---") | |
| user_request = st.text_area( | |
| "What would you like the agent to do?", | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import json | |
| from openai import OpenAI | |
| import config | |
| from tools import search_web | |
| class SimpleAgent: | |
| def __init__(self): | |
| self.client = OpenAI(api_key=config.OPENAI_API_KEY) | |
| self.max_iterations = 5 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import requests | |
| import config | |
| def search_web(query, num_results=10): | |
| try: | |
| response = requests.get( | |
| "https://www.googleapis.com/customsearch/v1", | |
| params={ | |
| "key": config.GOOGLE_CSE_API_KEY, | 
NewerOlder