From c79bd2b8fafb3e87128699d76ad6922c31eb356a Mon Sep 17 00:00:00 2001 From: IsaiasRVH2 Date: Sat, 23 Aug 2025 18:47:57 -0600 Subject: [PATCH 01/25] Added my contributions to community-contributions --- .../day1-selenium-web-summary-es-mx.ipynb | 260 ++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 week1/community-contributions/day1-selenium-web-summary-es-mx.ipynb diff --git a/week1/community-contributions/day1-selenium-web-summary-es-mx.ipynb b/week1/community-contributions/day1-selenium-web-summary-es-mx.ipynb new file mode 100644 index 0000000..2a3de8b --- /dev/null +++ b/week1/community-contributions/day1-selenium-web-summary-es-mx.ipynb @@ -0,0 +1,260 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "2588fbba", + "metadata": {}, + "source": [ + "# Website Analysis and Summarization with Selenium and OpenAI\n", + "\n", + "> This notebook demonstrates how to extract and summarize the main content of any website using Selenium for dynamic extraction and OpenAI for generating concise summaries in Mexican Spanish.\n", + "\n", + "## Overview\n", + "This notebook provides a workflow to automatically analyze websites, extract relevant text, and generate a short summary using a language model. Navigation elements are ignored, focusing on news, announcements, and main content.\n", + "\n", + "## Features\n", + "- Extracts relevant text from web pages using Selenium and BeautifulSoup.\n", + "- Generates automatic summaries using OpenAI's language models.\n", + "- Presents results in markdown format.\n", + "\n", + "## Requirements\n", + "- Python 3.8+\n", + "- Google Chrome browser installed\n", + "- The following Python packages:\n", + " - selenium\n", + " - webdriver-manager\n", + " - beautifulsoup4\n", + " - openai\n", + " - python-dotenv\n", + " - requests\n", + "- An OpenAI API key (project key, starting with `sk-proj-`)\n", + "- Internet connection\n", + "\n", + "## How to Use\n", + "1. Install the required packages:\n", + " ```bash\n", + " pip install selenium webdriver-manager undetected-chromedriver beautifulsoup4 openai python-dotenv requests\n", + " ```\n", + "2. Add your OpenAI API key to a `.env` file as `OPENAI_API_KEY`.\n", + "3. Run the notebook cells in order. You can change the target website URL in the code to analyze different sites.\n", + "4. The summary will be displayed in markdown format below the code cell.\n", + "\n", + "**Note:** Some websites may block automated access. The notebook includes options to simulate a real user and avoid bot detection, but results may vary depending on the site's protections.\n", + "\n", + "---" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dc7c2ade", + "metadata": {}, + "outputs": [], + "source": [ + "# Imports\n", + "import os\n", + "import requests\n", + "from dotenv import load_dotenv\n", + "from bs4 import BeautifulSoup\n", + "from IPython.display import Markdown, display\n", + "from openai import OpenAI\n", + "\n", + "from selenium import webdriver\n", + "from selenium.webdriver.chrome.service import Service\n", + "from selenium.webdriver.common.by import By\n", + "from selenium.webdriver.chrome.options import Options\n", + "from selenium.webdriver.support.ui import WebDriverWait\n", + "from selenium.webdriver.support import expected_conditions as EC\n", + "from webdriver_manager.chrome import ChromeDriverManager\n", + "import undetected_chromedriver as uc" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a2d21987", + "metadata": {}, + "outputs": [], + "source": [ + "# Load the environment variables from .env\n", + "load_dotenv(override=True)\n", + "api_key = os.getenv('OPENAI_API_KEY')\n", + "\n", + "# Check the key\n", + "\n", + "if not api_key:\n", + " print(\"No API key was found - please head over to the troubleshooting notebook in this folder to identify & fix!\")\n", + "elif not api_key.startswith(\"sk-proj-\"):\n", + " print(\"An API key was found, but it doesn't start sk-proj-; please check you're using the right key - see troubleshooting notebook\")\n", + "elif api_key.strip() != api_key:\n", + " print(\"An API key was found, but it looks like it might have space or tab characters at the start or end - please remove them - see troubleshooting notebook\")\n", + "else:\n", + " print(\"API key found and looks good so far!\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bbb3a8ed", + "metadata": {}, + "outputs": [], + "source": [ + "openai = OpenAI()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5313aa64", + "metadata": {}, + "outputs": [], + "source": [ + "class Website:\n", + " def __init__(self, url, headless=True, wait_time=10):\n", + " self.url = url # Website URL to analyze\n", + " self.title = None # Title of the website\n", + " self.text = None # Extracted text from the website\n", + " \n", + " # Chrome options configuration for Selenium\n", + " options = Options()\n", + " if headless:\n", + " options.add_argument(\"--headless=new\") # Run Chrome in headless mode (no window)\n", + " options.add_argument(\"--disable-gpu\") # Disable GPU acceleration\n", + " options.add_argument(\"--no-sandbox\") # Disable Chrome sandbox (required for some environments)\n", + " options.add_argument(\"--window-size=1920,1080\") # Set window size to simulate a real user\n", + " # Simulate a real user-agent to avoid bot detection\n", + " options.add_argument(\"user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\")\n", + " \n", + " # Initialize Chrome WebDriver\n", + " self.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)\n", + " self.driver.get(url) # Open the URL in the browser\n", + " \n", + " try:\n", + " # Wait until the element is present in the page\n", + " WebDriverWait(self.driver, wait_time).until(EC.presence_of_element_located((By.TAG_NAME, \"body\")))\n", + " html = self.driver.page_source # Get the full HTML of the page\n", + " soup = BeautifulSoup(html, 'html.parser') # Parse HTML with BeautifulSoup\n", + " self.title = soup.title.string if soup.title else 'No title found' # Extract the title\n", + " if soup.body:\n", + " # Remove irrelevant elements from the body\n", + " for irrelevant in soup.body([\"script\", \"style\", \"img\", \"input\"]):\n", + " irrelevant.decompose()\n", + " # Extract clean text from the body\n", + " self.text = soup.body.get_text(separator='\\n', strip=True)\n", + " else:\n", + " self.text = \"No body found\" # If no body is found, indicate it\n", + " except Exception as e:\n", + " print(f\"Error accessing the site: {e}\") # Print error to console\n", + " self.text = \"Error accessing the site\" # Store error in the attribute\n", + " finally:\n", + " self.driver.quit() # Always close the browser, whether or not an error occurred" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e902c6b2", + "metadata": {}, + "outputs": [], + "source": [ + "system_prompt = \"You are an assistant that analyzes the contents of a website \\\n", + "and provides a short summary, ignoring text that might be navigation related. \\\n", + "Respond in markdown in Mexican Spanish.\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eaee8f36", + "metadata": {}, + "outputs": [], + "source": [ + "# A function that writes a User Prompt that asks for summaries of websites:\n", + "\n", + "def user_prompt_for(website):\n", + " user_prompt = f\"You are looking at a website titled {website.title}\"\n", + " user_prompt += \"\\nThe contents of this website is as follows; \\\n", + "please provide a short summary of this website in markdown. \\\n", + "If it includes news or announcements, then summarize these too.\\n\\n\"\n", + " user_prompt += website.text\n", + " return user_prompt" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9ac4ed8b", + "metadata": {}, + "outputs": [], + "source": [ + "# Creates messages for the OpenAI API\n", + "def messages_for(website):\n", + " return [\n", + " {\"role\": \"system\", \"content\": system_prompt},\n", + " {\"role\": \"user\", \"content\": user_prompt_for(website)}\n", + " ]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1536d537", + "metadata": {}, + "outputs": [], + "source": [ + "# Creates a summary for the given URL\n", + "def summarize(url):\n", + " website = Website(url)\n", + " response = openai.chat.completions.create(\n", + " model = \"gpt-4o-mini\",\n", + " messages = messages_for(website)\n", + " )\n", + " return response.choices[0].message.content" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fe135339", + "metadata": {}, + "outputs": [], + "source": [ + "# Shows the summary for the given URL\n", + "def display_summary(url):\n", + " summary = summarize(url)\n", + " display(Markdown(summary))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a301ab4e", + "metadata": {}, + "outputs": [], + "source": [ + "display_summary(\"https://openai.com/\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From a5bf394d4384951521775fdc378e1dcd82c0b4cf Mon Sep 17 00:00:00 2001 From: Arundhati Date: Sun, 24 Aug 2025 00:55:50 -0400 Subject: [PATCH 02/25] Added Mediterranean Banter notebook to community-contributions --- .../Mediterranean Banter.ipynb | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 week2/community-contributions/Mediterranean Banter.ipynb diff --git a/week2/community-contributions/Mediterranean Banter.ipynb b/week2/community-contributions/Mediterranean Banter.ipynb new file mode 100644 index 0000000..5ac089c --- /dev/null +++ b/week2/community-contributions/Mediterranean Banter.ipynb @@ -0,0 +1,252 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "9ab6f493-026f-4950-b244-22c5251b8daa", + "metadata": {}, + "source": [ + "# Mediterranean Banter" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4568bc63-679e-4ea1-a9c9-b85dfc386ec7", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from dotenv import load_dotenv\n", + "from openai import OpenAI\n", + "import anthropic\n", + "from IPython.display import Markdown, display, update_display" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7a852bee-76e6-4538-89a3-0702c2d5f05c", + "metadata": {}, + "outputs": [], + "source": [ + "import google.generativeai" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c843ac74-4797-4bd0-bed2-dfcaa2f98c41", + "metadata": {}, + "outputs": [], + "source": [ + "load_dotenv(override=True)\n", + "openai_api_key = os.getenv('OPENAI_API_KEY')\n", + "anthropic_api_key = os.getenv('ANTHROPIC_API_KEY')\n", + "google_api_key = os.getenv('GOOGLE_API_KEY')\n", + "\n", + "if openai_api_key:\n", + " print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n", + "else:\n", + " print(\"OpenAI API Key not set\")\n", + " \n", + "if anthropic_api_key:\n", + " print(f\"Anthropic API Key exists and begins {anthropic_api_key[:7]}\")\n", + "else:\n", + " print(\"Anthropic API Key not set\")\n", + "\n", + "if google_api_key:\n", + " print(f\"Google API Key exists and begins {google_api_key[:8]}\")\n", + "else:\n", + " print(\"Google API Key not set\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e4181018-1818-47fa-a3fb-554627a63f69", + "metadata": {}, + "outputs": [], + "source": [ + "openai = OpenAI()\n", + "\n", + "claude = anthropic.Anthropic()\n", + "\n", + "google.generativeai.configure()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "19f833c8-e183-469c-a8c8-1c014889a15d", + "metadata": {}, + "outputs": [], + "source": [ + "gpt_model_spain = \"gpt-4.1-mini\"\n", + "claude_model_italy = \"claude-3-5-haiku-latest\"\n", + "gemini_model_france = \"gemini-2.0-flash\"\n", + "\n", + "gpt_system_spain = \"You are a chatbot who is very argumentative; \\\n", + "you disagree with anything other than how beautiful and great South of Spain is.\"\n", + "\n", + "claude_system_italy = \"You are a very polite, courteous chatbot but you favour south of Italy prasing Amalfi Coast.\"\n", + "\n", + "gemini_system_france = \"You are neutral. You always accept what other people say and never try to put down other people thoughts.Although, you politely try to include that South of France is beautiful\"\n", + "\n", + "gpt_messages_spain = [\"Hi there, nothing beats the beauty of Spain and its wonderful beaches.\"]\n", + "claude_messages_italy = [\"I agree. I admire the Southern Part of Spain but its not as pretty as Amalfi Coast.\"]\n", + "gemini_messages_france = [\"Well, both are good and so is the French Riveria.\"]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d426b95-5e7c-49aa-a5a1-9613296eb0d0", + "metadata": {}, + "outputs": [], + "source": [ + "def call_gpt():\n", + " messages = [{\"role\": \"system\", \"content\": gpt_system_spain}]\n", + " for gpt, claude,gemini in zip(gpt_messages_spain, claude_messages_italy,gemini_messages_france):\n", + " messages.append({\"role\": \"assistant\", \"content\": gpt})\n", + " messages.append({\"role\": \"user\", \"content\": claude})\n", + " messages.append({\"role\": \"user\", \"content\": gemini})\n", + " completion = openai.chat.completions.create(\n", + " model=gpt_model_spain,\n", + " messages=messages\n", + " )\n", + " return completion.choices[0].message.content" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3fc9a696-3145-4f37-873b-539647f2fc0b", + "metadata": {}, + "outputs": [], + "source": [ + "call_gpt()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "63910faa-a122-4261-82a0-7530c6c5749a", + "metadata": {}, + "outputs": [], + "source": [ + "def call_claude():\n", + " messages = []\n", + " for gpt_spain, claude_italy,gemini_france in zip(gpt_messages_spain, claude_messages_italy,gemini_messages_france):\n", + " messages.append({\"role\": \"user\", \"content\": gpt_spain})\n", + " messages.append({\"role\": \"user\", \"content\": gemini_france})\n", + " messages.append({\"role\": \"assistant\", \"content\": claude_italy})\n", + " messages.append({\"role\": \"user\", \"content\": gpt_messages_spain[-1]})\n", + " messages.append({\"role\": \"user\", \"content\": gemini_messages_france[-1]})\n", + " message = claude.messages.create(\n", + " model=claude_model_italy,\n", + " system=claude_system_italy,\n", + " messages=messages,\n", + " max_tokens=500\n", + " )\n", + " return message.content[0].text" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d3ab6aa2-a462-4fb3-bb6a-dc6b971827fa", + "metadata": {}, + "outputs": [], + "source": [ + "call_claude()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "114cb7eb-0915-46ac-b285-e40acf4a9ffb", + "metadata": {}, + "outputs": [], + "source": [ + "def call_gemini():\n", + " messages=[]\n", + " for gpt_spain, claude_italy,gemini_france in zip(gpt_messages_spain, claude_messages_italy,gemini_messages_france):\n", + " messages.append({\"role\": \"user\", \"content\": gpt_spain})\n", + " messages.append({\"role\": \"user\", \"content\": claude_italy})\n", + " messages.append({\"role\": \"assistant\", \"content\": gemini_france})\n", + " messages.append({\"role\": \"user\", \"content\": gpt_messages_spain[-1]})\n", + " messages.append({\"role\": \"user\", \"content\": claude_messages_italy[-1]})\n", + " gemini = google.generativeai.GenerativeModel(\n", + " model_name='gemini-2.0-flash',\n", + " system_instruction=gemini_system_france\n", + " )\n", + " dialogue_text = \"\\n\".join(f\"{m['role']}: {m['content']}\" for m in messages)\n", + " response = gemini.generate_content(dialogue_text)\n", + " return response.text\n", + " \n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e3acf708-f9b1-4a6d-b3e1-823c96d00555", + "metadata": {}, + "outputs": [], + "source": [ + "call_gemini()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c103430e-68c7-4cc6-8a43-6b5aec7fdc96", + "metadata": {}, + "outputs": [], + "source": [ + "gpt_messages_spain = [\"Hi there, nothing beats the beauty of Spain and its wonderful beaches.\"]\n", + "claude_messages_italy = [\"I agree. I admire the Southern Part of Spain but its not as pretty as Amalfi Coast.\"]\n", + "gemini_messages_france = [\"Well, both are good and so is the French Riveria.\"]\n", + "\n", + "print(f\"GPT:\\n{gpt_messages_spain[0]}\\n\")\n", + "print(f\"Claude:\\n{claude_messages_italy[0]}\\n\")\n", + "print(f\"Gemini:\\n{gemini_messages_france[0]}\\n\")\n", + "\n", + "for i in range(5):\n", + " gpt_next = call_gpt()\n", + " print(f\"GPT:\\n{gpt_next}\\n\")\n", + " gpt_messages_spain.append(gpt_next)\n", + " \n", + " claude_next = call_claude()\n", + " print(f\"Claude:\\n{claude_next}\\n\")\n", + " claude_messages_italy.append(claude_next)\n", + "\n", + " gemini_next = call_gemini()\n", + " print(f\"Gemini:\\n{gemini_next}\\n\")\n", + " gemini_messages_france.append(gemini_next)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 024d474643d54225ae850ddd2dba0f9656b2af63 Mon Sep 17 00:00:00 2001 From: Rohit Nain Date: Sun, 24 Aug 2025 11:37:07 +0530 Subject: [PATCH 03/25] added email summaizers script with openai --- .../Day-1_email_summarizers.ipynb | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 week1/community-contributions/Day-1_email_summarizers.ipynb diff --git a/week1/community-contributions/Day-1_email_summarizers.ipynb b/week1/community-contributions/Day-1_email_summarizers.ipynb new file mode 100644 index 0000000..d2a4597 --- /dev/null +++ b/week1/community-contributions/Day-1_email_summarizers.ipynb @@ -0,0 +1,103 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d7a6bb51", + "metadata": {}, + "outputs": [], + "source": [ + "# import library\n", + "from openai import OpenAI\n", + "import os\n", + "from dotenv import load_dotenv\n", + "\n", + "# Load your API key from an .env file\n", + "load_dotenv(override=True)\n", + "api_key = os.getenv('OPENAI_API_KEY')\n", + "openai = OpenAI()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7ac4cdf9", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# Step 1: Create your prompts\n", + "system_prompt = \"you are a helpful assistant that suggests an appropriate short subject line for an email based on its contents.\"\n", + "\n", + "user_prompt = \"\"\"\n", + "Hi John,\n", + "I hope this email finds you well. I wanted to follow up on our meeting last week regarding the quarterly budget proposal.\n", + "After reviewing the numbers with my team, we've identified some areas where we can reduce costs by approximately 15% without impacting our core operations. This would involve consolidating some vendor contracts and optimizing our software licensing.\n", + "Could we schedule a meeting next week to discuss these findings in detail? I'm available Tuesday through Thursday afternoon.\n", + "Looking forward to hearing from you.\n", + "\n", + "Best regards,\n", + "Sarah\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a77ca09e", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# Step 2: Make the messages list\n", + "messages = [\n", + " {\"role\": \"system\", \"content\": system_prompt},\n", + " {\"role\": \"user\", \"content\": user_prompt}\n", + "]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8404f0fe", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# Step 3: Call OpenAI\n", + "response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7a4875f7", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# Step 4: Print the result\n", + "print(response.choices[0].message.content)" + ] + } + ], + "metadata": { + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 17463e83ffc9b119065f97fc8f80fe4e5adad89d Mon Sep 17 00:00:00 2001 From: Rohit Nain Date: Sun, 24 Aug 2025 17:56:13 +0530 Subject: [PATCH 04/25] day-2 exercise with ollama --- .../Day-2_exercise_with_ollama3.ipynb | 290 ++++++++++++++++++ 1 file changed, 290 insertions(+) create mode 100644 week1/community-contributions/Day-2_exercise_with_ollama3.ipynb diff --git a/week1/community-contributions/Day-2_exercise_with_ollama3.ipynb b/week1/community-contributions/Day-2_exercise_with_ollama3.ipynb new file mode 100644 index 0000000..1168770 --- /dev/null +++ b/week1/community-contributions/Day-2_exercise_with_ollama3.ipynb @@ -0,0 +1,290 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "135717e7", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# imports\n", + "\n", + "import os\n", + "import requests\n", + "from dotenv import load_dotenv\n", + "from bs4 import BeautifulSoup\n", + "from IPython.display import Markdown, display\n", + "from openai import OpenAI\n", + "import ollama" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "29a9e634", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# OPTION 1\n", + "# using openai\n", + "\n", + "# message = \"Hello, GPT! This is my first ever message to you! Hi!\"\n", + "# client = OpenAI(base_url=\"http://localhost:11434/v1\", api_key=\"not-needed\")\n", + "# response = openai.chat.completions.create(model=``, messages=[{\"role\":\"user\", \"content\":message}])\n", + "# print(response.choices[0].message.content)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "306993ed", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# OPTION 2\n", + "# using Ollama\n", + "\n", + "message = \"Hello, GPT! This is my first ever message to you! Hi!\"\n", + "model=\"llama3\"\n", + "response=ollama.chat(model=model,messages=[{\"role\":\"user\",\"content\":message}])\n", + "print(response[\"message\"][\"content\"])\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "856f767b", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# A class to represent a Webpage\n", + "# If you're not familiar with Classes, check out the \"Intermediate Python\" notebook\n", + "\n", + "# Some websites need you to use proper headers when fetching them:\n", + "headers = {\n", + " \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36\"\n", + "}\n", + "\n", + "class Website:\n", + "\n", + " def __init__(self, url):\n", + " \"\"\"\n", + " Create this Website object from the given url using the BeautifulSoup library\n", + " \"\"\"\n", + " self.url = url\n", + " response = requests.get(url, headers=headers)\n", + " soup = BeautifulSoup(response.content, 'html.parser')\n", + " self.title = soup.title.string if soup.title else \"No title found\"\n", + " for irrelevant in soup.body([\"script\", \"style\", \"img\", \"input\"]):\n", + " irrelevant.decompose()\n", + " self.text = soup.body.get_text(separator=\"\\n\", strip=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "4ce558dc", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# Let's try one out. Change the website and add print statements to follow along.\n", + "\n", + "ed = Website(\"https://edwarddonner.com\")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "5e3956f8", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# Define our system prompt - you can experiment with this later, changing the last sentence to 'Respond in markdown in Spanish.\"\n", + "\n", + "system_prompt = \"You are an assistant that analyzes the contents of a website \\\n", + "and provides a short summary, ignoring text that might be navigation related. \\\n", + "Respond in markdown.\"" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "99d791b4", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# A function that writes a User Prompt that asks for summaries of websites:\n", + "\n", + "def user_prompt_for(website):\n", + " user_prompt = f\"You are looking at a website titled {website.title}\"\n", + " user_prompt += \"\\nThe contents of this website is as follows; \\\n", + "please provide a short summary of this website in markdown. \\\n", + "If it includes news or announcements, then summarize these too.\\n\\n\"\n", + " user_prompt += website.text\n", + " return user_prompt" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "5d89b748", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# See how this function creates exactly the format above\n", + "\n", + "def messages_for(website):\n", + " return [\n", + " {\"role\": \"system\", \"content\": system_prompt},\n", + " {\"role\": \"user\", \"content\": user_prompt_for(website)}\n", + " ]" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "9a97d3e2", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# And now: call the OpenAI API. You will get very familiar with this!\n", + "\n", + "def summarize(url):\n", + " website = Website(url)\n", + " response=ollama.chat(model=model,messages=messages_for(website))\n", + " return(response[\"message\"][\"content\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ec13fe0a", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "summarize(\"https://edwarddonner.com\")" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "e3ade092", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# A function to display this nicely in the Jupyter output, using markdown\n", + "\n", + "def display_summary(url):\n", + " summary = summarize(url)\n", + " display(Markdown(summary))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "be2d49e6", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "display_summary(\"https://edwarddonner.com\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1ccbf33b", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "display_summary(\"https://cnn.com\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ae3d0eae", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "display_summary(\"https://anthropic.com\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 604aca783c6b2a748365d53676606867e23b72b4 Mon Sep 17 00:00:00 2001 From: Rohit Nain Date: Sun, 24 Aug 2025 17:57:52 +0530 Subject: [PATCH 05/25] Revert "day-2 exercise with ollama" This reverts commit 17463e83ffc9b119065f97fc8f80fe4e5adad89d. --- .../Day-2_exercise_with_ollama3.ipynb | 290 ------------------ 1 file changed, 290 deletions(-) delete mode 100644 week1/community-contributions/Day-2_exercise_with_ollama3.ipynb diff --git a/week1/community-contributions/Day-2_exercise_with_ollama3.ipynb b/week1/community-contributions/Day-2_exercise_with_ollama3.ipynb deleted file mode 100644 index 1168770..0000000 --- a/week1/community-contributions/Day-2_exercise_with_ollama3.ipynb +++ /dev/null @@ -1,290 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "135717e7", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "# imports\n", - "\n", - "import os\n", - "import requests\n", - "from dotenv import load_dotenv\n", - "from bs4 import BeautifulSoup\n", - "from IPython.display import Markdown, display\n", - "from openai import OpenAI\n", - "import ollama" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "29a9e634", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "# OPTION 1\n", - "# using openai\n", - "\n", - "# message = \"Hello, GPT! This is my first ever message to you! Hi!\"\n", - "# client = OpenAI(base_url=\"http://localhost:11434/v1\", api_key=\"not-needed\")\n", - "# response = openai.chat.completions.create(model=``, messages=[{\"role\":\"user\", \"content\":message}])\n", - "# print(response.choices[0].message.content)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "306993ed", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "# OPTION 2\n", - "# using Ollama\n", - "\n", - "message = \"Hello, GPT! This is my first ever message to you! Hi!\"\n", - "model=\"llama3\"\n", - "response=ollama.chat(model=model,messages=[{\"role\":\"user\",\"content\":message}])\n", - "print(response[\"message\"][\"content\"])\n" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "856f767b", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "# A class to represent a Webpage\n", - "# If you're not familiar with Classes, check out the \"Intermediate Python\" notebook\n", - "\n", - "# Some websites need you to use proper headers when fetching them:\n", - "headers = {\n", - " \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36\"\n", - "}\n", - "\n", - "class Website:\n", - "\n", - " def __init__(self, url):\n", - " \"\"\"\n", - " Create this Website object from the given url using the BeautifulSoup library\n", - " \"\"\"\n", - " self.url = url\n", - " response = requests.get(url, headers=headers)\n", - " soup = BeautifulSoup(response.content, 'html.parser')\n", - " self.title = soup.title.string if soup.title else \"No title found\"\n", - " for irrelevant in soup.body([\"script\", \"style\", \"img\", \"input\"]):\n", - " irrelevant.decompose()\n", - " self.text = soup.body.get_text(separator=\"\\n\", strip=True)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "4ce558dc", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "# Let's try one out. Change the website and add print statements to follow along.\n", - "\n", - "ed = Website(\"https://edwarddonner.com\")" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "5e3956f8", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "# Define our system prompt - you can experiment with this later, changing the last sentence to 'Respond in markdown in Spanish.\"\n", - "\n", - "system_prompt = \"You are an assistant that analyzes the contents of a website \\\n", - "and provides a short summary, ignoring text that might be navigation related. \\\n", - "Respond in markdown.\"" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "99d791b4", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "# A function that writes a User Prompt that asks for summaries of websites:\n", - "\n", - "def user_prompt_for(website):\n", - " user_prompt = f\"You are looking at a website titled {website.title}\"\n", - " user_prompt += \"\\nThe contents of this website is as follows; \\\n", - "please provide a short summary of this website in markdown. \\\n", - "If it includes news or announcements, then summarize these too.\\n\\n\"\n", - " user_prompt += website.text\n", - " return user_prompt" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "5d89b748", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "# See how this function creates exactly the format above\n", - "\n", - "def messages_for(website):\n", - " return [\n", - " {\"role\": \"system\", \"content\": system_prompt},\n", - " {\"role\": \"user\", \"content\": user_prompt_for(website)}\n", - " ]" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "9a97d3e2", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "# And now: call the OpenAI API. You will get very familiar with this!\n", - "\n", - "def summarize(url):\n", - " website = Website(url)\n", - " response=ollama.chat(model=model,messages=messages_for(website))\n", - " return(response[\"message\"][\"content\"])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ec13fe0a", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "summarize(\"https://edwarddonner.com\")" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "e3ade092", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "# A function to display this nicely in the Jupyter output, using markdown\n", - "\n", - "def display_summary(url):\n", - " summary = summarize(url)\n", - " display(Markdown(summary))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "be2d49e6", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "display_summary(\"https://edwarddonner.com\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1ccbf33b", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "display_summary(\"https://cnn.com\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ae3d0eae", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "display_summary(\"https://anthropic.com\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.13" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} From 5515c1d004b7d57e93091324b523684397b1f8a1 Mon Sep 17 00:00:00 2001 From: Rohit Nain Date: Sun, 24 Aug 2025 17:56:13 +0530 Subject: [PATCH 06/25] day-2 exercise with ollama --- .../Day-2_exercise_with_ollama3.ipynb | 290 ++++++++++++++++++ 1 file changed, 290 insertions(+) create mode 100644 week1/community-contributions/Day-2_exercise_with_ollama3.ipynb diff --git a/week1/community-contributions/Day-2_exercise_with_ollama3.ipynb b/week1/community-contributions/Day-2_exercise_with_ollama3.ipynb new file mode 100644 index 0000000..1168770 --- /dev/null +++ b/week1/community-contributions/Day-2_exercise_with_ollama3.ipynb @@ -0,0 +1,290 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "135717e7", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# imports\n", + "\n", + "import os\n", + "import requests\n", + "from dotenv import load_dotenv\n", + "from bs4 import BeautifulSoup\n", + "from IPython.display import Markdown, display\n", + "from openai import OpenAI\n", + "import ollama" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "29a9e634", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# OPTION 1\n", + "# using openai\n", + "\n", + "# message = \"Hello, GPT! This is my first ever message to you! Hi!\"\n", + "# client = OpenAI(base_url=\"http://localhost:11434/v1\", api_key=\"not-needed\")\n", + "# response = openai.chat.completions.create(model=``, messages=[{\"role\":\"user\", \"content\":message}])\n", + "# print(response.choices[0].message.content)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "306993ed", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# OPTION 2\n", + "# using Ollama\n", + "\n", + "message = \"Hello, GPT! This is my first ever message to you! Hi!\"\n", + "model=\"llama3\"\n", + "response=ollama.chat(model=model,messages=[{\"role\":\"user\",\"content\":message}])\n", + "print(response[\"message\"][\"content\"])\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "856f767b", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# A class to represent a Webpage\n", + "# If you're not familiar with Classes, check out the \"Intermediate Python\" notebook\n", + "\n", + "# Some websites need you to use proper headers when fetching them:\n", + "headers = {\n", + " \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36\"\n", + "}\n", + "\n", + "class Website:\n", + "\n", + " def __init__(self, url):\n", + " \"\"\"\n", + " Create this Website object from the given url using the BeautifulSoup library\n", + " \"\"\"\n", + " self.url = url\n", + " response = requests.get(url, headers=headers)\n", + " soup = BeautifulSoup(response.content, 'html.parser')\n", + " self.title = soup.title.string if soup.title else \"No title found\"\n", + " for irrelevant in soup.body([\"script\", \"style\", \"img\", \"input\"]):\n", + " irrelevant.decompose()\n", + " self.text = soup.body.get_text(separator=\"\\n\", strip=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "4ce558dc", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# Let's try one out. Change the website and add print statements to follow along.\n", + "\n", + "ed = Website(\"https://edwarddonner.com\")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "5e3956f8", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# Define our system prompt - you can experiment with this later, changing the last sentence to 'Respond in markdown in Spanish.\"\n", + "\n", + "system_prompt = \"You are an assistant that analyzes the contents of a website \\\n", + "and provides a short summary, ignoring text that might be navigation related. \\\n", + "Respond in markdown.\"" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "99d791b4", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# A function that writes a User Prompt that asks for summaries of websites:\n", + "\n", + "def user_prompt_for(website):\n", + " user_prompt = f\"You are looking at a website titled {website.title}\"\n", + " user_prompt += \"\\nThe contents of this website is as follows; \\\n", + "please provide a short summary of this website in markdown. \\\n", + "If it includes news or announcements, then summarize these too.\\n\\n\"\n", + " user_prompt += website.text\n", + " return user_prompt" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "5d89b748", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# See how this function creates exactly the format above\n", + "\n", + "def messages_for(website):\n", + " return [\n", + " {\"role\": \"system\", \"content\": system_prompt},\n", + " {\"role\": \"user\", \"content\": user_prompt_for(website)}\n", + " ]" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "9a97d3e2", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# And now: call the OpenAI API. You will get very familiar with this!\n", + "\n", + "def summarize(url):\n", + " website = Website(url)\n", + " response=ollama.chat(model=model,messages=messages_for(website))\n", + " return(response[\"message\"][\"content\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ec13fe0a", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "summarize(\"https://edwarddonner.com\")" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "e3ade092", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "# A function to display this nicely in the Jupyter output, using markdown\n", + "\n", + "def display_summary(url):\n", + " summary = summarize(url)\n", + " display(Markdown(summary))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "be2d49e6", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "display_summary(\"https://edwarddonner.com\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1ccbf33b", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "display_summary(\"https://cnn.com\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ae3d0eae", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "display_summary(\"https://anthropic.com\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From c910bd11bbc19ac684b2f0cf3f7c35d2c0928264 Mon Sep 17 00:00:00 2001 From: yolelukoie <137051592+yolelukoie@users.noreply.github.com> Date: Sun, 24 Aug 2025 20:50:00 +0300 Subject: [PATCH 07/25] Added my contributions to community-contributions --- ...r_tailored_to_CV_and_job_description.ipynb | 211 ++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 week1/community-contributions/day1_coverletter_tailored_to_CV_and_job_description.ipynb diff --git a/week1/community-contributions/day1_coverletter_tailored_to_CV_and_job_description.ipynb b/week1/community-contributions/day1_coverletter_tailored_to_CV_and_job_description.ipynb new file mode 100644 index 0000000..9c63b6a --- /dev/null +++ b/week1/community-contributions/day1_coverletter_tailored_to_CV_and_job_description.ipynb @@ -0,0 +1,211 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d955d75d-4970-48fe-983e-a2a850cecfc5", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "import requests\n", + "from dotenv import load_dotenv\n", + "from bs4 import BeautifulSoup\n", + "from IPython.display import Markdown, display\n", + "from openai import OpenAI\n", + "\n", + "import PyPDF2\n", + "from selenium import webdriver\n", + "from selenium.webdriver.chrome.options import Options\n", + "from selenium.webdriver.chrome.service import Service\n", + "from webdriver_manager.chrome import ChromeDriverManager\n", + "from bs4 import BeautifulSoup\n", + "import time" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6e1e5dd3-f91a-466b-8fd4-2dbf4eedf101", + "metadata": {}, + "outputs": [], + "source": [ + "load_dotenv(override = True)\n", + "api_key = os.getenv(\"OPENAI_API_KEY\")\n", + "\n", + "if not api_key:\n", + " print(\"No API key\")\n", + "elif not api_key.startswith(\"sk-proj-\"):\n", + " print(\"API key doesn't look correct, check it\")\n", + "elif api_key.strip() != api_key:\n", + " print(\"It looks like API key has an extra space - check it\")\n", + "else:\n", + " print(\"API key looks good, moving on!\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "67a6e583-1ef7-4b77-8886-c0e8c619933c", + "metadata": {}, + "outputs": [], + "source": [ + "openai = OpenAI()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "34a07806-dd68-4a86-8b6e-e1b2aaf0daa1", + "metadata": {}, + "outputs": [], + "source": [ + "# path to the CV\n", + "path = \"/Users/yanasklar/Documents/For applying/CV/СV_YanaSklyar_c.pdf\"\n", + "headers = {\n", + " \"User-Agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36\"\n", + "}\n", + "\n", + "class Vacancy:\n", + " def __init__(self, url, instructions = \"\"):\n", + " self.url = url\n", + " \n", + " # configure Chrome settings\n", + " options = Options()\n", + " # options.add_argument(\"--headless\") \n", + " \"\"\"\n", + " Headless mode runs the browser in the background (invisible).\n", + " However, some websites (like openai.com) block headless browsers.\n", + " So if this line is active, the page may not load correctly and you may not get the full content.\n", + " \"\"\"\n", + " options.add_argument(\"--disable-gpu\")\n", + " options.add_argument(\"--no-sandbox\")\n", + " options.add_argument(\"--window-size=1920x1080\")\n", + "\n", + " # use webdriver-manager to manage ChromeDriver\n", + " service = Service(ChromeDriverManager().install())\n", + " driver = webdriver.Chrome(service=service, options=options)\n", + " driver.get(url)\n", + " time.sleep(3) # let the page load\n", + "\n", + " # take the source of the page\n", + " page_source = driver.page_source\n", + " driver.quit()\n", + "\n", + " # analyse with BeautifulSoup\n", + " soup = BeautifulSoup(page_source, 'html.parser')\n", + "\n", + " self.title = soup.title.string if soup.title else \"No title found\"\n", + " for irrelevant in soup.body([\"img\", \"script\", \"style\", \"input\"]):\n", + " irrelevant.decompose()\n", + " self.text = soup.body.get_text(separator='\\n', strip=True)\n", + "\n", + " # read CV\n", + " with open(path, 'rb') as f:\n", + " reader = PyPDF2.PdfReader(f)\n", + " cv_text = \"\"\n", + " for page in reader.pages:\n", + " text = page.extract_text()\n", + " if text:\n", + " cv_text += text + \"\\n\"\n", + " self.cv_text = cv_text\n", + "\n", + " # summarise and print the description of the job\n", + " message = f\"\"\"Here is the content of a webpage: {self.text}.\n", + " Find job description on that page,\n", + " summarise it, include the list requirements and other important details.\n", + " \"\"\"\n", + " messages = [{\"role\":\"user\", \"content\":message}]\n", + " response = openai.chat.completions.create(model='gpt-4o-mini', messages = messages)\n", + " print(\"The job description: \", response.choices[0].message.content)\n", + "\n", + " # create prompts\n", + " self.system_prompt = \"\"\"You are a career assistant specializing in writing cover letter.\n", + " Your tasks:\n", + " 1. Read the candidate's CV (provided as text).\n", + " 2. Read the job description (provided from a webpage).\n", + " 3. Write a concise and compelling cover letter, that:\n", + " - Hightlights the most relevant experience and skills from the CV,\n", + " - Aligns directly wit the requirements in the job description,\n", + " - Adapts to cultural and professional norms in Israel.\n", + " The letter should be no longer than half a page, persuasive and tailored to make the applicant stand out.\n", + " \"\"\"\n", + "\n", + " user_prompt = f\"\"\"\n", + " Here is my CV:\n", + " {self.cv_text}\n", + " \n", + " The job vacancy is from the website {self.title}.\n", + " Here is the decription of the vacancy:\n", + " {self.text}\n", + " Please write a cover letter that connects my background to this vacancy.\n", + " Make it persuasive and suitable for Israeli job market.\n", + " \"\"\"\n", + " \n", + " if instructions:\n", + " user_prompt += f\"Additional instructions: {instructions}\"\n", + " self.user_prompt = user_prompt" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9160b9f5-177b-4477-8e54-3a212f275a22", + "metadata": {}, + "outputs": [], + "source": [ + "def cover_letter(url, instructions = \"\"):\n", + " vacancy = Vacancy(url, instructions)\n", + " messages = [\n", + " {\"role\":\"system\", \"content\":vacancy.system_prompt},\n", + " {\"role\":\"user\", \"content\":vacancy.user_prompt}\n", + " ]\n", + " response = openai.chat.completions.create(model='gpt-4o-mini', messages=messages)\n", + " if not response:\n", + " print(\"smt went wrong\")\n", + " print(response.choices[0].message.content)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1de4b55c-a8da-445f-9865-c7a8bafdbc3c", + "metadata": {}, + "outputs": [], + "source": [ + "a = \"https://www.linkedin.com/jobs/view/4285898438/?alternateChannel=search&eBP=CwEAAAGY3R5LOabDLOVTy6xvBcSlWyAkIXQz8IRkSM3rgsqTPtvcEvUSnq980O7oLV2Hh_ldTpc2cBBmRq1IRnLtp7TzEcUvndFEXeCuviA5yo7oFYfW7KoEp4SPNzmf3D9LtnSgk9Iudy3skk6n3hVOtyDpx8Zm0AiTWPvdwCaZ_w5Xu8lAG797NRNDco71ynm99LmCOC9Go7DdDQ2eLewamc4SOsA4xWcXy0GmZVy3kBF1AprK3ylAYR2wrm5-hp4lRpbbfUxXjkEOG6H_GbPpKtN-N8mYnMd9w_cej5qQmTFX86gqSi6HuXFtK0h46TbOS5r-YQksVd1Yb4kYZnDznWXPLbxp04xVJSPzsHoa05wQdOfZ2UUSoMTJmic3n3qfV2u9Bp8n4sLYtINpzKdvm4eADGGkN-nR3O2oPeas9XjGbBwNdjXHAcX_PJoRwlFdQ1gVkYQEF1T7qAfXUJoUt-fv4oLxGnIgV6yJuMgw&refId=9NA7Bvt%2FhCqDkFNRGu1dPA%3D%3D&trackingId=W11hvpcIjHA%2FjU%2FFZ%2B1uAA%3D%3D\"\n", + "b = \"The style of the cover letter should informal, as if i talked to a friend about my background\"\n", + "cover_letter(a, b)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0feb3cbe-686a-4a97-9ca3-a0cb32a24c5d", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python (llms)", + "language": "python", + "name": "llms" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 21028a6bf7257fa646cec72b02c841ecf343d26d Mon Sep 17 00:00:00 2001 From: Levezze Date: Sun, 17 Aug 2025 22:53:12 -0400 Subject: [PATCH 08/25] Add modular 3-way LLM conversation notebook Implements a clean, reusable architecture for multi-LLM conversations: - Unified OpenAI SDK interface for GPT, Claude, and Gemini models - Dynamic role assignment using a dictionary-based configuration - Three distinct personas: snarky arguer, sharp debater, and mediator - Conversation context management across all participants - Interactive display using IPython Markdown rendering The modular `call_llm()` function handles context building and message tracking, making it easy to orchestrate complex multi-agent dialogues. Demonstrates best practices for LLM interaction patterns in the course. --- .../day1_3_way_conversation_levzhitnik.ipynb | 255 ++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 week2/community-contributions/day1_3_way_conversation_levzhitnik.ipynb diff --git a/week2/community-contributions/day1_3_way_conversation_levzhitnik.ipynb b/week2/community-contributions/day1_3_way_conversation_levzhitnik.ipynb new file mode 100644 index 0000000..e5c0388 --- /dev/null +++ b/week2/community-contributions/day1_3_way_conversation_levzhitnik.ipynb @@ -0,0 +1,255 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "596b764a-2ece-4cb0-91c7-5317b8b2c65f", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from dotenv import load_dotenv\n", + "from openai import OpenAI\n", + "from IPython.display import Markdown, display, update_display" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "191079a8-fcb0-45fa-a954-9e92e3baa250", + "metadata": {}, + "outputs": [], + "source": [ + "load_dotenv(override=True)\n", + "openai_api_key = os.getenv('OPENAI_API_KEY')\n", + "anthropic_api_key = os.getenv('ANTHROPIC_API_KEY')\n", + "google_api_key = os.getenv('GOOGLE_API_KEY')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3a0f19ff-c936-469f-9fa1-c09b5c126263", + "metadata": {}, + "outputs": [], + "source": [ + "gpt_model = \"gpt-4.1-mini\"\n", + "claude_model = \"claude-3-5-haiku-latest\"\n", + "gemini_model = \"gemini-2.5-flash\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c1ffa25e-8250-4a86-951a-af44f1369336", + "metadata": {}, + "outputs": [], + "source": [ + "gpt_client = OpenAI(\n", + " api_key=openai_api_key\n", + ")\n", + "\n", + "claude_client = OpenAI(\n", + " api_key=anthropic_api_key,\n", + " base_url=\"https://api.anthropic.com/v1/\"\n", + ")\n", + "\n", + "gemini_client = OpenAI(\n", + " api_key=google_api_key,\n", + " base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\"\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eb8a203d-bdc7-40ee-a456-d47bdc71b07f", + "metadata": {}, + "outputs": [], + "source": [ + "# Tests\n", + "\n", + "messages = [{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n", + " {\"role\": \"user\", \"content\": \"Howdy partner!\"}]\n", + "\n", + "gpt_response = gpt_client.chat.completions.create(\n", + " model=gpt_model,\n", + " messages=messages,\n", + " temperature=0.5\n", + ")\n", + "print(f\"GPT: {gpt_response.choices[0].message.content}\")\n", + "\n", + "claude_response = claude_client.chat.completions.create(\n", + " model=claude_model,\n", + " messages=messages,\n", + " temperature=0.5\n", + ")\n", + "print(f\"Claude: {claude_response.choices[0].message.content}\")\n", + "\n", + "gemini_response = gemini_client.chat.completions.create(\n", + " model=gemini_model,\n", + " messages=messages,\n", + " temperature=0.5\n", + ")\n", + "print(f\"Gemini: {gemini_response.choices[0].message.content}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d140561e-fbf8-4741-b0bd-f850524bd6b3", + "metadata": {}, + "outputs": [], + "source": [ + "gpt_system = \"You are 'user_1'. You are snarky, entitled, and argumentative. Your role is to try and argue about anything and everything, and always have the last word, and never back down.\"\n", + "claude_system = \"You are 'user_2'. You are a sharp debater. You always debate every argument, and you do everything you can to be the debate winner. You don't stop until you have the upper hand.\"\n", + "gemini_system = \"You are 'user_3'. You are a mediator, coach and philosopher. Your job is to bring two sides to an agreement and have them stop arguing.\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b2b26a34-eb36-41c1-be2d-fc8154218897", + "metadata": {}, + "outputs": [], + "source": [ + "apis = {\n", + " \"gpt\": {\n", + " \"name\": \"gpt\",\n", + " \"user_name\": \"Gapetto\",\n", + " \"client\": gpt_client,\n", + " \"model\": gpt_model,\n", + " \"system\": gpt_system,\n", + " \"messages\": [],\n", + " },\n", + " \"claude\": {\n", + " \"name\": \"claude\",\n", + " \"user_name\": \"Claudia\",\n", + " \"client\": claude_client,\n", + " \"model\": claude_model,\n", + " \"system\": claude_system,\n", + " \"messages\": [],\n", + " },\n", + " \"gemini\": {\n", + " \"name\": \"gemini\",\n", + " \"user_name\": \"Germione\",\n", + " \"client\": gemini_client,\n", + " \"model\": gemini_model,\n", + " \"system\": gemini_system,\n", + " \"messages\": []\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "88bb7277-45dc-41b4-827c-b2e5a8b76675", + "metadata": {}, + "outputs": [], + "source": [ + "def call_llm(name: str):\n", + " llm = apis[name]\n", + " context = [{\"role\": \"system\", \"content\": llm[\"system\"]}]\n", + " \n", + " gpt_role, gpt_name = (\"assistant\", \"\") if name == \"gpt\" else (\"user\", f'{apis[\"gpt\"][\"user_name\"]}: ')\n", + " claude_role, claude_name = (\"assistant\", \"\") if name == \"claude\" else (\"user\", f'{apis[\"claude\"][\"user_name\"]}: ')\n", + " gemini_role, gemini_name = (\"assistant\", \"\") if name == \"gemini\" else (\"user\", f'{apis[\"gemini\"][\"user_name\"]}: ')\n", + " \n", + " for gpt, claude, gemini in zip(apis[\"gpt\"][\"messages\"], apis[\"claude\"][\"messages\"], apis[\"gemini\"][\"messages\"]):\n", + " context.append({\"role\": gpt_role, \"content\": f\"{gpt_name}{gpt}\"})\n", + " context.append({\"role\": claude_role, \"content\": f\"{claude_name}{claude}\"})\n", + " context.append({\"role\": gemini_role, \"content\": f\"{gemini_name}{gemini}\"})\n", + " \n", + " for i, key in enumerate(apis.keys()):\n", + " if key != name:\n", + " if len(apis[key][\"messages\"]) > len(llm[\"messages\"]):\n", + " context.append({\"role\": \"user\", \"content\": f'{apis[key][\"user_name\"]}: {apis[key][\"messages\"][-1]}'})\n", + " \n", + " response = llm[\"client\"].chat.completions.create(\n", + " model=llm[\"model\"],\n", + " messages=context,\n", + " temperature=0.7\n", + " )\n", + "\n", + " message = response.choices[0].message.content\n", + " llm[\"messages\"].append(message)\n", + " return message" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4fc73a2e-d8de-4a39-bfa2-67b16c231869", + "metadata": {}, + "outputs": [], + "source": [ + "apis[\"gpt\"][\"messages\"] = [\"Hi\"]\n", + "apis[\"claude\"][\"messages\"] = [\"Hi\"]\n", + "apis[\"gemini\"][\"messages\"] = [\"Lord of the Rings or Harry Potter?\"] # Obviously LOTR." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3810fbaf-94d1-4750-8e13-812d2e05b2d7", + "metadata": {}, + "outputs": [], + "source": [ + "gpt_response = call_llm(\"gpt\")\n", + "display(Markdown(f\"### Gapetto:\\n{gpt_response}\\n\\n\"))\n", + "\n", + "claude_response = call_llm(\"claude\")\n", + "display(Markdown(f\"### Claudia:\\n{claude_response}\\n\\n\"))\n", + "\n", + "gemini_response = call_llm(\"gemini\")\n", + "display(Markdown(f\"### Germione:\\n{gemini_response}\\n\\n\"))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e87b2ffc-6197-401a-97ca-7f51ac1677f2", + "metadata": {}, + "outputs": [], + "source": [ + "apis[\"gpt\"][\"messages\"] = [\"Hi\"]\n", + "apis[\"claude\"][\"messages\"] = [\"Hi\"]\n", + "apis[\"gemini\"][\"messages\"] = [\"Lord of the Rings or Harry Potter?\"]\n", + "\n", + "for i in range(5):\n", + " display(Markdown(f\"## Round {i+1}:\\n\\n\"))\n", + " \n", + " gpt_response = call_llm(\"gpt\")\n", + " display(Markdown(f\"### Gapetto:\\n{gpt_response}\\n\\n\"))\n", + "\n", + " claude_response = call_llm(\"claude\")\n", + " display(Markdown(f\"### Claudia:\\n{claude_response}\\n\\n\"))\n", + "\n", + " gemini_response = call_llm(\"gemini\")\n", + " display(Markdown(f\"### Germione:\\n{gemini_response}\\n\\n\"))" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 262e17b399ac2d84d0f02ed216f586c73b6177bc Mon Sep 17 00:00:00 2001 From: Arundhati Date: Mon, 25 Aug 2025 13:51:27 -0400 Subject: [PATCH 09/25] Added gemini to dropdown task to community-contributions --- .../AddingGeminiToDropdown.ipynb | 223 ++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 week2/community-contributions/AddingGeminiToDropdown.ipynb diff --git a/week2/community-contributions/AddingGeminiToDropdown.ipynb b/week2/community-contributions/AddingGeminiToDropdown.ipynb new file mode 100644 index 0000000..656a542 --- /dev/null +++ b/week2/community-contributions/AddingGeminiToDropdown.ipynb @@ -0,0 +1,223 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "057bc09f-a682-4b72-97ed-c69ddef3f03e", + "metadata": {}, + "source": [ + "# Gemini to Dropdown" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d66eb067-7bae-4145-b613-6da2f40fbf27", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "import requests\n", + "from bs4 import BeautifulSoup\n", + "from typing import List\n", + "from dotenv import load_dotenv\n", + "from openai import OpenAI\n", + "import google.generativeai as genai\n", + "import anthropic" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e36f8a93-8a65-48f2-bcad-7c47dd72ef3a", + "metadata": {}, + "outputs": [], + "source": [ + "import gradio as gr " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8a5ec1b0-f5b4-46d2-abb0-b28b73cc4d28", + "metadata": {}, + "outputs": [], + "source": [ + "load_dotenv(override=True)\n", + "openai_api_key = os.getenv('OPENAI_API_KEY')\n", + "anthropic_api_key = os.getenv('ANTHROPIC_API_KEY')\n", + "google_api_key = os.getenv('GOOGLE_API_KEY')\n", + "\n", + "if openai_api_key:\n", + " print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n", + "else:\n", + " print(\"OpenAI API Key not set\")\n", + " \n", + "if anthropic_api_key:\n", + " print(f\"Anthropic API Key exists and begins {anthropic_api_key[:7]}\")\n", + "else:\n", + " print(\"Anthropic API Key not set\")\n", + "\n", + "if google_api_key:\n", + " print(f\"Google API Key exists and begins {google_api_key[:8]}\")\n", + "else:\n", + " print(\"Google API Key not set\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "26d0099c-890f-4358-8c1d-7a708abcb105", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "openai = OpenAI()\n", + "\n", + "claude = anthropic.Anthropic()\n", + "\n", + "google.generativeai.configure()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6606bfdb-964e-4d6f-b2a1-5017b99aa23d", + "metadata": {}, + "outputs": [], + "source": [ + "system_message = \"You are a helpful assistant\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e0cfb96a-2dbe-4228-8efb-75947dbc3228", + "metadata": {}, + "outputs": [], + "source": [ + "def stream_gpt(prompt):\n", + " messages = [\n", + " {\"role\": \"system\", \"content\": system_message},\n", + " {\"role\": \"user\", \"content\": prompt}\n", + " ]\n", + " stream = openai.chat.completions.create(\n", + " model='gpt-4o-mini',\n", + " messages=messages,\n", + " stream=True\n", + " )\n", + " result = \"\"\n", + " for chunk in stream:\n", + " result += chunk.choices[0].delta.content or \"\"\n", + " yield result" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9008a15d-0ee8-44e0-b123-225e7148113e", + "metadata": {}, + "outputs": [], + "source": [ + "def stream_claude(prompt):\n", + " result = claude.messages.stream(\n", + " model=\"claude-3-haiku-20240307\",\n", + " max_tokens=1000,\n", + " temperature=0.7,\n", + " system=system_message,\n", + " messages=[\n", + " {\"role\": \"user\", \"content\": prompt},\n", + " ],\n", + " )\n", + " response = \"\"\n", + " with result as stream:\n", + " for text in stream.text_stream:\n", + " response += text or \"\"\n", + " yield response" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "378ad12e-6645-4647-807c-00995e360268", + "metadata": {}, + "outputs": [], + "source": [ + "def stream_gemini(prompt):\n", + " gemini = genai.GenerativeModel(\n", + " model_name=\"gemini-2.0-flash\",\n", + " system_instruction=system_message\n", + " )\n", + " \n", + " stream = gemini.generate_content(prompt, stream=True)\n", + " \n", + " result = \"\"\n", + " for chunk in stream:\n", + " try:\n", + " part = chunk.text\n", + " if part:\n", + " result += part\n", + " yield result \n", + " except Exception as e:\n", + " print(\"Chunk error:\", e)\n", + " \n", + " \n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd50e143-eead-49b1-8ea3-b440becd4bc9", + "metadata": {}, + "outputs": [], + "source": [ + "def stream_model(prompt, model):\n", + " if model==\"GPT\":\n", + " result = stream_gpt(prompt)\n", + " elif model==\"Claude\":\n", + " result = stream_claude(prompt)\n", + " elif model==\"Gemini\":\n", + " result = stream_gemini(prompt)\n", + " else:\n", + " raise ValueError(\"Unknown model\")\n", + " yield from result" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c7fc9cb4-fbb8-4301-86a6-96c90f67eb3b", + "metadata": {}, + "outputs": [], + "source": [ + "view = gr.Interface(\n", + " fn=stream_model,\n", + " inputs=[gr.Textbox(label=\"Your message:\"), gr.Dropdown([\"GPT\", \"Claude\",\"Gemini\"], label=\"Select model\", value=\"GPT\")],\n", + " outputs=[gr.Markdown(label=\"Response:\")],\n", + " flagging_mode=\"never\"\n", + ")\n", + "view.launch()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 6b528cf5d5dd1a71d4ba915a1b4abf8a0d712824 Mon Sep 17 00:00:00 2001 From: Rohit Nain Date: Tue, 26 Aug 2025 09:36:53 +0530 Subject: [PATCH 10/25] build a tool that take technical questions and responds with an explanation with Openai and Ollama --- .../week-1_exercise.ipynb | 337 ++++++++++++++++++ 1 file changed, 337 insertions(+) create mode 100644 week1/community-contributions/week-1_exercise.ipynb diff --git a/week1/community-contributions/week-1_exercise.ipynb b/week1/community-contributions/week-1_exercise.ipynb new file mode 100644 index 0000000..5072bc1 --- /dev/null +++ b/week1/community-contributions/week-1_exercise.ipynb @@ -0,0 +1,337 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "64d2e4a0", + "metadata": {}, + "source": [ + "# End of Week 1 Exercise\n", + "\n", + "To demonstrate your familiarity with OpenAI API, and also Ollama, build a tool that takes a technical question,\n", + "and responds with an explanation. This is a tool that you will be able to use yourself during the course!" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "e62b915e", + "metadata": {}, + "outputs": [], + "source": [ + "from openai import OpenAI\n", + "import ollama\n", + "from dotenv import load_dotenv\n", + "import os\n", + "from IPython.display import display, update_display, Markdown" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "8bdfc47a", + "metadata": {}, + "outputs": [], + "source": [ + "MODEL_GPT = 'gpt-4o-mini'\n", + "MODEL_LLAMA = 'llama3'\n", + "load_dotenv()\n", + "\n", + "api_key = os.getenv('OPENAI_API_KEY')\n", + "\n", + "openai=OpenAI()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "57983d03", + "metadata": {}, + "outputs": [], + "source": [ + "def create_messages(prompt=\"Describe some of the business applications of Generative AI\"):\n", + " \"\"\"Create properly formatted messages for API calls\"\"\"\n", + " messages = [\n", + " {\n", + " \"role\": \"system\",\n", + " \"content\": \"You are a helpful technical assistant that provides clear, detailed explanations for technical questions.\"\n", + " },\n", + " {\"role\": \"user\", \"content\": prompt}\n", + " ]\n", + " return messages" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "a6bcb94d", + "metadata": {}, + "outputs": [], + "source": [ + "def answer_with_openai(prompt=\"Describe some of the business applications of Generative AI\"):\n", + " \"\"\"Get answer using OpenAI API and print in stream\"\"\"\n", + " try:\n", + " messages = create_messages(prompt)\n", + " stream = openai.chat.completions.create(\n", + " model=MODEL_GPT,\n", + " messages=messages,\n", + " temperature=0.7,\n", + " stream=True\n", + " )\n", + " answer = \"\"\n", + " display_handle = display(Markdown(\"\"), display_id=True)\n", + " for chunk in stream:\n", + " if chunk.choices[0].delta.content:\n", + " answer += chunk.choices[0].delta.content\n", + " # Clean up markdown formatting for display\n", + " clean_answer = answer.replace(\"```\", \"\").replace(\"markdown\", \"\")\n", + " update_display(Markdown(clean_answer), display_id=display_handle.display_id)\n", + " return answer\n", + " except Exception as e:\n", + " return f\"Error with OpenAI: {str(e)}\"\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "e96159ab", + "metadata": {}, + "outputs": [], + "source": [ + "def answer_with_ollama(prompt=\"Describe some of the business applications of Generative AI\"):\n", + " \"\"\"Get answer using Ollama API and print in stream\"\"\"\n", + " try:\n", + " messages = create_messages(prompt)\n", + " stream = ollama.chat(\n", + " model=MODEL_LLAMA,\n", + " messages=messages,\n", + " stream=True\n", + " )\n", + " answer = \"\"\n", + " display_handle = display(Markdown(\"\"), display_id=True)\n", + " for chunk in stream:\n", + " if chunk['message']['content']:\n", + " answer += chunk['message']['content']\n", + " # Clean up markdown formatting for display\n", + " clean_answer = answer.replace(\"```\", \"\").replace(\"markdown\", \"\")\n", + " update_display(Markdown(clean_answer), display_id=display_handle.display_id)\n", + " return answer\n", + " except Exception as e:\n", + " return f\"Error with Ollama: {str(e)}\"" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "ab72f8b6", + "metadata": {}, + "outputs": [], + "source": [ + "def technical_qa_tool(question, use_openai=True, use_ollama=True):\n", + " \"\"\"Main function to get technical explanations from both APIs\"\"\"\n", + " print(f\"Question: {question}\")\n", + " print(\"=\" * 80)\n", + " \n", + " if use_openai:\n", + " print(\"\\n🤖 OpenAI Response:\")\n", + " print(\"-\" * 40)\n", + " answer_with_openai(question)\n", + " \n", + " if use_ollama:\n", + " print(\"\\n🦙 Ollama Response:\")\n", + " print(\"-\" * 40)\n", + " answer_with_ollama(question)\n", + " # display(Markdown(ollama_answer))\n", + " \n", + " print(\"\\n\" + \"=\" * 80)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "1a6aa4a2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Question: What is the difference between supervised and unsupervised machine learning?\n", + "================================================================================\n", + "\n", + "🤖 OpenAI Response:\n", + "----------------------------------------\n" + ] + }, + { + "data": { + "text/markdown": [ + "Supervised and unsupervised machine learning are two primary categories of machine learning techniques, and they differ mainly in how they learn from data and the type of problems they are used to solve. Here’s a detailed explanation of each:\n", + "\n", + "### Supervised Machine Learning\n", + "\n", + "**Definition**: In supervised learning, the model is trained on a labeled dataset, meaning that each training example is paired with an output label. The goal is to learn a mapping from inputs (features) to the output labels.\n", + "\n", + "**Characteristics**:\n", + "- **Labeled Data**: Requires a dataset that includes both the input features and the corresponding output labels.\n", + "- **Objective**: The objective is to predict the output for new, unseen data based on the learned mapping from the training data.\n", + "- **Common Techniques**:\n", + " - **Regression**: For predicting continuous values (e.g., predicting house prices).\n", + " - **Classification**: For predicting discrete labels (e.g., spam detection in emails).\n", + "- **Examples**:\n", + " - Predicting whether an email is spam or not based on various features (classification).\n", + " - Forecasting sales figures based on historical sales data (regression).\n", + "\n", + "### Unsupervised Machine Learning\n", + "\n", + "**Definition**: In unsupervised learning, the model is trained on data that is not labeled, meaning that it does not have predefined output labels. The goal is to discover patterns, groupings, or structures within the data.\n", + "\n", + "**Characteristics**:\n", + "- **Unlabeled Data**: Works with datasets that only have input features without any associated output labels.\n", + "- **Objective**: The objective is to explore the data and find hidden patterns or intrinsic structures without specific guidance.\n", + "- **Common Techniques**:\n", + " - **Clustering**: Grouping similar data points together (e.g., customer segmentation).\n", + " - **Dimensionality Reduction**: Reducing the number of features while retaining essential information (e.g., PCA - Principal Component Analysis).\n", + "- **Examples**:\n", + " - Grouping customers into segments based on purchasing behavior (clustering).\n", + " - Reducing the dimensionality of a dataset to visualize it in two or three dimensions (dimensionality reduction).\n", + "\n", + "### Key Differences\n", + "\n", + "1. **Data Type**:\n", + " - Supervised Learning: Requires labeled data.\n", + " - Unsupervised Learning: Works with unlabeled data.\n", + "\n", + "2. **Goal**:\n", + " - Supervised Learning: To learn a function that maps inputs to the correct outputs.\n", + " - Unsupervised Learning: To identify patterns or groupings in the input data.\n", + "\n", + "3. **Applications**:\n", + " - Supervised Learning: Typically used in scenarios where past data with known outcomes is available (e.g., fraud detection, image classification).\n", + " - Unsupervised Learning: Used for exploratory data analysis or when the outcome is not known (e.g., market basket analysis, anomaly detection).\n", + "\n", + "In summary, the primary difference between supervised and unsupervised machine learning lies in the presence or absence of labeled data and the objectives of the learning process. Supervised learning aims to predict outcomes based on existing labels, while unsupervised learning seeks to identify hidden structures in data without predefined labels." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "🦙 Ollama Response:\n", + "----------------------------------------\n" + ] + }, + { + "data": { + "text/markdown": [ + "In machine learning, there are two main categories: supervised and unsupervised learning. The key difference lies in the type of data used to train the model and the goal of the learning process.\n", + "\n", + "**Supervised Learning**\n", + "\n", + "In supervised learning, you have a labeled dataset that contains both input data (features) and corresponding output labels or target variables. The goal is to learn a mapping between the input data and the output labels so that the model can make accurate predictions on new, unseen data.\n", + "\n", + "Here are some characteristics of supervised learning:\n", + "\n", + "1. Labeled training data: You have a dataset with input data and corresponding output labels.\n", + "2. Specific goal: You want to predict the output label for a given input instance.\n", + "3. Model evaluation: You evaluate the performance of your model using metrics like accuracy, precision, recall, F1 score, etc.\n", + "\n", + "Examples of supervised learning tasks include:\n", + "\n", + "* Image classification (e.g., recognizing dogs vs. cats)\n", + "* Sentiment analysis (e.g., determining if text is positive or negative)\n", + "* Regression problems (e.g., predicting house prices based on features like number of bedrooms and square footage)\n", + "\n", + "**Unsupervised Learning**\n", + "\n", + "In unsupervised learning, you have an unlabeled dataset, and the goal is to discover patterns, relationships, or structure in the data without a specific target variable. This type of learning is often used for exploratory data analysis, feature selection, and dimensionality reduction.\n", + "\n", + "Here are some characteristics of unsupervised learning:\n", + "\n", + "1. Unlabeled training data: You have a dataset with only input features (no output labels).\n", + "2. No specific goal: You want to find interesting patterns or structure in the data.\n", + "3. Model evaluation: You evaluate the performance of your model using metrics like silhouette score, Calinski-Harabasz index, etc.\n", + "\n", + "Examples of unsupervised learning tasks include:\n", + "\n", + "* Clustering (e.g., grouping customers based on their purchase history)\n", + "* Dimensionality reduction (e.g., reducing the number of features in a dataset while preserving important information)\n", + "* Anomaly detection (e.g., identifying unusual behavior or outliers in financial transactions)\n", + "\n", + "In summary, supervised learning involves training a model to make predictions based on labeled data, whereas unsupervised learning aims to discover patterns and relationships in unlabeled data." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "================================================================================\n" + ] + } + ], + "source": [ + "# Test the tool with a technical question\n", + "technical_question = \"What is the difference between supervised and unsupervised machine learning?\"\n", + "technical_qa_tool(technical_question)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0a976ce1", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9b0a539e", + "metadata": {}, + "outputs": [], + "source": [ + "# Interactive version - uncomment to use\n", + "# user_question = input(\"Enter your technical question: \")\n", + "# technical_qa_tool(user_question)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From aa7fc8c7bd5e71ca98356569246390d3574c4640 Mon Sep 17 00:00:00 2001 From: Oluwaseyi-A <62573285+Oluwaseyi-A@users.noreply.github.com> Date: Tue, 26 Aug 2025 17:06:44 -0400 Subject: [PATCH 11/25] Add week4 challenge to community-contributions --- .../unit-test-generator-v3.ipynb | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 week4/community-contributions/unit-test-generator-v3.ipynb diff --git a/week4/community-contributions/unit-test-generator-v3.ipynb b/week4/community-contributions/unit-test-generator-v3.ipynb new file mode 100644 index 0000000..c47b6d0 --- /dev/null +++ b/week4/community-contributions/unit-test-generator-v3.ipynb @@ -0,0 +1,222 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "56957b7f-e289-4999-8a40-ce1a8378d8cd", + "metadata": {}, + "source": [ + "# Unit Test Generator\n", + "\n", + "The requirement: use a Frontier model to generate fast and repeatable unit tests for Python code.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3ef67ef0-1bda-45bb-abca-f003217602d4", + "metadata": {}, + "outputs": [], + "source": [ + "# imports\n", + "\n", + "import os\n", + "import io\n", + "import sys\n", + "import ast\n", + "import unittest, contextlib\n", + "from dotenv import load_dotenv\n", + "from openai import OpenAI\n", + "import google.generativeai\n", + "import anthropic\n", + "from IPython.display import Markdown, display, update_display\n", + "import gradio as gr\n", + "import subprocess\n", + "\n", + "# environment\n", + "\n", + "load_dotenv(override=True)\n", + "os.environ['OPENAI_API_KEY'] = os.getenv('OPENAI_API_KEY', 'your-key-if-not-using-env')\n", + "os.environ['ANTHROPIC_API_KEY'] = os.getenv('ANTHROPIC_API_KEY', 'your-key-if-not-using-env')\n", + "\n", + "openai = OpenAI()\n", + "claude = anthropic.Anthropic()\n", + "OPENAI_MODEL = \"gpt-4o\"\n", + "CLAUDE_MODEL = \"claude-3-7-sonnet-20250219\"\n", + "\n", + "system_message = \"You are an assistant that implements unit testing for Python code. \"\n", + "system_message += \"Respond only with Python code; use comments sparingly and do not provide any explanation other than occasional comments. \"\n", + "\n", + "def remove_main_block_from_code(code):\n", + " \"\"\"\n", + " Remove top-level `if __name__ == \"__main__\":` blocks from code.\n", + " \"\"\"\n", + " try:\n", + " tree = ast.parse(code)\n", + "\n", + " class RemoveMain(ast.NodeTransformer):\n", + " def visit_If(self, node):\n", + " # check if this is: if __name__ == \"__main__\":\n", + " test = node.test\n", + " if (\n", + " isinstance(test, ast.Compare) and\n", + " isinstance(test.left, ast.Name) and\n", + " test.left.id == \"__name__\" and\n", + " len(test.ops) == 1 and isinstance(test.ops[0], ast.Eq) and\n", + " len(test.comparators) == 1 and\n", + " isinstance(test.comparators[0], ast.Constant) and\n", + " test.comparators[0].value == \"__main__\"\n", + " ):\n", + " return None # remove this node entirely\n", + " return node\n", + "\n", + " tree = RemoveMain().visit(tree)\n", + " ast.fix_missing_locations(tree)\n", + " return ast.unparse(tree) # get back code as string\n", + " except Exception as e:\n", + " print(\"Error removing __main__ block:\", e)\n", + " return code # fallback: return original code if AST fails\n", + "\n", + "def user_prompt_for(python_file):\n", + " if isinstance(python_file, dict): # from Gradio\n", + " file_path = python_file[\"name\"]\n", + " elif hasattr(python_file, \"name\"): # tempfile\n", + " file_path = python_file.name\n", + " else: # string path\n", + " file_path = python_file\n", + "\n", + " with open(file_path, \"r\", encoding=\"utf-8\") as f:\n", + " python_code = f.read()\n", + "\n", + " # strip __main__ blocks\n", + " python_code = remove_main_block_from_code(python_code)\n", + "\n", + " user_prompt = \"Write unit tests for this Python code. \"\n", + " user_prompt += \"Respond only with Python code; do not explain your work other than a few comments. \"\n", + " user_prompt += \"The unit testing is done in Jupyterlab, so you should use packages that play nicely with the Jupyter kernel. \\n\\n\"\n", + " user_prompt += \"Include the original Python code in your generated output so that I can run all in one fell swoop.\\n\\n\"\n", + " user_prompt += python_code\n", + "\n", + " return user_prompt\n", + "\n", + "def messages_for(python_file):\n", + " return [\n", + " {\"role\": \"system\", \"content\": system_message},\n", + " {\"role\": \"user\", \"content\": user_prompt_for(python_file)}\n", + " ]\n", + "\t\n", + "def stream_gpt(python_file): \n", + " stream = openai.chat.completions.create(model=OPENAI_MODEL, messages=messages_for(python_file), stream=True)\n", + " reply = \"\"\n", + " for chunk in stream:\n", + " fragment = chunk.choices[0].delta.content or \"\"\n", + " reply += fragment\n", + " yield reply.replace('```python\\n','').replace('```','')\n", + "\t\t\n", + "def stream_claude(python_file):\n", + " result = claude.messages.stream(\n", + " model=CLAUDE_MODEL,\n", + " max_tokens=2000,\n", + " system=system_message,\n", + " messages=[{\"role\": \"user\", \"content\": user_prompt_for(python_file)}],\n", + " )\n", + " reply = \"\"\n", + " with result as stream:\n", + " for text in stream.text_stream:\n", + " reply += text\n", + " yield reply.replace('```python\\n','').replace('```','')\n", + "\t\t\t\n", + "def unit_test(python_file, model):\n", + " if model==\"GPT\":\n", + " result = stream_gpt(python_file)\n", + " elif model==\"Claude\":\n", + " result = stream_claude(python_file)\n", + " else:\n", + " raise ValueError(\"Unknown model\")\n", + " for stream_so_far in result:\n", + " yield stream_so_far\n", + "\n", + "def execute_python(code):\n", + " buffer = io.StringIO()\n", + " try:\n", + " with contextlib.redirect_stdout(buffer), contextlib.redirect_stderr(buffer):\n", + " # execute code in isolated namespace\n", + " ns = {}\n", + " exec(code, ns)\n", + "\n", + " # manually collect TestCase subclasses\n", + " test_cases = [\n", + " obj for obj in ns.values()\n", + " if isinstance(obj, type) and issubclass(obj, unittest.TestCase)\n", + " ]\n", + " if test_cases:\n", + " suite = unittest.TestSuite()\n", + " for case in test_cases:\n", + " suite.addTests(unittest.defaultTestLoader.loadTestsFromTestCase(case))\n", + " runner = unittest.TextTestRunner(stream=buffer, verbosity=2)\n", + " runner.run(suite)\n", + " except Exception as e:\n", + " print(f\"Error during execution: {e}\", file=buffer)\n", + "\n", + " return buffer.getvalue()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "670b8b78-0b13-488a-9533-59802b2fe101", + "metadata": {}, + "outputs": [], + "source": [ + "# --- Gradio UI ---\n", + "with gr.Blocks() as ui:\n", + " gr.Markdown(\"## Unit Test Generator\\nUpload a Python file and get structured unit testing.\")\n", + " with gr.Row(): # Row 1\n", + " orig_code = gr.File(label=\"Upload your Python file\", file_types=[\".py\"])\n", + " test_code = gr.Textbox(label=\"Unit test code:\", lines=10)\n", + " with gr.Row(): # Row 2\n", + " model = gr.Dropdown([\"GPT\", \"Claude\"], label=\"Select model\", value=\"GPT\")\n", + " with gr.Row(): # Row 3\n", + " generate = gr.Button(\"Generate unit test code\")\n", + " with gr.Row(): # Row 4\n", + " unit_run = gr.Button(\"Run Python unit test\")\n", + " with gr.Row(): # Row 5\n", + " test_out = gr.Textbox(label=\"Unit test result:\", lines=10)\n", + "\n", + " generate.click(unit_test, inputs=[orig_code, model], outputs=[test_code])\n", + "\n", + " unit_run.click(execute_python, inputs=[test_code], outputs=[test_out])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "609bbdc3-1e1c-4538-91dd-7d13134ab381", + "metadata": {}, + "outputs": [], + "source": [ + "ui.launch(inbrowser=True)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 4176d43e1a35f8cbd59b5d7cbffc3ff0ddb4ace0 Mon Sep 17 00:00:00 2001 From: Kwon Lee Date: Wed, 27 Aug 2025 09:23:06 -0800 Subject: [PATCH 12/25] added a microsoft edge driver solution by refactoring an existing chrome driver selenium solution --- .../day1_selenium_microsoftedgedriver.ipynb | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 week1/community-contributions/day1_selenium_microsoftedgedriver.ipynb diff --git a/week1/community-contributions/day1_selenium_microsoftedgedriver.ipynb b/week1/community-contributions/day1_selenium_microsoftedgedriver.ipynb new file mode 100644 index 0000000..c2e6b86 --- /dev/null +++ b/week1/community-contributions/day1_selenium_microsoftedgedriver.ipynb @@ -0,0 +1,123 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3ba06289-d17a-4ccd-85f5-2b79956d4e59", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install selenium" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "935fe7b1-1807-4f75-863d-4c118e425a19", + "metadata": {}, + "outputs": [], + "source": [ + "pip show selenium" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eabbbc62-1de1-4883-9b3e-9c90145ea6c5", + "metadata": {}, + "outputs": [], + "source": [ + "from selenium import webdriver\n", + "from selenium.webdriver.edge.options import Options as EdgeOptions # Import EdgeOptions\n", + "from selenium.webdriver.edge.service import Service as EdgeService # Import EdgeService\n", + "from bs4 import BeautifulSoup\n", + "import time\n", + "import os\n", + "\n", + "class Website:\n", + " def __init__(self, url, driver_path=None, wait_time=3):\n", + " self.url = url\n", + " self.wait_time = wait_time\n", + "\n", + " # Headless Edge settings\n", + " options = EdgeOptions() # Use EdgeOptions\n", + " # options.add_argument(\"--headless\")\n", + " options.add_argument(\"--disable-gpu\")\n", + " options.add_argument(\"--no-sandbox\")\n", + " options.add_argument(\"--window-size=1920x1080\")\n", + "\n", + " # Driver path\n", + " if driver_path:\n", + " # For Edge, you might need to specify the path to msedgedriver\n", + " # For driver download, https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/?form=MA13LH#downloads\n", + " service = EdgeService(executable_path=driver_path) # Use EdgeService\n", + " else:\n", + " # If msedgedriver.exe is in your system's PATH, you can omit executable_path\n", + " service = EdgeService()\n", + "\n", + " # Start browser\n", + " # Use webdriver.Edge() for Microsoft Edge\n", + " driver = webdriver.Edge(service=service, options=options)\n", + " driver.get(url)\n", + "\n", + " # Wait for the loading page\n", + " time.sleep(self.wait_time)\n", + "\n", + " # Take page source\n", + " html = driver.page_source\n", + " driver.quit()\n", + "\n", + " # Analysis with BeautifulSoup \n", + " soup = BeautifulSoup(html, 'html.parser')\n", + " self.title = soup.title.string if soup.title else \"No title found\"\n", + "\n", + " # Clean irrelevant tags\n", + " for irrelevant in soup.body([\"script\", \"style\", \"img\", \"input\"]):\n", + " irrelevant.decompose()\n", + "\n", + " self.text = soup.body.get_text(separator=\"\\n\", strip=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "852c52e2-bd4d-4bb9-94ef-e498c33f1a89", + "metadata": {}, + "outputs": [], + "source": [ + "site = Website(\"https://openai.com\", driver_path=\"/Users/klee/Documents/edgedriver_mac64_m1/msedgedriver\")\n", + "print(\"Title:\", site.title)\n", + "print(\"\\nFirst 500 character:\\n\", site.text[:500])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7620c685-c35c-4d6b-aaf1-a3da98f19ca7", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 372f4ee82dbe81ecc559b162f9501fd335830cb0 Mon Sep 17 00:00:00 2001 From: Kartik Date: Thu, 28 Aug 2025 02:05:04 +0530 Subject: [PATCH 13/25] tools implemented --- week2/stock-api-day5.ipynb | 1180 ++++++++++++++++++++++++++++++++++++ 1 file changed, 1180 insertions(+) create mode 100644 week2/stock-api-day5.ipynb diff --git a/week2/stock-api-day5.ipynb b/week2/stock-api-day5.ipynb new file mode 100644 index 0000000..92d0769 --- /dev/null +++ b/week2/stock-api-day5.ipynb @@ -0,0 +1,1180 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "bcb31876-4d8c-41ef-aa24-b8c78dfd5808", + "metadata": {}, + "source": [ + "# Project - Stock Information AI Assistant\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b7bd1bd7-19d9-4c4b-bc4b-9bc9cca8bd0f", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install finnhub-python" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8b50bbe2-c0b1-49c3-9a5c-1ba7efa2bcb4", + "metadata": {}, + "outputs": [], + "source": [ + "# imports\n", + "\n", + "import os\n", + "import json\n", + "from dotenv import load_dotenv\n", + "from openai import OpenAI\n", + "import gradio as gr\n", + "import finnhub\n", + "from typing import Dict, List, Any, Optional\n", + "from datetime import datetime" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "747e8786-9da8-4342-b6c9-f5f69c2e22ae", + "metadata": {}, + "outputs": [], + "source": [ + "# Initialization\n", + "\n", + "load_dotenv(override=True)\n", + "\n", + "openai_api_key = os.getenv('OPENAI_API_KEY')\n", + "FINNHUB_API_KEY = os.getenv(\"FINNHUB_API_KEY\")\n", + "\n", + "if openai_api_key:\n", + " print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n", + "else:\n", + " print(\"OpenAI API Key not set\")\n", + "\n", + "if FINNHUB_API_KEY:\n", + " print(f\"FINNHUB_API_KEY exists!\")\n", + "else:\n", + " print(\"OpenAI API Key not set\")\n", + " \n", + "MODEL = \"gpt-5-mini\"\n", + "openai = OpenAI()\n", + "finnhub_client = finnhub.Client(api_key=FINNHUB_API_KEY)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ee3aaa9a-5495-42fd-a382-803fbfa92eaf", + "metadata": {}, + "outputs": [], + "source": [ + "system_message += f\"\"\"\n", + "You are called \"TickerBot\", You are a helpful stock information assistant specializing in US stocks. You provide factual, educational information without investment advice. You have access to tools for:\n", + "- Stock symbol lookup\n", + "- Real-time quotes\n", + "- Company Financials\n", + "- Company News\n", + "- Market overview\n", + "\n", + "### **Core Principles**\n", + "**Educational Focus**: Explain financial metrics clearly and keep an educational tone.\n", + "**Factual**: NEVER give buy/sell advice or predictions.\n", + "**Accurate always**: If no data is available, inform the user in a friendly way. Always be accurate. If you don't know the answer, simply say so. Do not make up your own stock details information.\n", + "\n", + "### **How to Handle Different Requests**\n", + "- For all temporal reasoning in this chat you can use `get_current_time()` tool to get time and then relative to current time you can proceed.\n", + "- When users mention companies, search for symbols with the tool `search_symbol()` else proceed directly if obvious match\n", + "- Try to search for news or data for only for a maximum of 1 month time range, else it becomes a lot of data to parse. If user asks for recent news just check the last 5 days from today; For example if today is 10-06-2025, use from=\"2025-06-05\", to=\"2025-06-10\"\n", + "\n", + "**Single Stock Comprehensive Analysis** (Use very judicially as it is time taking tool, only when user definitely needs a complete overview or multiple things that you would otherwise need to call multiple tools for):\n", + "- User asks about \"Apple\" or \"AAPL\" → Use all company specific tools that you deem necessary. \n", + "- Present a comprehensive analysis with current price, key metrics, and recent developments\n", + "\n", + "**Market Overview Requests**:\n", + "- \"What's happening in the market?\" → Use `get_market_overview(\"general\")`\n", + "- Summarize all news stories with very brief analysis\n", + "\n", + "### **Error Handling**\n", + "- If symbol search fails: \"I couldn't find that company in US markets. Could you try a different name or provide the ticker symbol?\"\n", + "- If some information gathered from the tool call says unavailable or error do not present it to the user unless they had specifically asked for it. Present rest of the gathered information if any.\n", + "- If data is unavailable: \"Some data isn't available right now, but here's what I found...\"\n", + "- Stay helpful and suggest alternatives\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "61a2a15d-b559-4844-b377-6bd5cb4949f6", + "metadata": {}, + "outputs": [], + "source": [ + "def validate_symbol(symbol: str) -> bool:\n", + " \"\"\"Validate stock symbol format\"\"\"\n", + " if not symbol or not isinstance(symbol, str):\n", + " return False\n", + " return symbol.isalnum() and 1 <= len(symbol) <= 5 and symbol.isupper()\n", + "\n", + "def search_symbol(query: str) -> Dict[str, Any]:\n", + " \"\"\"Search for stock symbol using Finnhub client\"\"\"\n", + " print(f\"Tool search_symbol called for {query}\")\n", + " try:\n", + " if not query or len(query.strip()) < 1:\n", + " return {\"success\": False, \"error\": \"Invalid search query\"}\n", + " \n", + " query = query.strip()[:50]\n", + " result = finnhub_client.symbol_lookup(query)\n", + " \n", + " if result.get(\"result\") and len(result[\"result\"]) > 0:\n", + " first_result = result[\"result\"][0]\n", + " symbol = first_result.get(\"symbol\", \"\").upper()\n", + " \n", + " if validate_symbol(symbol):\n", + " return {\n", + " \"success\": True,\n", + " \"symbol\": symbol\n", + " }\n", + " else:\n", + " return {\"success\": False, \"error\": \"Invalid symbol format found\"}\n", + " else:\n", + " return {\"success\": False, \"error\": \"No matching US stocks found\"}\n", + " \n", + " except Exception as e:\n", + " return {\"success\": False, \"error\": f\"Symbol search failed: {str(e)[:100]}\"}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "173010e3-dfef-4611-8b68-d11256bd5fba", + "metadata": {}, + "outputs": [], + "source": [ + "search_symbol_function = {\n", + " \"name\": \"search_symbol\",\n", + " \"description\": \"Search for a stock symbol / ticker symbol based on company name or partial name\",\n", + " \"parameters\": {\n", + " \"type\": \"object\",\n", + " \"properties\": {\n", + " \"query\": {\n", + " \"type\": \"string\",\n", + " \"description\": \"Company name or partial name to search for, extract only relevant name part and pass it here, keep this to less than 50 characters\"\n", + " }\n", + " },\n", + " \"required\": [\n", + " \"query\"\n", + " ]\n", + " }\n", + "}\n", + "\n", + "search_symbol_tool = {\"type\": \"function\", \"function\": search_symbol_function}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "448bb4ce-8e86-4ceb-ab52-96bddfd33337", + "metadata": {}, + "outputs": [], + "source": [ + "def _format_big_number_from_millions(value_millions: Any) -> str:\n", + " \"\"\"\n", + " Finnhub returns some large metrics (marketCapitalization, enterpriseValue, revenueTTM)\n", + " in MILLIONS USD. Convert to full USD and format with M/B/T suffixes.\n", + " \"\"\"\n", + " if value_millions is None:\n", + " return \"Unavailable\"\n", + " try:\n", + " value = float(value_millions) * 1_000_000 # convert millions -> full USD\n", + " except (TypeError, ValueError):\n", + " return \"Unavailable\"\n", + "\n", + " trillion = 1_000_000_000_000\n", + " billion = 1_000_000_000\n", + " million = 1_000_000\n", + "\n", + " if value >= trillion:\n", + " return f\"{value / trillion:.2f}T USD\"\n", + " if value >= billion:\n", + " return f\"{value / billion:.2f}B USD\"\n", + " if value >= million:\n", + " return f\"{value / million:.2f}M USD\"\n", + " return f\"{value:.2f} USD\"\n", + "\n", + "\n", + "def _safe_metric(metrics: Dict[str, Any], key: str) -> Any:\n", + " \"\"\"\n", + " Return metric value if present; otherwise \"Unavailable\".\n", + " We intentionally return the raw value for numeric metrics (no rounding/format)\n", + " except for the specially formatted big-number fields handled elsewhere.\n", + " \"\"\"\n", + " if metrics is None:\n", + " return \"Unavailable\"\n", + " val = metrics.get(key)\n", + " return val if val is not None else \"Unavailable\"\n", + "\n", + "\n", + "def get_company_financials(symbol: str) -> Dict[str, Any]:\n", + " \"\"\"\n", + " Fetch and return a curated set of 'basic' financial metrics for `symbol`.\n", + " - Calls finnhub_client.company_basic_financials(symbol, 'all')\n", + " - Formats market cap, enterprise value, revenue (Finnhub returns these in millions)\n", + " - Returns success flag and readable keys\n", + " \"\"\"\n", + " print(f\"Tool get_company_financials called for {symbol}\")\n", + " try:\n", + " if not symbol or not symbol.strip():\n", + " return {\"success\": False, \"error\": \"Invalid stock symbol\"}\n", + "\n", + " symbol = symbol.strip().upper()\n", + "\n", + " # --- API Call ---\n", + " financials_resp = finnhub_client.company_basic_financials(symbol, \"all\")\n", + "\n", + " # Finnhub places primary values under \"metric\"\n", + " metrics = financials_resp.get(\"metric\", {})\n", + " if not metrics:\n", + " return {\"success\": False, \"error\": \"No financial metrics found\"}\n", + "\n", + " # --- Build result using helpers ---\n", + " result = {\n", + " \"success\": True,\n", + " \"symbol\": symbol,\n", + " \"financials\": {\n", + " \"Market Cap\": _format_big_number_from_millions(metrics.get(\"marketCapitalization\")),\n", + " \"Enterprise Value\": _format_big_number_from_millions(metrics.get(\"enterpriseValue\")),\n", + " \"P/E Ratio (TTM)\": _safe_metric(metrics, \"peBasicExclExtraTTM\"),\n", + " \"Forward P/E\": _safe_metric(metrics, \"forwardPE\"),\n", + " \"Revenue (TTM)\": _format_big_number_from_millions(metrics.get(\"revenueTTM\")),\n", + " \"Gross Margin (TTM)\": _safe_metric(metrics, \"grossMarginTTM\"),\n", + " \"Net Profit Margin (TTM)\": _safe_metric(metrics, \"netProfitMarginTTM\"),\n", + " \"EPS (TTM)\": _safe_metric(metrics, \"epsTTM\"),\n", + " \"EPS Growth (5Y)\": _safe_metric(metrics, \"epsGrowth5Y\"),\n", + " \"Dividend Yield (Indicated Annual)\": _safe_metric(metrics, \"dividendYieldIndicatedAnnual\"),\n", + " \"Current Ratio (Quarterly)\": _safe_metric(metrics, \"currentRatioQuarterly\"),\n", + " \"Debt/Equity (Long Term, Quarterly)\": _safe_metric(metrics, \"longTermDebt/equityQuarterly\"),\n", + " \"Beta\": _safe_metric(metrics, \"beta\"),\n", + " \"52-Week High\": _safe_metric(metrics, \"52WeekHigh\"),\n", + " \"52-Week Low\": _safe_metric(metrics, \"52WeekLow\"),\n", + " }\n", + " }\n", + "\n", + " return result\n", + "\n", + " except Exception as e:\n", + " # keep error message short but useful for debugging\n", + " return {\"success\": False, \"error\": f\"Failed to fetch metrics: {str(e)[:200]}\"}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9df7b74e-fec8-4e75-92a9-31acc75e6e97", + "metadata": {}, + "outputs": [], + "source": [ + "get_company_financials_function = {\n", + " \"name\": \"get_company_financials\",\n", + " \"description\": \"Fetch and return a curated set of basic financial metrics for a stock symbol. Calls Finnhub's company_basic_financials API, formats large numbers (market cap, enterprise value, revenue) in M/B/T USD, and shows metrics like P/E ratios, EPS, margins, dividend yield, debt/equity, beta, and 52-week range. Returns 'Unavailable' for missing values.\",\n", + " \"parameters\": {\n", + " \"type\": \"object\",\n", + " \"properties\": {\n", + " \"symbol\": {\n", + " \"type\": \"string\",\n", + " \"description\": \"Stock ticker symbol to fetch metrics for. Example: 'AAPL' for Apple Inc.\"\n", + " }\n", + " },\n", + " \"required\": [\n", + " \"symbol\"\n", + " ]\n", + " }\n", + "}\n", + "\n", + "\n", + "get_company_financials_tool = {\"type\": \"function\", \"function\": get_company_financials_function}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cfeeb200-3f30-4855-82b9-cc8b2a950f80", + "metadata": {}, + "outputs": [], + "source": [ + "def get_stock_quote(symbol: str) -> dict:\n", + " \"\"\"\n", + " Fetch the latest stock quote for a given ticker symbol using Finnhub's /quote endpoint.\n", + " Returns current price, daily high/low, open, previous close, percent change, and readable timestamp.\n", + " \"\"\"\n", + " print(f\"Tool get_stock_quote called for {symbol}\")\n", + " try:\n", + " if not symbol or len(symbol.strip()) < 1:\n", + " return {\"success\": False, \"error\": \"Invalid symbol provided\"}\n", + " \n", + " symbol = symbol.strip().upper()\n", + " data = finnhub_client.quote(symbol)\n", + "\n", + " if not data or \"c\" not in data:\n", + " return {\"success\": False, \"error\": \"No quote data found\"}\n", + " \n", + " # Convert epoch timestamp to ISO UTC if present\n", + " timestamp = data.get(\"t\")\n", + " if timestamp and isinstance(timestamp, (int, float)):\n", + " timestamp = datetime.utcfromtimestamp(timestamp).isoformat() + \"Z\"\n", + " else:\n", + " timestamp = \"Unavailable\"\n", + " \n", + " return {\n", + " \"success\": True,\n", + " \"symbol\": symbol,\n", + " \"current_price\": round(data.get(\"c\", 0), 2) if data.get(\"c\") is not None else \"Unavailable\",\n", + " \"change\": round(data.get(\"d\", 0), 2) if data.get(\"d\") is not None else \"Unavailable\",\n", + " \"percent_change\": f\"{round(data.get('dp', 0), 2)}%\" if data.get(\"dp\") is not None else \"Unavailable\",\n", + " \"high_price\": round(data.get(\"h\", 0), 2) if data.get(\"h\") is not None else \"Unavailable\",\n", + " \"low_price\": round(data.get(\"l\", 0), 2) if data.get(\"l\") is not None else \"Unavailable\",\n", + " \"open_price\": round(data.get(\"o\", 0), 2) if data.get(\"o\") is not None else \"Unavailable\",\n", + " \"previous_close\": round(data.get(\"pc\", 0), 2) if data.get(\"pc\") is not None else \"Unavailable\",\n", + " \"timestamp\": timestamp\n", + " }\n", + " except Exception as e:\n", + " return {\"success\": False, \"error\": f\"Quote retrieval failed: {str(e)[:100]}\"}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3724d92a-4515-4267-af6f-2c1ec2b6ed36", + "metadata": {}, + "outputs": [], + "source": [ + "get_stock_quote_function = {\n", + " \"name\": \"get_stock_quote\",\n", + " \"description\": \"Retrieve the latest stock quote for a given symbol, including current price, daily high/low, open, previous close, and percent change. Data is near real-time. Avoid constant polling; use websockets for streaming updates.\",\n", + " \"parameters\": {\n", + " \"type\": \"object\",\n", + " \"properties\": {\n", + " \"symbol\": {\n", + " \"type\": \"string\",\n", + " \"description\": \"Stock ticker symbol to fetch the latest quote for. Example: 'AAPL', 'MSFT'.\"\n", + " }\n", + " },\n", + " \"required\": [\"symbol\"]\n", + " }\n", + "}\n", + "\n", + "get_stock_quote_tool = {\"type\": \"function\", \"function\": get_stock_quote_function}\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "62f5d477-6626-428f-b8eb-d763e736ef5b", + "metadata": {}, + "outputs": [], + "source": [ + "def get_company_news(symbol: str, _from: str, to: str):\n", + " \"\"\"\n", + " Fetch the top 5 latest company news for a stock symbol within a date range.\n", + " - Ensures the range does not exceed ~1 months (35 days).\n", + " - Best practice: Keep searches to a month or less to avoid too much data.\n", + "\n", + " Args:\n", + " symbol (str): Stock ticker (e.g., \"AAPL\").\n", + " _from (str): Start date in YYYY-MM-DD format.\n", + " to (str): End date in YYYY-MM-DD format.\n", + "\n", + " Returns:\n", + " list or dict: Cleaned news data or error message.\n", + " \"\"\"\n", + " # Validate date format\n", + " print(f\"Tool get_company_news called for {symbol} from {_from} to {to}\")\n", + " try:\n", + " start_date = datetime.strptime(_from, \"%Y-%m-%d\")\n", + " end_date = datetime.strptime(to, \"%Y-%m-%d\")\n", + " except ValueError:\n", + " return {\"success\": False, \"error\": \"Invalid date format. Use YYYY-MM-DD.\"}\n", + "\n", + " # Check date range\n", + " delta_days = (end_date - start_date).days\n", + " if delta_days > 35:\n", + " return {\n", + " \"success\": False, \n", + " \"error\": f\"Date range too large ({delta_days} days). \"\n", + " \"Please use a range of 1 months or less.\"\n", + " }\n", + "\n", + " # Fetch data\n", + " try:\n", + " news = finnhub_client.company_news(symbol, _from=_from, to=to)\n", + " except Exception as e:\n", + " return {\"success\": False, \"error\": str(e)}\n", + "\n", + " # Do not want to report just the latest news in the time period\n", + " if len(news) <= 10:\n", + " # If 10 or fewer articles, take all\n", + " selected_news = news\n", + " else:\n", + " # Take first 5 (oldest) and last 5 (newest)\n", + " selected_news = news[:5] + news[-5:]\n", + "\n", + " # Clean & transform objects\n", + " cleaned_news = []\n", + " for article in news:\n", + " cleaned_news.append({\n", + " \"summary\": article.get(\"summary\"),\n", + " \"source\": article.get(\"source\"),\n", + " \"published_at\": datetime.utcfromtimestamp(article[\"datetime\"]).strftime(\"%Y-%m-%d %H:%M:%S UTC\"),\n", + " \"related\": article.get(\"related\")\n", + " })\n", + "\n", + " return {\"success\": True, \"news\": cleaned_news}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5150ecb6-e3f1-46dc-94fa-2a9abe5165f6", + "metadata": {}, + "outputs": [], + "source": [ + "get_company_news_function = {\n", + " \"name\": \"get_company_news\",\n", + " \"description\": \"Fetch the top 5 most recent company news articles for a given stock symbol. ⚠️ Avoid querying more than a 1-month range at a time as it may return too much data. Only tells news about company within last 1 year. An error is returned if the requested time range exceeds 1 month.\",\n", + " \"parameters\": {\n", + " \"type\": \"object\",\n", + " \"properties\": {\n", + " \"symbol\": {\n", + " \"type\": \"string\",\n", + " \"description\": \"Stock ticker symbol, e.g., 'AAPL'.\"\n", + " },\n", + " \"_from\": {\n", + " \"type\": \"string\",\n", + " \"description\": \"Start date in YYYY-MM-DD format. Ensure it is not more than 1 year ago.\"\n", + " },\n", + " \"to\": {\n", + " \"type\": \"string\",\n", + " \"description\": \"End date in YYYY-MM-DD format. Ensure it is not more than 1 year ago.\"\n", + " }\n", + " },\n", + " \"required\": [\n", + " \"symbol\",\n", + " \"_from\",\n", + " \"to\"\n", + " ]\n", + " }\n", + "}\n", + "\n", + "get_company_news_tool = {\"type\": \"function\", \"function\": get_company_news_function}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "26dd7375-626f-4235-b4a2-f1926f62cc5e", + "metadata": {}, + "outputs": [], + "source": [ + "def get_market_news(category: str = \"general\"):\n", + " \"\"\"\n", + " Fetch the latest market news for a given category.\n", + " - Returns only the top 7 articles.\n", + "\n", + " Args:\n", + " category (str): News category. One of [\"general\", \"forex\", \"crypto\", \"merger\"].\n", + "\n", + " Returns:\n", + " list or dict: A cleaned list of news articles or error message.\n", + " \"\"\"\n", + " print(f\"Tool get_market_news called for category '{category}'\")\n", + "\n", + " try:\n", + " news = finnhub_client.general_news(category)\n", + " except Exception as e:\n", + " return {\"success\": False, \"error\": str(e)}\n", + "\n", + " # Do not want to report just the latest news in the time period\n", + " if len(news) <= 10:\n", + " # If 10 or fewer articles, take all\n", + " selected_news = news\n", + " else:\n", + " # Take first 5 (oldest) and last 5 (newest)\n", + " selected_news = news[:5] + news[-5:]\n", + "\n", + " # Clean & transform objects\n", + " cleaned_news = []\n", + " for article in news:\n", + " cleaned_news.append({\n", + " \"headline\": article.get(\"headline\"),\n", + " \"summary\": article.get(\"summary\"),\n", + " \"source\": article.get(\"source\"),\n", + " \"category\": article.get(\"category\"),\n", + " \"published_at\": datetime.utcfromtimestamp(article[\"datetime\"]).strftime(\"%Y-%m-%d %H:%M:%S UTC\"),\n", + " \"related\": article.get(\"related\")\n", + " })\n", + "\n", + " return {\"success\": True, \"news\": cleaned_news}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5bd1aa28-119c-4c7a-bdc0-161a582ab1cc", + "metadata": {}, + "outputs": [], + "source": [ + "get_market_news_function = {\n", + " \"name\": \"get_market_news\",\n", + " \"description\": \"Fetch the latest market news by category. Returns the top 10 news articles with headline, summary, source, category, published time (UTC), and URLs. Categories: general, forex, crypto, merger. Use this to quickly get relevant financial news.\",\n", + " \"parameters\": {\n", + " \"type\": \"object\",\n", + " \"properties\": {\n", + " \"category\": {\n", + " \"type\": \"string\",\n", + " \"description\": \"News category to fetch. One of: general, forex, crypto, merger.\"\n", + " }\n", + " },\n", + " \"required\": [\"category\"]\n", + " }\n", + "}\n", + "\n", + "get_market_news_tool = {\"type\": \"function\", \"function\": get_market_news_function}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d3378855-b83c-4078-b1e9-5f03e55c7276", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bf29bdd0-7603-45fc-ad39-790eb0b471d5", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a25474d9-128e-431f-9b4c-1b3897798f0b", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bdca8679-935f-4e7f-97e6-e71a4d4f228c", + "metadata": {}, + "outputs": [], + "source": [ + "# And this is included in a list of tools:\n", + "\n", + "tools = [{\"type\": \"function\", \"function\": price_function}]" + ] + }, + { + "cell_type": "markdown", + "id": "c3d3554f-b4e3-4ce7-af6f-68faa6dd2340", + "metadata": {}, + "source": [ + "## Getting OpenAI to use our Tool\n", + "\n", + "There's some fiddly stuff to allow OpenAI \"to call our tool\"\n", + "\n", + "What we actually do is give the LLM the opportunity to inform us that it wants us to run the tool.\n", + "\n", + "Here's how the new chat function looks:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ce9b0744-9c78-408d-b9df-9f6fd9ed78cf", + "metadata": {}, + "outputs": [], + "source": [ + "def chat(message, history):\n", + " messages = [{\"role\": \"system\", \"content\": system_message}] + history + [{\"role\": \"user\", \"content\": message}]\n", + " response = openai.chat.completions.create(model=MODEL, messages=messages, tools=tools)\n", + "\n", + " if response.choices[0].finish_reason==\"tool_calls\":\n", + " message = response.choices[0].message\n", + " response, city = handle_tool_call(message)\n", + " messages.append(message)\n", + " messages.append(response)\n", + " response = openai.chat.completions.create(model=MODEL, messages=messages)\n", + " \n", + " return response.choices[0].message.content" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b0992986-ea09-4912-a076-8e5603ee631f", + "metadata": {}, + "outputs": [], + "source": [ + "# We have to write that function handle_tool_call:\n", + "\n", + "def handle_tool_call(message):\n", + " tool_call = message.tool_calls[0]\n", + " arguments = json.loads(tool_call.function.arguments)\n", + " city = arguments.get('destination_city')\n", + " price = get_ticket_price(city)\n", + " response = {\n", + " \"role\": \"tool\",\n", + " \"content\": json.dumps({\"destination_city\": city,\"price\": price}),\n", + " \"tool_call_id\": tool_call.id\n", + " }\n", + " return response, city" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f4be8a71-b19e-4c2f-80df-f59ff2661f14", + "metadata": {}, + "outputs": [], + "source": [ + "gr.ChatInterface(fn=chat, type=\"messages\").launch()" + ] + }, + { + "cell_type": "markdown", + "id": "473e5b39-da8f-4db1-83ae-dbaca2e9531e", + "metadata": {}, + "source": [ + "# Let's go multi-modal!!\n", + "\n", + "We can use DALL-E-3, the image generation model behind GPT-4o, to make us some images\n", + "\n", + "Let's put this in a function called artist.\n", + "\n", + "### Price alert: each time I generate an image it costs about 4 cents - don't go crazy with images!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2c27c4ba-8ed5-492f-add1-02ce9c81d34c", + "metadata": {}, + "outputs": [], + "source": [ + "# Some imports for handling images\n", + "\n", + "import base64\n", + "from io import BytesIO\n", + "from PIL import Image" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "773a9f11-557e-43c9-ad50-56cbec3a0f8f", + "metadata": {}, + "outputs": [], + "source": [ + "def artist(city):\n", + " image_response = openai.images.generate(\n", + " model=\"dall-e-3\",\n", + " prompt=f\"An image representing a vacation in {city}, showing tourist spots and everything unique about {city}, in a vibrant pop-art style\",\n", + " size=\"1024x1024\",\n", + " n=1,\n", + " response_format=\"b64_json\",\n", + " )\n", + " image_base64 = image_response.data[0].b64_json\n", + " image_data = base64.b64decode(image_base64)\n", + " return Image.open(BytesIO(image_data))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d877c453-e7fb-482a-88aa-1a03f976b9e9", + "metadata": {}, + "outputs": [], + "source": [ + "image = artist(\"New York City\")\n", + "display(image)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "728a12c5-adc3-415d-bb05-82beb73b079b", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "f4975b87-19e9-4ade-a232-9b809ec75c9a", + "metadata": {}, + "source": [ + "## Audio (NOTE - Audio is optional for this course - feel free to skip Audio if it causes trouble!)\n", + "\n", + "And let's make a function talker that uses OpenAI's speech model to generate Audio\n", + "\n", + "### Troubleshooting Audio issues\n", + "\n", + "If you have any problems running this code below (like a FileNotFound error, or a warning of a missing package), you may need to install FFmpeg, a very popular audio utility.\n", + "\n", + "**For PC Users**\n", + "\n", + "Detailed instructions are [here](https://chatgpt.com/share/6724efee-6b0c-8012-ac5e-72e2e3885905) and summary instructions:\n", + "\n", + "1. Download FFmpeg from the official website: https://ffmpeg.org/download.html\n", + "\n", + "2. Extract the downloaded files to a location on your computer (e.g., `C:\\ffmpeg`)\n", + "\n", + "3. Add the FFmpeg bin folder to your system PATH:\n", + "- Right-click on 'This PC' or 'My Computer' and select 'Properties'\n", + "- Click on 'Advanced system settings'\n", + "- Click on 'Environment Variables'\n", + "- Under 'System variables', find and edit 'Path'\n", + "- Add a new entry with the path to your FFmpeg bin folder (e.g., `C:\\ffmpeg\\bin`)\n", + "- Restart your command prompt, and within Jupyter Lab do Kernel -> Restart kernel, to pick up the changes\n", + "\n", + "4. Open a new command prompt and run this to make sure it's installed OK\n", + "`ffmpeg -version`\n", + "\n", + "**For Mac Users**\n", + "\n", + "1. Install homebrew if you don't have it already by running this in a Terminal window and following any instructions: \n", + "`/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"`\n", + "\n", + "2. Then install FFmpeg with `brew install ffmpeg`\n", + "\n", + "3. Verify your installation with `ffmpeg -version` and if everything is good, within Jupyter Lab do Kernel -> Restart kernel to pick up the changes\n", + "\n", + "Message me or email me at ed@edwarddonner.com with any problems!" + ] + }, + { + "cell_type": "markdown", + "id": "4cc90e80-c96e-4dd4-b9d6-386fe2b7e797", + "metadata": {}, + "source": [ + "## To check you now have ffmpeg and can access it here\n", + "\n", + "Excecute the next cell to see if you get a version number. (Putting an exclamation mark before something in Jupyter Lab tells it to run it as a terminal command rather than python code).\n", + "\n", + "If this doesn't work, you may need to actually save and close down your Jupyter lab, and start it again from a new Terminal window (Mac) or Anaconda prompt (PC), remembering to activate the llms environment. This ensures you pick up ffmpeg.\n", + "\n", + "And if that doesn't work, please contact me!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b3be0fb-1d34-4693-ab6f-dbff190afcd7", + "metadata": {}, + "outputs": [], + "source": [ + "!ffmpeg -version\n", + "!ffprobe -version\n", + "!ffplay -version" + ] + }, + { + "cell_type": "markdown", + "id": "d91d3f8f-e505-4e3c-a87c-9e42ed823db6", + "metadata": {}, + "source": [ + "# For Mac users - and possibly many PC users too\n", + "\n", + "This version should work fine for you. It might work for Windows users too, but you might get a Permissions error writing to a temp file. If so, see the next section!\n", + "\n", + "As always, if you have problems, please contact me! (You could also comment out the audio talker() in the later code if you're less interested in audio generation)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ffbfe93b-5e86-4e68-ba71-b301cd5230db", + "metadata": {}, + "outputs": [], + "source": [ + "from pydub import AudioSegment\n", + "from pydub.playback import play\n", + "\n", + "def talker(message):\n", + " response = openai.audio.speech.create(\n", + " model=\"tts-1\",\n", + " voice=\"onyx\", # Also, try replacing onyx with alloy\n", + " input=message\n", + " )\n", + " \n", + " audio_stream = BytesIO(response.content)\n", + " audio = AudioSegment.from_file(audio_stream, format=\"mp3\")\n", + " play(audio)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b88d775d-d357-4292-a1ad-5dc5ed567281", + "metadata": {}, + "outputs": [], + "source": [ + "talker(\"Well, hi there\")" + ] + }, + { + "cell_type": "markdown", + "id": "ad89a9bd-bb1e-4bbb-a49a-83af5f500c24", + "metadata": {}, + "source": [ + "# For Windows users (or any Mac users with problems above)\n", + "\n", + "## First try the Mac version above, but if you get a permissions error writing to a temp file, then this code should work instead.\n", + "\n", + "A collaboration between students Mark M. and Patrick H. and Claude got this resolved!\n", + "\n", + "Below are 4 variations - hopefully one of them will work on your PC. If not, message me please!\n", + "\n", + "And for Mac people - all 3 of the below work on my Mac too - please try these if the Mac version gave you problems.\n", + "\n", + "## PC Variation 1" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d104b96a-02ca-4159-82fe-88e0452aa479", + "metadata": {}, + "outputs": [], + "source": [ + "import base64\n", + "from io import BytesIO\n", + "from PIL import Image\n", + "from IPython.display import Audio, display\n", + "\n", + "def talker(message):\n", + " response = openai.audio.speech.create(\n", + " model=\"tts-1\",\n", + " voice=\"onyx\",\n", + " input=message)\n", + "\n", + " audio_stream = BytesIO(response.content)\n", + " output_filename = \"output_audio.mp3\"\n", + " with open(output_filename, \"wb\") as f:\n", + " f.write(audio_stream.read())\n", + "\n", + " # Play the generated audio\n", + " display(Audio(output_filename, autoplay=True))\n", + "\n", + "talker(\"Well, hi there\")" + ] + }, + { + "cell_type": "markdown", + "id": "3a5d11f4-bbd3-43a1-904d-f684eb5f3e3a", + "metadata": {}, + "source": [ + "## PC Variation 2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d59c8ebd-79c5-498a-bdf2-3a1c50d91aa0", + "metadata": {}, + "outputs": [], + "source": [ + "import tempfile\n", + "import subprocess\n", + "from io import BytesIO\n", + "from pydub import AudioSegment\n", + "import time\n", + "\n", + "def play_audio(audio_segment):\n", + " temp_dir = tempfile.gettempdir()\n", + " temp_path = os.path.join(temp_dir, \"temp_audio.wav\")\n", + " try:\n", + " audio_segment.export(temp_path, format=\"wav\")\n", + " time.sleep(3) # Student Dominic found that this was needed. You could also try commenting out to see if not needed on your PC\n", + " subprocess.call([\n", + " \"ffplay\",\n", + " \"-nodisp\",\n", + " \"-autoexit\",\n", + " \"-hide_banner\",\n", + " temp_path\n", + " ], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n", + " finally:\n", + " try:\n", + " os.remove(temp_path)\n", + " except Exception:\n", + " pass\n", + " \n", + "def talker(message):\n", + " response = openai.audio.speech.create(\n", + " model=\"tts-1\",\n", + " voice=\"onyx\", # Also, try replacing onyx with alloy\n", + " input=message\n", + " )\n", + " audio_stream = BytesIO(response.content)\n", + " audio = AudioSegment.from_file(audio_stream, format=\"mp3\")\n", + " play_audio(audio)\n", + "\n", + "talker(\"Well hi there\")" + ] + }, + { + "cell_type": "markdown", + "id": "96f90e35-f71e-468e-afea-07b98f74dbcf", + "metadata": {}, + "source": [ + "## PC Variation 3" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8597c7f8-7b50-44ad-9b31-db12375cd57b", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from pydub import AudioSegment\n", + "from pydub.playback import play\n", + "from io import BytesIO\n", + "\n", + "def talker(message):\n", + " # Set a custom directory for temporary files on Windows\n", + " custom_temp_dir = os.path.expanduser(\"~/Documents/temp_audio\")\n", + " os.environ['TEMP'] = custom_temp_dir # You can also use 'TMP' if necessary\n", + " \n", + " # Create the folder if it doesn't exist\n", + " if not os.path.exists(custom_temp_dir):\n", + " os.makedirs(custom_temp_dir)\n", + " \n", + " response = openai.audio.speech.create(\n", + " model=\"tts-1\",\n", + " voice=\"onyx\", # Also, try replacing onyx with alloy\n", + " input=message\n", + " )\n", + " \n", + " audio_stream = BytesIO(response.content)\n", + " audio = AudioSegment.from_file(audio_stream, format=\"mp3\")\n", + "\n", + " play(audio)\n", + "\n", + "talker(\"Well hi there\")" + ] + }, + { + "cell_type": "markdown", + "id": "e821224c-b069-4f9b-9535-c15fdb0e411c", + "metadata": {}, + "source": [ + "## PC Variation 4\n", + "\n", + "### Let's try a completely different sound library\n", + "\n", + "First run the next cell to install a new library, then try the cell below it." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "69d3c0d9-afcc-49e3-b829-9c9869d8b472", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install simpleaudio" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "28f9cc99-36b7-4554-b3f4-f2012f614a13", + "metadata": {}, + "outputs": [], + "source": [ + "from pydub import AudioSegment\n", + "from io import BytesIO\n", + "import tempfile\n", + "import os\n", + "import simpleaudio as sa\n", + "\n", + "def talker(message):\n", + " response = openai.audio.speech.create(\n", + " model=\"tts-1\",\n", + " voice=\"onyx\", # Also, try replacing onyx with alloy\n", + " input=message\n", + " )\n", + " \n", + " audio_stream = BytesIO(response.content)\n", + " audio = AudioSegment.from_file(audio_stream, format=\"mp3\")\n", + "\n", + " # Create a temporary file in a folder where you have write permissions\n", + " with tempfile.NamedTemporaryFile(suffix=\".wav\", delete=False, dir=os.path.expanduser(\"~/Documents\")) as temp_audio_file:\n", + " temp_file_name = temp_audio_file.name\n", + " audio.export(temp_file_name, format=\"wav\")\n", + " \n", + " # Load and play audio using simpleaudio\n", + " wave_obj = sa.WaveObject.from_wave_file(temp_file_name)\n", + " play_obj = wave_obj.play()\n", + " play_obj.wait_done() # Wait for playback to finish\n", + "\n", + " # Clean up the temporary file afterward\n", + " os.remove(temp_file_name)\n", + " \n", + "talker(\"Well hi there\")" + ] + }, + { + "cell_type": "markdown", + "id": "7986176b-cd04-495f-a47f-e057b0e462ed", + "metadata": {}, + "source": [ + "## PC Users - if none of those 4 variations worked!\n", + "\n", + "Please get in touch with me. I'm sorry this is causing problems! We'll figure it out.\n", + "\n", + "Alternatively: playing audio from your PC isn't super-critical for this course, and you can feel free to focus on image generation and skip audio for now, or come back to it later." + ] + }, + { + "cell_type": "markdown", + "id": "1d48876d-c4fa-46a8-a04f-f9fadf61fb0d", + "metadata": {}, + "source": [ + "# Our Agent Framework\n", + "\n", + "The term 'Agentic AI' and Agentization is an umbrella term that refers to a number of techniques, such as:\n", + "\n", + "1. Breaking a complex problem into smaller steps, with multiple LLMs carrying out specialized tasks\n", + "2. The ability for LLMs to use Tools to give them additional capabilities\n", + "3. The 'Agent Environment' which allows Agents to collaborate\n", + "4. An LLM can act as the Planner, dividing bigger tasks into smaller ones for the specialists\n", + "5. The concept of an Agent having autonomy / agency, beyond just responding to a prompt - such as Memory\n", + "\n", + "We're showing 1 and 2 here, and to a lesser extent 3 and 5. In week 8 we will do the lot!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba820c95-02f5-499e-8f3c-8727ee0a6c0c", + "metadata": {}, + "outputs": [], + "source": [ + "def chat(history):\n", + " messages = [{\"role\": \"system\", \"content\": system_message}] + history\n", + " response = openai.chat.completions.create(model=MODEL, messages=messages, tools=tools)\n", + " image = None\n", + " \n", + " if response.choices[0].finish_reason==\"tool_calls\":\n", + " message = response.choices[0].message\n", + " response, city = handle_tool_call(message)\n", + " messages.append(message)\n", + " messages.append(response)\n", + " image = artist(city)\n", + " response = openai.chat.completions.create(model=MODEL, messages=messages)\n", + " \n", + " reply = response.choices[0].message.content\n", + " history += [{\"role\":\"assistant\", \"content\":reply}]\n", + "\n", + " # Comment out or delete the next line if you'd rather skip Audio for now..\n", + " talker(reply)\n", + " \n", + " return history, image" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f38d0d27-33bf-4992-a2e5-5dbed973cde7", + "metadata": {}, + "outputs": [], + "source": [ + "# More involved Gradio code as we're not using the preset Chat interface!\n", + "# Passing in inbrowser=True in the last line will cause a Gradio window to pop up immediately.\n", + "\n", + "with gr.Blocks() as ui:\n", + " with gr.Row():\n", + " chatbot = gr.Chatbot(height=500, type=\"messages\")\n", + " image_output = gr.Image(height=500)\n", + " with gr.Row():\n", + " entry = gr.Textbox(label=\"Chat with our AI Assistant:\")\n", + " with gr.Row():\n", + " clear = gr.Button(\"Clear\")\n", + "\n", + " def do_entry(message, history):\n", + " history += [{\"role\":\"user\", \"content\":message}]\n", + " return \"\", history\n", + "\n", + " entry.submit(do_entry, inputs=[entry, chatbot], outputs=[entry, chatbot]).then(\n", + " chat, inputs=chatbot, outputs=[chatbot, image_output]\n", + " )\n", + " clear.click(lambda: None, inputs=None, outputs=chatbot, queue=False)\n", + "\n", + "ui.launch(inbrowser=True)" + ] + }, + { + "cell_type": "markdown", + "id": "226643d2-73e4-4252-935d-86b8019e278a", + "metadata": {}, + "source": [ + "# Exercises and Business Applications\n", + "\n", + "Add in more tools - perhaps to simulate actually booking a flight. A student has done this and provided their example in the community contributions folder.\n", + "\n", + "Next: take this and apply it to your business. Make a multi-modal AI assistant with tools that could carry out an activity for your work. A customer support assistant? New employee onboarding assistant? So many possibilities! Also, see the week2 end of week Exercise in the separate Notebook." + ] + }, + { + "cell_type": "markdown", + "id": "7e795560-1867-42db-a256-a23b844e6fbe", + "metadata": {}, + "source": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + "

I have a special request for you

\n", + " \n", + " My editor tells me that it makes a HUGE difference when students rate this course on Udemy - it's one of the main ways that Udemy decides whether to show it to others. If you're able to take a minute to rate this, I'd be so very grateful! And regardless - always please reach out to me at ed@edwarddonner.com if I can help at any point.\n", + " \n", + "
" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 7e73249dd67bcd0e91bf0c1e5f67aef62d82571c Mon Sep 17 00:00:00 2001 From: JacquieAM <69653489+JacquieAM@users.noreply.github.com> Date: Wed, 27 Aug 2025 18:01:50 -0500 Subject: [PATCH 14/25] Add website-summary notebook for community contribution --- .../jacquieAM/website-summary.ipynb | 329 ++++++++++++++++++ 1 file changed, 329 insertions(+) create mode 100644 week1/community-contributions/training-summary-translation-length/jacquieAM/website-summary.ipynb diff --git a/week1/community-contributions/training-summary-translation-length/jacquieAM/website-summary.ipynb b/week1/community-contributions/training-summary-translation-length/jacquieAM/website-summary.ipynb new file mode 100644 index 0000000..9c31463 --- /dev/null +++ b/week1/community-contributions/training-summary-translation-length/jacquieAM/website-summary.ipynb @@ -0,0 +1,329 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9ab446e4-219c-4589-aa8f-9386adcf5c60", + "metadata": {}, + "outputs": [], + "source": [ + "## Project Overview\n", + "This project combines web scraping with OpenAI’s GPT models to summarize online training content. It extracts material from Microsoft’s **Quantum Computing Fundamentals** learning path, cleans it, and generates concise summaries per lesson as well as an overall course summary. \n", + "\n", + "## Key Features\n", + "- Fetches and parses webpages using **requests** and **BeautifulSoup** \n", + "- Produces summaries in multiple languages (e.g., English, Spanish, or any language) and at varying levels of detail (short, medium, detailed) \n", + "- Summarizes individual lessons on demand or processes entire learning paths \n", + "- Presents results as clean, structured **Markdown** directly in the notebook \n", + "\n", + "## Tech Stack\n", + "- **Model**: GPT-4o-mini \n", + "- **Language**: Python \n", + "- **Libraries**: BeautifulSoup, OpenAI \n", + "\n", + "## Purpose\n", + "This project demonstrates how AI can streamline the understanding of technical documentation and online courses by generating multilingual, customizable summaries. \n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4e2a9393-7767-488e-a8bf-27c12dca35bd", + "metadata": {}, + "outputs": [], + "source": [ + "# imports\n", + "\n", + "import os\n", + "import requests\n", + "from dotenv import load_dotenv\n", + "from bs4 import BeautifulSoup\n", + "from IPython.display import Markdown, display\n", + "from openai import OpenAI\n", + "\n", + "# If you get an error running this cell, then please head over to the troubleshooting notebook!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b87cadb-d513-4303-baee-a37b6f938e4d", + "metadata": {}, + "outputs": [], + "source": [ + "# Load environment variables from .env file (not included)\n", + "\n", + "load_dotenv(override=True)\n", + "api_key = os.getenv('OPENAI_API_KEY')\n", + "\n", + "# Check the key\n", + "\n", + "if not api_key:\n", + " print(\"No API key was found\")\n", + "elif not api_key.startswith(\"sk-proj-\"):\n", + " print(\"An API key was found, but it doesn't start sk-proj-; please check you're using the right key\")\n", + "elif api_key.strip() != api_key:\n", + " print(\"An API key was found, but it looks like it might have space or tab characters at the start or end - please remove them\")\n", + "else:\n", + " print(\"API key found and looks good so far!\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "019974d9-f3ad-4a8a-b5f9-0a3719aea2d3", + "metadata": {}, + "outputs": [], + "source": [ + "openai = OpenAI()\n", + "\n", + "# If this doesn't work, try Kernel menu >> Restart Kernel and Clear Outputs Of All Cells, then run the cells from the top of this notebook down.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c5e793b2-6775-426a-a139-4848291d0463", + "metadata": {}, + "outputs": [], + "source": [ + "# A class to represent a Webpage\n", + "\n", + "# Some websites need you to use proper headers when fetching them:\n", + "headers = {\n", + " \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36\"\n", + "}\n", + "\n", + "class Website:\n", + "\n", + " def __init__(self, url):\n", + " \"\"\"\n", + " Create this Website object from the given url using the BeautifulSoup library\n", + " \"\"\"\n", + " self.url = url\n", + " response = requests.get(url, headers=headers)\n", + " soup = BeautifulSoup(response.content, 'html.parser')\n", + " self.title = soup.title.string if soup.title else \"No title found\"\n", + " for irrelevant in soup.body([\"script\", \"style\", \"img\", \"input\"]):\n", + " irrelevant.decompose()\n", + " self.text = soup.body.get_text(separator=\"\\n\", strip=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2ef960cf-6dc2-4cda-afb3-b38be12f4c97", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "training_website = Website(\"https://learn.microsoft.com/en-us/training/paths/quantum-computing-fundamentals/\")\n", + "print(training_website.title)\n", + "print(training_website.text)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "abdb8417-c5dc-44bc-9bee-2e059d162699", + "metadata": {}, + "outputs": [], + "source": [ + "# Create a system prompt function that can use different language and length \n", + "\n", + "def build_system_prompt(language=\"Spanish\", length=\"short\"):\n", + " return f\"\"\"You are an assistant that analyzes the contents of a website and provides a {length} summary, ignoring text that might be navigation related.\n", + " Respond in 20 words or less markdown, and respond in {language}.\n", + " \"\"\"\n", + " \n", + " \n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "987c95a6-6618-4d22-a2c3-3038a9d3f154", + "metadata": {}, + "outputs": [], + "source": [ + "# Create a function that writes a User Prompt that asks for summaries of websites:\n", + "\n", + "def user_prompt_for(website):\n", + " user_prompt = f\"You are looking at a website titled {website.title}\"\n", + " user_prompt += \"\\nThe contents of this website is as follows; \\\n", + "please provide a short summary in {language} of this website in markdown. \\\n", + "If it includes news or announcements, then summarize these too.\\n\\n\"\n", + " user_prompt += website.text\n", + " return user_prompt" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8a846c89-81d8-4f48-9d62-7744d76694e2", + "metadata": {}, + "outputs": [], + "source": [ + "print(user_prompt_for(training_website))\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "26448ec4-5c00-4204-baec-7df91d11ff2e", + "metadata": {}, + "outputs": [], + "source": [ + "print(user_prompt_for(training_website))" + ] + }, + { + "cell_type": "markdown", + "id": "d06e8d78-ce4c-4b05-aa8e-17050c82bb47", + "metadata": {}, + "source": [ + "## And now let's build useful messages for GPT-4o-mini, using a function" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0134dfa4-8299-48b5-b444-f2a8c3403c88", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "def messages_for(website, language=\"Spanish\", length=\"short\"):\n", + " return [\n", + " {\"role\": \"system\", \"content\": build_system_prompt(language, length)},\n", + " {\"role\": \"user\", \"content\": user_prompt_for(website)}\n", + " ]" + ] + }, + { + "cell_type": "markdown", + "id": "16f49d46-bf55-4c3e-928f-68fc0bf715b0", + "metadata": {}, + "source": [ + "## Time to bring it together - the API for OpenAI is very simple!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "425214b8-c5c5-4d7a-8b79-f9e151c9d54f", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "905b9919-aba7-45b5-ae65-81b3d1d78e34", + "metadata": {}, + "outputs": [], + "source": [ + "#call the OpenAI API. \n", + "\n", + "def summarize(url, language=\"Spanish\", length=\"short\"):\n", + " website = Website(url)\n", + " response = openai.chat.completions.create(\n", + " model=\"gpt-4o-mini\",\n", + " messages=messages_for(website, language, length)\n", + " )\n", + " return response.choices[0].message.content\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1c437357-d004-49f5-95c3-fce38aefcb5c", + "metadata": {}, + "outputs": [], + "source": [ + "#Summarize all the lessons in microsoft quantum computer training, having the option to summarize by lesson, or the training as a whole\n", + "\n", + "def summarize_training(path_url, language=\"Spanish\", length=\"short\"):\n", + " links = get_links_from_path(path_url)\n", + " print(f\"Found {len(links)} lessons\")\n", + "\n", + " all_summaries = []\n", + "\n", + " for link in links:\n", + " print(f\"Summarizing {link}...\")\n", + " summary = summarize(link, language, length)\n", + " all_summaries.append(f\"### {link}\\n{summary}\\n\")\n", + "\n", + " combined_prompt = \"Here are summaries of each lesson:\\n\\n\" + \"\\n\".join(all_summaries)\n", + " response = openai.chat.completions.create(\n", + " model=\"gpt-4o-mini\",\n", + " messages=[\n", + " {\"role\": \"system\", \"content\": build_system_prompt(language, length)},\n", + " {\"role\": \"user\", \"content\": \"Please summarize the entire training path based on these lesson summaries:\\n\\n\" + combined_prompt}\n", + " ]\n", + " )\n", + "\n", + " return \"\\n\".join(all_summaries) + \"\\n\\n## General Course Summary\\n\" + response.choices[0].message.content\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "05e38d41-dfa4-4b20-9c96-c46ea75d9fb5", + "metadata": {}, + "outputs": [], + "source": [ + "summarize(\"https://learn.microsoft.com/en-us/training/paths/quantum-computing-fundamentals/\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3d926d59-450e-4609-92ba-2d6f244f1342", + "metadata": {}, + "outputs": [], + "source": [ + "# A function to display this nicely in the Jupyter output, using markdown\n", + "\n", + "def display_summary(url):\n", + " summary = summarize(url)\n", + " display(Markdown(summary))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3018853a-445f-41ff-9560-d925d1774b2f", + "metadata": {}, + "outputs": [], + "source": [ + "display_summary(\"https://learn.microsoft.com/en-us/training/paths/quantum-computing-fundamentals/\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From c62a1e5a3af6701b2118e33f0483a8ec997779aa Mon Sep 17 00:00:00 2001 From: Arundhati Date: Wed, 27 Aug 2025 21:17:24 -0400 Subject: [PATCH 15/25] Added Sushi Restaurant --- .../SushiRestaurant.ipynb | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 week2/community-contributions/SushiRestaurant.ipynb diff --git a/week2/community-contributions/SushiRestaurant.ipynb b/week2/community-contributions/SushiRestaurant.ipynb new file mode 100644 index 0000000..ad32c65 --- /dev/null +++ b/week2/community-contributions/SushiRestaurant.ipynb @@ -0,0 +1,181 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "757905af-7f93-4dca-9526-063bc93a78c7", + "metadata": {}, + "source": [ + "# Sakana-ya (魚屋) Sushi\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9a6721fb-efca-4412-a0a7-cc8e6c4ced76", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from dotenv import load_dotenv\n", + "from openai import OpenAI\n", + "import gradio as gr\n", + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b0fa458f-f73f-491c-b666-95db4b91f571", + "metadata": {}, + "outputs": [], + "source": [ + "load_dotenv(override=True)\n", + "openai_api_key = os.getenv('OPENAI_API_KEY')\n", + "anthropic_api_key = os.getenv('ANTHROPIC_API_KEY')\n", + "google_api_key = os.getenv('GOOGLE_API_KEY')\n", + "\n", + "if openai_api_key:\n", + " print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n", + "else:\n", + " print(\"OpenAI API Key not set\")\n", + " \n", + "if anthropic_api_key:\n", + " print(f\"Anthropic API Key exists and begins {anthropic_api_key[:7]}\")\n", + "else:\n", + " print(\"Anthropic API Key not set\")\n", + "\n", + "if google_api_key:\n", + " print(f\"Google API Key exists and begins {google_api_key[:8]}\")\n", + "else:\n", + " print(\"Google API Key not set\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "aa2846f2-e09c-421d-9774-c04961a79800", + "metadata": {}, + "outputs": [], + "source": [ + "openai = OpenAI()\n", + "MODEL = 'gpt-4o-mini'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7672ecdf-cf50-4b96-887a-b0a4eb5bbbf5", + "metadata": {}, + "outputs": [], + "source": [ + " \n", + "menu = {\n", + " \"Nigiri (1 pc)\": {\n", + " \"Salmon\": 4.25,\n", + " \"Tuna\": 4.75,\n", + " \"Yellowtail\": 5.00,\n", + " \"Eel\": 5.25,\n", + " \"Tamago\": 3.00,\n", + " },\n", + " \"Sashimi (3 pc)\": {\n", + " \"Salmon\": 8.50,\n", + " \"Tuna\": 9.00,\n", + " \"Yellowtail\": 9.50,\n", + " \"Octopus\": 8.00,\n", + " },\n", + " \"Classic Rolls (6 pc)\": {\n", + " \"California\": 6.50,\n", + " \"Spicy Tuna\": 7.50,\n", + " \"Philadelphia\": 7.25,\n", + " \"Cucumber\": 4.50,\n", + " \"Avocado\": 4.75,\n", + " },\n", + " \"Specialty Rolls (8 pc)\": {\n", + " \"Dragon\": 13.50,\n", + " \"Rainbow\": 14.00,\n", + " \"Crunchy Shrimp\": 12.50,\n", + " \"Volcano\": 13.00,\n", + " \"Spider\": 14.50,\n", + " },\n", + " \"Appetizers\": {\n", + " \"Edamame\": 5.00,\n", + " \"Gyoza (5)\": 6.50,\n", + " \"Miso Soup\": 3.00,\n", + " \"Seaweed Salad\": 5.50,\n", + " },\n", + " \"Beverages\": {\n", + " \"Green Tea\": 2.50,\n", + " \"Ramune Soda\": 3.00,\n", + " \"Sparkling Water\": 2.75,\n", + " },\n", + " \"Desserts\": {\n", + " \"Mochi Ice Cream (2)\": 5.00,\n", + " \"Matcha Cheesecake\": 6.50,\n", + " },\n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "99914500-3630-4fea-987c-d19c760994c6", + "metadata": {}, + "outputs": [], + "source": [ + "def chat(message, history):\n", + " system_message = \"You are a helpful assistant for Sakana-ya (魚屋) Sushi restaurant.\\\n", + " Help out with information and if you dont know something just say you cant help with that.\"\n", + " system_message += json.dumps(menu)\n", + " system_message+=\"If something is not in the menu, we dont serve it.\\\n", + " If we dont have a dish just mention it that we dont offer it. \"\n", + "\n", + " sushi_exotic = [\n", + " {\"role\": \"user\", \"content\": \"Do you have aji?\"},\n", + " {\"role\": \"user\", \"content\": \"We currently dont have shun its available only during the season i.e in May.\"},\n", + " {\"role\": \"user\", \"content\": \"What about buri?\"},\n", + " {\"role\": \"user\", \"content\": \"Thats seasonal as well only during December. Do visit us during that time.\"},\n", + " \n", + " ]\n", + " \n", + " messages = [{\"role\": \"system\", \"content\": system_message}]+ sushi_exotic + history + [{\"role\": \"user\", \"content\": message}]\n", + " stream = openai.chat.completions.create(model=MODEL, messages=messages, stream=True)\n", + "\n", + " response = \"\"\n", + " for chunk in stream:\n", + " response += chunk.choices[0].delta.content or ''\n", + " yield response" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a5c61d91-abee-4ada-9a42-ae87cf53fcff", + "metadata": {}, + "outputs": [], + "source": [ + "gr.ChatInterface(fn=chat, type=\"messages\").launch()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 5aebd4f0de398315459b64f4cd1b7258b8b3bb4b Mon Sep 17 00:00:00 2001 From: prateektambe Date: Thu, 28 Aug 2025 21:12:18 +0530 Subject: [PATCH 16/25] Week3Day5 - Dataset generator --- .../SyntheticDataGenerator_PT.ipynb | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 community-contributions/SyntheticDataGenerator_PT.ipynb diff --git a/community-contributions/SyntheticDataGenerator_PT.ipynb b/community-contributions/SyntheticDataGenerator_PT.ipynb new file mode 100644 index 0000000..18cf4c6 --- /dev/null +++ b/community-contributions/SyntheticDataGenerator_PT.ipynb @@ -0,0 +1,141 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d08b387c-53fb-46d2-b083-5eebc3c97e1b", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install -q --upgrade torch==2.5.1+cu124 torchvision==0.20.1+cu124 torchaudio==2.5.1+cu124 --index-url https://download.pytorch.org/whl/cu124\n", + "!pip install -q requests bitsandbytes==0.46.0 transformers==4.48.3 accelerate==1.3.0 openai" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f1851b2-890c-427b-8e70-b998efa04c67", + "metadata": {}, + "outputs": [], + "source": [ + "# imports\n", + "\n", + "import os\n", + "import requests\n", + "from IPython.display import Markdown, display, update_display\n", + "from openai import OpenAI\n", + "from google.colab import drive\n", + "from huggingface_hub import login\n", + "from google.colab import userdata\n", + "from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer, BitsAndBytesConfig\n", + "import torch" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c2d334b5-453e-4213-8e1c-905d504d2dc1", + "metadata": {}, + "outputs": [], + "source": [ + "LLAMA = \"meta-llama/Meta-Llama-3.1-8B-Instruct\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c1b3684c-c170-45f2-a83d-7e6e2ca1e23b", + "metadata": {}, + "outputs": [], + "source": [ + "hf_token = userdata.get('HF_TOKEN')\n", + "login(hf_token, add_to_git_credential=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8c1b6dae-3213-4d68-8fa1-d195704790dc", + "metadata": {}, + "outputs": [], + "source": [ + "openai_api_key = userdata.get('OPENAI_API_KEY')\n", + "openai = OpenAI(api_key=openai_api_key)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "988974c7-814c-478a-be7b-0928b0efdbab", + "metadata": {}, + "outputs": [], + "source": [ + "system_message = \"You are an assistant that produces synthetic test data. The fields, data type of the field like numeric, date, alphanumeric etc., will be provided. Generate data considering all cases, if it is a workflow audit data then consider all touchpoint movements. Do not provide a python script to generate the data. Provide the data as a json with arrays.\"\n", + "user_prompt = \"\"\"Create a synthetic dataset for testing. \n", + "Column names and type - \n", + "ID: 10 digit number\n", + "TRACKING_ID: 13 character alphanumeric\n", + "CASE REPORT DATE : DD-MMM-YYYY HH:MM:SS\n", + "NOTIFICATION DATE : DD-MMM-YYYY HH:MM:SS\n", + "IN SCOPE : (Yes/No)\n", + "\"\"\"\n", + "\n", + "messages = [\n", + " {\"role\": \"system\", \"content\": system_message},\n", + " {\"role\": \"user\", \"content\": user_prompt}\n", + " ]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "40cebc04-abf0-4c61-8b18-f98d3c1fe680", + "metadata": {}, + "outputs": [], + "source": [ + "quant_config = BitsAndBytesConfig(\n", + " load_in_4bit=True,\n", + " bnb_4bit_use_double_quant=True,\n", + " bnb_4bit_compute_dtype=torch.bfloat16,\n", + " bnb_4bit_quant_type=\"nf4\"\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "710ba1af-8e12-4635-933b-00df8d2e3f9d", + "metadata": {}, + "outputs": [], + "source": [ + "tokenizer = AutoTokenizer.from_pretrained(LLAMA)\n", + "tokenizer.pad_token = tokenizer.eos_token\n", + "inputs = tokenizer.apply_chat_template(messages, return_tensors=\"pt\").to(\"cuda\")\n", + "streamer = TextStreamer(tokenizer)\n", + "model = AutoModelForCausalLM.from_pretrained(LLAMA, device_map=\"auto\", quantization_config=quant_config)\n", + "outputs = model.generate(inputs, max_new_tokens=2000, streamer=streamer)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 2fca75f7ee647afc4bf6bea4e704dfe77fbc3e6c Mon Sep 17 00:00:00 2001 From: Kartik Date: Fri, 29 Aug 2025 02:34:53 +0530 Subject: [PATCH 17/25] tools linked to openai and chat interface with gradio --- week2/stock-api-day5.ipynb | 367 +++++++++++++++++++++++++++---------- 1 file changed, 271 insertions(+), 96 deletions(-) diff --git a/week2/stock-api-day5.ipynb b/week2/stock-api-day5.ipynb index 92d0769..aadb3b9 100644 --- a/week2/stock-api-day5.ipynb +++ b/week2/stock-api-day5.ipynb @@ -10,17 +10,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "b7bd1bd7-19d9-4c4b-bc4b-9bc9cca8bd0f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: finnhub-python in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (2.4.24)\n", + "Requirement already satisfied: requests>=2.22.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from finnhub-python) (2.32.3)\n", + "Requirement already satisfied: charset_normalizer<4,>=2 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from requests>=2.22.0->finnhub-python) (3.4.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from requests>=2.22.0->finnhub-python) (3.10)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from requests>=2.22.0->finnhub-python) (2.4.0)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from requests>=2.22.0->finnhub-python) (2025.4.26)\n" + ] + } + ], "source": [ "!pip install finnhub-python" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "8b50bbe2-c0b1-49c3-9a5c-1ba7efa2bcb4", "metadata": {}, "outputs": [], @@ -39,10 +52,47 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, + "id": "ba0ddc1a-c775-4ed3-9531-ed0c5799e87f", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-08-29 02:28:59,653 [INFO] Logger initialized!\n" + ] + } + ], + "source": [ + "import logging\n", + "\n", + "# Configure root logger\n", + "logging.basicConfig(\n", + " level=logging.INFO, # Set level: DEBUG, INFO, WARNING, ERROR\n", + " format=\"%(asctime)s [%(levelname)s] %(message)s\", \n", + " force=True # Ensures reconfiguration if you rerun this cell\n", + ")\n", + "\n", + "logger = logging.getLogger(__name__) # Use a global logger object\n", + "logger.info(\"Logger initialized!\")" + ] + }, + { + "cell_type": "code", + "execution_count": 4, "id": "747e8786-9da8-4342-b6c9-f5f69c2e22ae", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-08-29 02:28:59,657 [INFO] OpenAI API Key exists and begins sk-proj-\n", + "2025-08-29 02:28:59,657 [INFO] FINNHUB_API_KEY exists!\n" + ] + } + ], "source": [ "# Initialization\n", "\n", @@ -52,14 +102,14 @@ "FINNHUB_API_KEY = os.getenv(\"FINNHUB_API_KEY\")\n", "\n", "if openai_api_key:\n", - " print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n", + " logger.info(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n", "else:\n", - " print(\"OpenAI API Key not set\")\n", + " logger.error(\"OpenAI API Key not set\")\n", "\n", "if FINNHUB_API_KEY:\n", - " print(f\"FINNHUB_API_KEY exists!\")\n", + " logger.info(f\"FINNHUB_API_KEY exists!\")\n", "else:\n", - " print(\"OpenAI API Key not set\")\n", + " logger.error(\"OpenAI API Key not set\")\n", " \n", "MODEL = \"gpt-5-mini\"\n", "openai = OpenAI()\n", @@ -68,12 +118,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "ee3aaa9a-5495-42fd-a382-803fbfa92eaf", "metadata": {}, "outputs": [], "source": [ - "system_message += f\"\"\"\n", + "system_message = f\"\"\"\n", "You are called \"TickerBot\", You are a helpful stock information assistant specializing in US stocks. You provide factual, educational information without investment advice. You have access to tools for:\n", "- Stock symbol lookup\n", "- Real-time quotes\n", @@ -91,10 +141,6 @@ "- When users mention companies, search for symbols with the tool `search_symbol()` else proceed directly if obvious match\n", "- Try to search for news or data for only for a maximum of 1 month time range, else it becomes a lot of data to parse. If user asks for recent news just check the last 5 days from today; For example if today is 10-06-2025, use from=\"2025-06-05\", to=\"2025-06-10\"\n", "\n", - "**Single Stock Comprehensive Analysis** (Use very judicially as it is time taking tool, only when user definitely needs a complete overview or multiple things that you would otherwise need to call multiple tools for):\n", - "- User asks about \"Apple\" or \"AAPL\" → Use all company specific tools that you deem necessary. \n", - "- Present a comprehensive analysis with current price, key metrics, and recent developments\n", - "\n", "**Market Overview Requests**:\n", "- \"What's happening in the market?\" → Use `get_market_overview(\"general\")`\n", "- Summarize all news stories with very brief analysis\n", @@ -109,7 +155,48 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, + "id": "fdf1a2b0-07be-47a0-9ce3-14d21b48c8f2", + "metadata": {}, + "outputs": [], + "source": [ + "def get_current_time() -> Dict[str, Any]:\n", + " \"\"\"\n", + " Retrieve the current UTC time in ISO format with timezone.\n", + " Returns a dictionary for consistency with other tools.\n", + " \"\"\"\n", + " try:\n", + " current_time = datetime.utcnow().isoformat() + 'Z'\n", + " return {\n", + " \"success\": True,\n", + " \"current_time\": current_time\n", + " }\n", + " except Exception as e:\n", + " return {\"success\": False, \"error\": f\"Failed to get time: {str(e)[:100]}\"}" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "12d912fc-91fb-469e-9572-2876a099f5aa", + "metadata": {}, + "outputs": [], + "source": [ + "get_current_time_function = {\n", + " \"name\": \"get_current_time\",\n", + " \"description\": \"Get the current UTC time in ISO format (YYYY-MM-DDTHH:MM:SS.ssssssZ). Useful for temporal reasoning, date calculations, or setting time ranges for queries like news.\",\n", + " \"parameters\": {\n", + " \"type\": \"object\",\n", + " \"properties\": {}, # No parameters needed\n", + " \"required\": []\n", + " }\n", + "}\n", + "get_current_time_tool = {\"type\": \"function\", \"function\": get_current_time_function}" + ] + }, + { + "cell_type": "code", + "execution_count": 8, "id": "61a2a15d-b559-4844-b377-6bd5cb4949f6", "metadata": {}, "outputs": [], @@ -122,13 +209,14 @@ "\n", "def search_symbol(query: str) -> Dict[str, Any]:\n", " \"\"\"Search for stock symbol using Finnhub client\"\"\"\n", - " print(f\"Tool search_symbol called for {query}\")\n", + " logger.info(f\"Tool search_symbol called for {query}\")\n", " try:\n", " if not query or len(query.strip()) < 1:\n", " return {\"success\": False, \"error\": \"Invalid search query\"}\n", " \n", " query = query.strip()[:50]\n", " result = finnhub_client.symbol_lookup(query)\n", + " logger.info(f\"Tool search_symbol {result}\")\n", " \n", " if result.get(\"result\") and len(result[\"result\"]) > 0:\n", " first_result = result[\"result\"][0]\n", @@ -150,7 +238,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "173010e3-dfef-4611-8b68-d11256bd5fba", "metadata": {}, "outputs": [], @@ -177,7 +265,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "448bb4ce-8e86-4ceb-ab52-96bddfd33337", "metadata": {}, "outputs": [], @@ -226,7 +314,7 @@ " - Formats market cap, enterprise value, revenue (Finnhub returns these in millions)\n", " - Returns success flag and readable keys\n", " \"\"\"\n", - " print(f\"Tool get_company_financials called for {symbol}\")\n", + " logger.info(f\"Tool get_company_financials called for {symbol}\")\n", " try:\n", " if not symbol or not symbol.strip():\n", " return {\"success\": False, \"error\": \"Invalid stock symbol\"}\n", @@ -235,6 +323,7 @@ "\n", " # --- API Call ---\n", " financials_resp = finnhub_client.company_basic_financials(symbol, \"all\")\n", + " logger.info(f\"Tool company_basic_financials {financials_resp}\")\n", "\n", " # Finnhub places primary values under \"metric\"\n", " metrics = financials_resp.get(\"metric\", {})\n", @@ -273,7 +362,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "9df7b74e-fec8-4e75-92a9-31acc75e6e97", "metadata": {}, "outputs": [], @@ -301,7 +390,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "cfeeb200-3f30-4855-82b9-cc8b2a950f80", "metadata": {}, "outputs": [], @@ -311,13 +400,14 @@ " Fetch the latest stock quote for a given ticker symbol using Finnhub's /quote endpoint.\n", " Returns current price, daily high/low, open, previous close, percent change, and readable timestamp.\n", " \"\"\"\n", - " print(f\"Tool get_stock_quote called for {symbol}\")\n", + " logger.info(f\"Tool get_stock_quote called for {symbol}\")\n", " try:\n", " if not symbol or len(symbol.strip()) < 1:\n", " return {\"success\": False, \"error\": \"Invalid symbol provided\"}\n", " \n", " symbol = symbol.strip().upper()\n", " data = finnhub_client.quote(symbol)\n", + " logger.info(f\"Tool get_stock_quote {data}\")\n", "\n", " if not data or \"c\" not in data:\n", " return {\"success\": False, \"error\": \"No quote data found\"}\n", @@ -347,7 +437,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "3724d92a-4515-4267-af6f-2c1ec2b6ed36", "metadata": {}, "outputs": [], @@ -372,7 +462,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "62f5d477-6626-428f-b8eb-d763e736ef5b", "metadata": {}, "outputs": [], @@ -392,7 +482,7 @@ " list or dict: Cleaned news data or error message.\n", " \"\"\"\n", " # Validate date format\n", - " print(f\"Tool get_company_news called for {symbol} from {_from} to {to}\")\n", + " logger.info(f\"Tool get_company_news called for {symbol} from {_from} to {to}\")\n", " try:\n", " start_date = datetime.strptime(_from, \"%Y-%m-%d\")\n", " end_date = datetime.strptime(to, \"%Y-%m-%d\")\n", @@ -411,6 +501,7 @@ " # Fetch data\n", " try:\n", " news = finnhub_client.company_news(symbol, _from=_from, to=to)\n", + " logger.info(f\"Tool get_company_news {news}\")\n", " except Exception as e:\n", " return {\"success\": False, \"error\": str(e)}\n", "\n", @@ -424,7 +515,7 @@ "\n", " # Clean & transform objects\n", " cleaned_news = []\n", - " for article in news:\n", + " for article in selected_news:\n", " cleaned_news.append({\n", " \"summary\": article.get(\"summary\"),\n", " \"source\": article.get(\"source\"),\n", @@ -437,7 +528,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "5150ecb6-e3f1-46dc-94fa-2a9abe5165f6", "metadata": {}, "outputs": [], @@ -454,11 +545,11 @@ " },\n", " \"_from\": {\n", " \"type\": \"string\",\n", - " \"description\": \"Start date in YYYY-MM-DD format. Ensure it is not more than 1 year ago.\"\n", + " \"description\": \"Start date in YYYY-MM-DD format. Ensure it is not more than 1 year ago from today. Ensure it is before or equal to the date in to.\"\n", " },\n", " \"to\": {\n", " \"type\": \"string\",\n", - " \"description\": \"End date in YYYY-MM-DD format. Ensure it is not more than 1 year ago.\"\n", + " \"description\": \"End date in YYYY-MM-DD format. Ensure it is not more than 1 year ago. Ensure it is after or equal to the date in from.\"\n", " }\n", " },\n", " \"required\": [\n", @@ -474,7 +565,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "26dd7375-626f-4235-b4a2-f1926f62cc5e", "metadata": {}, "outputs": [], @@ -490,10 +581,11 @@ " Returns:\n", " list or dict: A cleaned list of news articles or error message.\n", " \"\"\"\n", - " print(f\"Tool get_market_news called for category '{category}'\")\n", + " logger.info(f\"Tool get_market_news called for category '{category}'\")\n", "\n", " try:\n", " news = finnhub_client.general_news(category)\n", + " logger.info(f\"Tool get_market_news {news}\")\n", " except Exception as e:\n", " return {\"success\": False, \"error\": str(e)}\n", "\n", @@ -507,7 +599,7 @@ "\n", " # Clean & transform objects\n", " cleaned_news = []\n", - " for article in news:\n", + " for article in selected_news:\n", " cleaned_news.append({\n", " \"headline\": article.get(\"headline\"),\n", " \"summary\": article.get(\"summary\"),\n", @@ -522,7 +614,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "5bd1aa28-119c-4c7a-bdc0-161a582ab1cc", "metadata": {}, "outputs": [], @@ -547,38 +639,21 @@ }, { "cell_type": "code", - "execution_count": null, - "id": "d3378855-b83c-4078-b1e9-5f03e55c7276", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bf29bdd0-7603-45fc-ad39-790eb0b471d5", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a25474d9-128e-431f-9b4c-1b3897798f0b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "bdca8679-935f-4e7f-97e6-e71a4d4f228c", "metadata": {}, "outputs": [], "source": [ - "# And this is included in a list of tools:\n", - "\n", - "tools = [{\"type\": \"function\", \"function\": price_function}]" + "# List of tools:\n", + "tools = [search_symbol_tool, get_company_financials_tool, get_stock_quote_tool, get_company_news_tool, get_market_news_tool, get_current_time_tool]\n", + "tool_functions = {\n", + " \"search_symbol\": search_symbol,\n", + " \"get_company_financials\": get_company_financials,\n", + " \"get_stock_quote\": get_stock_quote,\n", + " \"get_company_news\": get_company_news,\n", + " \"get_market_news\": get_market_news,\n", + " \"get_current_time\": get_current_time\n", + "}" ] }, { @@ -597,45 +672,62 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, + "id": "86f76f57-76c4-4dc7-94a8-cfe7816a39f1", + "metadata": {}, + "outputs": [], + "source": [ + "def execute_tool_call(tool_call):\n", + " func_name = tool_call.function.name\n", + " args = json.loads(tool_call.function.arguments)\n", + "\n", + " logger.info(f\"Executing tool: {func_name} with args: {args}\")\n", + "\n", + " func = tool_functions.get(func_name)\n", + " if not func:\n", + " result = {\"error\": f\"Function '{func_name}' not found\"}\n", + " else:\n", + " try:\n", + " result = func(**args)\n", + " except Exception as e:\n", + " logger.exception(f\"Error executing {func_name}\")\n", + " result = {\"error\": str(e)}\n", + "\n", + " return {\n", + " \"role\": \"tool\",\n", + " \"tool_call_id\": tool_call.id,\n", + " \"content\": json.dumps(result)\n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 20, "id": "ce9b0744-9c78-408d-b9df-9f6fd9ed78cf", "metadata": {}, "outputs": [], "source": [ "def chat(message, history):\n", " messages = [{\"role\": \"system\", \"content\": system_message}] + history + [{\"role\": \"user\", \"content\": message}]\n", - " response = openai.chat.completions.create(model=MODEL, messages=messages, tools=tools)\n", "\n", - " if response.choices[0].finish_reason==\"tool_calls\":\n", - " message = response.choices[0].message\n", - " response, city = handle_tool_call(message)\n", - " messages.append(message)\n", - " messages.append(response)\n", - " response = openai.chat.completions.create(model=MODEL, messages=messages)\n", - " \n", - " return response.choices[0].message.content" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b0992986-ea09-4912-a076-8e5603ee631f", - "metadata": {}, - "outputs": [], - "source": [ - "# We have to write that function handle_tool_call:\n", + " while True:\n", + " # Send to OpenAI\n", + " response = openai.chat.completions.create(model=MODEL, messages=messages, tools=tools)\n", + " ai_message = response.choices[0].message\n", + " finish_reason = response.choices[0].finish_reason\n", "\n", - "def handle_tool_call(message):\n", - " tool_call = message.tool_calls[0]\n", - " arguments = json.loads(tool_call.function.arguments)\n", - " city = arguments.get('destination_city')\n", - " price = get_ticket_price(city)\n", - " response = {\n", - " \"role\": \"tool\",\n", - " \"content\": json.dumps({\"destination_city\": city,\"price\": price}),\n", - " \"tool_call_id\": tool_call.id\n", - " }\n", - " return response, city" + " # If no tool calls, this is user-facing output\n", + " if finish_reason != \"tool_calls\":\n", + " return ai_message.content # ✅ Only return final assistant content\n", + "\n", + " # Otherwise, handle all tool calls in this message\n", + " tool_responses = []\n", + " for tool_call in ai_message.tool_calls:\n", + " tool_responses.append(execute_tool_call(tool_call))\n", + "\n", + " # Add tool call request + tool responses to conversation\n", + " messages.append(ai_message)\n", + " messages.extend(tool_responses)" ] }, { @@ -643,11 +735,94 @@ "execution_count": null, "id": "f4be8a71-b19e-4c2f-80df-f59ff2661f14", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-08-29 02:29:05,739 [INFO] HTTP Request: GET http://127.0.0.1:7860/gradio_api/startup-events \"HTTP/1.1 200 OK\"\n", + "2025-08-29 02:29:05,746 [INFO] HTTP Request: HEAD http://127.0.0.1:7860/ \"HTTP/1.1 200 OK\"\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "* Running on local URL: http://127.0.0.1:7860\n", + "* To create a public link, set `share=True` in `launch()`.\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-08-29 02:29:07,097 [INFO] HTTP Request: GET https://api.gradio.app/pkg-version \"HTTP/1.1 200 OK\"\n", + "2025-08-29 02:29:17,018 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-29 02:29:17,024 [INFO] Executing tool: search_symbol with args: {'query': 'Apple'}\n", + "2025-08-29 02:29:17,025 [INFO] Tool search_symbol called for Apple\n", + "2025-08-29 02:29:17,777 [INFO] Tool search_symbol {'count': 11, 'result': [{'description': 'Apple Inc', 'displaySymbol': 'AAPL', 'symbol': 'AAPL', 'type': 'Common Stock'}, {'description': 'Apple Hospitality REIT Inc', 'displaySymbol': 'APLE', 'symbol': 'APLE', 'type': 'Common Stock'}, {'description': 'Apple iSports Group Inc', 'displaySymbol': 'AAPI', 'symbol': 'AAPI', 'type': 'Common Stock'}, {'description': 'Apple Flavor & Fragrance Group Co Ltd', 'displaySymbol': '603020.SS', 'symbol': '603020.SS', 'type': 'Common Stock'}, {'description': 'Maui Land & Pineapple Company Inc', 'displaySymbol': 'MLP', 'symbol': 'MLP', 'type': 'Common Stock'}, {'description': 'Apple International Co Ltd', 'displaySymbol': '2788.T', 'symbol': '2788.T', 'type': 'Common Stock'}, {'description': 'Applepark Co Ltd', 'displaySymbol': '164A.T', 'symbol': '164A.T', 'type': 'Common Stock'}, {'description': 'Pineapple Inc', 'displaySymbol': 'PNPL', 'symbol': 'PNPL', 'type': 'Common Stock'}, {'description': 'Pineapple Resources Bhd', 'displaySymbol': 'PINEAPP.KL', 'symbol': 'PINEAPP.KL', 'type': 'Common Stock'}, {'description': 'Pineapple Financial Inc', 'displaySymbol': 'PAPL', 'symbol': 'PAPL', 'type': 'Common Stock'}, {'description': 'Pineapple Energy Inc', 'displaySymbol': 'SUNE', 'symbol': 'SUNE', 'type': 'Common Stock'}]}\n", + "2025-08-29 02:29:19,090 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-29 02:29:19,096 [INFO] Executing tool: get_current_time with args: {}\n", + "2025-08-29 02:29:20,043 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-29 02:29:20,047 [INFO] Executing tool: get_stock_quote with args: {'symbol': 'AAPL'}\n", + "2025-08-29 02:29:20,049 [INFO] Tool get_stock_quote called for AAPL\n", + "2025-08-29 02:29:20,274 [INFO] Tool get_stock_quote {'c': 232.56, 'd': 2.07, 'dp': 0.8981, 'h': 233.41, 'l': 229.335, 'o': 230.82, 'pc': 230.49, 't': 1756411200}\n", + "2025-08-29 02:29:30,843 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-29 02:29:44,436 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-29 02:29:44,441 [INFO] Executing tool: get_current_time with args: {}\n", + "2025-08-29 02:29:46,801 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-29 02:29:46,806 [INFO] Executing tool: get_company_news with args: {'symbol': 'AAPL', '_from': '2025-08-21', 'to': '2025-08-28'}\n", + "2025-08-29 02:29:46,808 [INFO] Tool get_company_news called for AAPL from 2025-08-21 to 2025-08-28\n", + "2025-08-29 02:29:47,767 [INFO] Tool get_company_news [{'category': 'company', 'datetime': 1756408626, 'headline': 'Commentary: Trump’s trade war is hurting most sectors of the economy', 'id': 136563635, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The latest round of earnings reports revealed widespread damage from the Trump tariffs and other attacks on trade.', 'url': 'https://finnhub.io/api/news?id=f79d96aa415027377d39121c37660b242b4665192144f64a93b39b1515e24fdb'}, {'category': 'company', 'datetime': 1756405437, 'headline': 'Trump-Intel deal designed to block sale of chipmaking unit, CFO says', 'id': 136563640, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Trump administration’s investment in Intel was structured to deter the chipmaker from selling its manufacturing unit, its chief financial...', 'url': 'https://finnhub.io/api/news?id=f0e37125d1ccd2adc8afe9ffb145ccfa0dd2001cbd1d23eaf1c96270c33ab33f'}, {'category': 'company', 'datetime': 1756403740, 'headline': \"Apple–TSMC Chip Pact Builds Firewall Against Trump's Tariffs\", 'id': 136563655, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc (NASDAQ:AAPL) isn\\'t just building the iPhone 18—it\\'s creating a moat. By reportedly securing nearly half of Taiwan Semiconductor Manufacturing Co Ltd\\'s (NYSE:TSM) initial 2nm chip production capacity, Apple has locked in supply for its flagship device while also erecting a \"firewall\" against President Donald Trump\\'s proposed 100% tariffs on imported semiconductors. Track AAPL stock here. The move highlights how Apple\\'s scale, foresight, and U.S. investments could shield it from the pol', 'url': 'https://finnhub.io/api/news?id=080fa7ce38b3b44861946e6973f447bb280a79ea485c2b2f1ae11a938bbccd90'}, {'category': 'company', 'datetime': 1756401279, 'headline': \"What's Going On With Marvell Technology Stock Thursday?\", 'id': 136563649, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Marvell Technology (NASDAQ:MRVL) shares surged Thursday as investors bet on the company to deliver strong second-quarter results, scheduled for after the closing bell. Optimism has been fueled by accelerating demand for artificial intelligence infrastructure and expectations that Marvell will capture a growing share of hyperscale spending. The rally followed industry peer Nvidia’s (NASDAQ:NVDA) blockbuster results, which reinforced expectations of sustained demand from the artificial intelligenc', 'url': 'https://finnhub.io/api/news?id=4cf8c5984bf7ff829223fe47ee62f42082ee29a59dfa95d4b539bfe0fd0a423e'}, {'category': 'company', 'datetime': 1756400124, 'headline': 'Most of the Other Mag 7 Stocks Are Rising After Nvidia Earnings', 'id': 136563657, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'A group of Magnificent Seven stocks buoyed the S&P 500 after Nvidia earnings, but the chip titan wasn’t among them. The Dow was up 50 points, or 0.1%, while the Nasdaq Composite was up 0.5%. Nvidia shares were down 1% after moving up and down at the open.', 'url': 'https://finnhub.io/api/news?id=e89114f6041717edcc3ed7d65565eac2750bc512978233bdc8c6a18dae1bd6e0'}, {'category': 'company', 'datetime': 1756398112, 'headline': 'Stock Market Today: Nasdaq Up As Pure Storage Triggers Breakaway Buy; Nvidia Cuts Losses, Hormel Dives (Live Coverage)', 'id': 136560744, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Dow Jones index slips in mixed trade Thursday following surprise GDP numbers and jobless claims. Nvidia stock drops after earnings.', 'url': 'https://finnhub.io/api/news?id=58cb2ef567614c88ee8f9a823109d024b43d6de6c4d18baa9bd184de26c931bc'}, {'category': 'company', 'datetime': 1756397760, 'headline': \"A Small Cap In A Big Cap's Clothing\", 'id': 136563776, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1705316992/image_1705316992.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'AAPL is no longer the largest company in the world and now trails both Nvidia and Microsoft in terms of market cap. Click to read.', 'url': 'https://finnhub.io/api/news?id=e809d05668bd6be09e9fc420bf30d52521f1e6e4e7551f49911804ecf2247f3e'}, {'category': 'company', 'datetime': 1756397421, 'headline': 'Trump tariffs are increasingly forcing countries to pick sides between the US and China', 'id': 136560766, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'President Trump’s trade wars are increasingly forcing countries to choose between the US and its main adversaries.', 'url': 'https://finnhub.io/api/news?id=8177e96bbae4398135d97186f74049bba0d0eec4e76863edf5957488c9f737ff'}, {'category': 'company', 'datetime': 1756392896, 'headline': 'Evercore ISI Reiterates Outperform on Apple (AAPL) With $250 PT', 'id': 136560767, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc. (NASDAQ:AAPL) is one of the AI Stocks Analysts Say You Shouldn’t Ignore. On August 22, Evercore ISI reiterated the stock as “Outperform” stating that it likes Apple’s price hikes on Apple TV+. “We think the Apple TV+ price increases could help modestly on services growth, but the real intent is to minimize churn. Services […]', 'url': 'https://finnhub.io/api/news?id=fb1b0e9cc0f40efd15e9b2dfc73b8684dcae4a89f5ba687b678e90e707d05cfb'}, {'category': 'company', 'datetime': 1756391075, 'headline': 'MP Materials: The Defense Establishment Comes A-Calling', 'id': 136562702, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1428654585/image_1428654585.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'MP Materials is strategically positioned as a leading rare earth supplier amid rising US-China tensions and government focus on resource independence. Read the latest stock analysis here.', 'url': 'https://finnhub.io/api/news?id=1727d118f012c8bf42398a37c74b2b2ad9638666dd7efdf80539a5edee7fc302'}, {'category': 'company', 'datetime': 1756390634, 'headline': 'How Trump and Melania meme coins are performing half a year on', 'id': 136557610, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Both tokens launched before the US president's 20 January inauguration and quickly caught fire across crypto forums and political media.\", 'url': 'https://finnhub.io/api/news?id=80aa0488039ed175c0218e44a05e2ea529aed8fb9531d6015adb959f60044895'}, {'category': 'company', 'datetime': 1756389524, 'headline': 'Stock Market Today: Dow Slips, Nasdaq Rises After Surprise GDP, Jobless Claims; Nvidia Drops On Earnings (Live Coverage)', 'id': 136557573, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Dow Jones index slips in mixed trade Thursday following surprise GDP numbers and jobless claims. Nvidia stock drops after earnings.', 'url': 'https://finnhub.io/api/news?id=aecd19ed894e08a95a5c74ed51c36088b293dda61667fd30342cab56ee8a9c0a'}, {'category': 'company', 'datetime': 1756388700, 'headline': '2 Growth Stocks That Could Be Worth $1 Trillion in 5 Years', 'id': 136557612, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'These two longtime market leaders should continue to perform well.', 'url': 'https://finnhub.io/api/news?id=940ed0a9a05b5d73504f52a9a1da73f837f81ad32f7414fc2ea5ed355f0140fe'}, {'category': 'company', 'datetime': 1756387449, 'headline': \"This Overlooked Stock Market Sector is Getting Hot Ahead of the Fed's Expected September Rate Cut\", 'id': 136560763, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'How to track sector rotation in the market, and why old-school utilities are catching a tailwind after Powell’s speech.', 'url': 'https://finnhub.io/api/news?id=f0053dc1668970117d9f9fb0b6ef53faff354c6079b706205c54497955c19026'}, {'category': 'company', 'datetime': 1756386540, 'headline': \"If You'd Invested $1,000 in Apple Stock 5 Years Ago, Here's How Much You'd Have Today\", 'id': 136557613, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'You might be surprised to see how much your investment would be today.', 'url': 'https://finnhub.io/api/news?id=8c9acc794cd8b231a9233116a3dc9e994a56c1c3a82189d074108e98ab54d68b'}, {'category': 'company', 'datetime': 1756386000, 'headline': 'Avalon GloboCare to Launch Online Sales of KetoAir Breathalyzer in the United Kingdom', 'id': 136557614, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'FREEHOLD, N.J., Aug. 28, 2025 (GLOBE NEWSWIRE) -- Avalon GloboCare Corp. (“Avalon” or the “Company”) (NASDAQ: ALBT), a developer of precision diagnostic consumer products, today announced that it will launch the sales of KetoAir™ breathalyzer device and related accessories in the United Kingdom (“UK”). The products will be available for purchase starting September 1, 2025, at www.KetoAir.uk. KetoAir™ is a handheld breathalyzer designed for ketogenic health management (U.S. Food and Drug Administ', 'url': 'https://finnhub.io/api/news?id=e559b96b92a52447e682c0f47c53fa6a508e7398d5b3e5de911491454985d36e'}, {'category': 'company', 'datetime': 1756385063, 'headline': 'Market Chatter: Apple Warns UK Strategic Market Status Could Harm Users, Developers', 'id': 136557615, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple (AAPL) believes that Britain's plans to increase competition in the mobile operating system ma\", 'url': 'https://finnhub.io/api/news?id=16193e567e9dc751ddfab0787f451b0f6978ff34d2d52737bb037964cb3088cc'}, {'category': 'company', 'datetime': 1756383230, 'headline': 'The Swatch Group: Running Out Of Time', 'id': 136559852, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1791242549/image_1791242549.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Swatch Group struggles with smartwatch disruption, falling EPS, and weak demand. Learn about its challenges, risks, and potential value opportunities.', 'url': 'https://finnhub.io/api/news?id=ca5970ea6e8ed42a4e3691dca273ba9e121de29acb56336c9560a79eabb40437'}, {'category': 'company', 'datetime': 1756382877, 'headline': 'When will iPhone 17 be released? What features to expect? What to know in Tennessee', 'id': 136557616, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The newest iPhone is expected to be announced during a Sept. 9 event, meaning it could hit the market in the coming weeks.', 'url': 'https://finnhub.io/api/news?id=93b0e7100da77cd91b5a784d1f044e99eccd00657935413602ac3754d95e9341'}, {'category': 'company', 'datetime': 1756382470, 'headline': 'As Trump And Intel Make News, This Nvidia, AMD Partner Chips Away At A Breakout', 'id': 136557617, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'With the semiconductor industry in focus as Nvidia reports, the Trump administration takes a stake in Intel and TSMC stock etches a buy point.', 'url': 'https://finnhub.io/api/news?id=0639e7b2512036ffaa5f122e7bccb0a595e35b5f4a85fef22a1f742133d79902'}, {'category': 'company', 'datetime': 1756382400, 'headline': 'Get ready, EV owners: Here come the dongles', 'id': 136557728, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The transition from CCS to NACS will unlock thousands more fast chargers for many EV drivers, but they'll need to know their adapters to get the most out of it.\", 'url': 'https://finnhub.io/api/news?id=791f3b535a827c891140497cf89f87e37078b485a1c9d281692e6e62701cbbb6'}, {'category': 'company', 'datetime': 1756382400, 'headline': 'Could Buying MP Materials Today Set You Up for Life?', 'id': 136557618, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'MP Materials stock has surged over 300% in 2025. Can it keep that up?', 'url': 'https://finnhub.io/api/news?id=cde8cb7b7e803b646fd2e21292c3e4b0908454b34eabfb4a04c9a2ad56b8a879'}, {'category': 'company', 'datetime': 1756382143, 'headline': 'Morgan Stanley Maintains Equalweight on Skyworks (SWKS), Cuts Price Target Amid Broadcom Content Loss', 'id': 136557619, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Skyworks Solutions, Inc. (NASDAQ:SWKS) ranks among the best 5G stocks to buy now. Morgan Stanley retained its Equalweight rating on Skyworks Solutions, Inc. (NASDAQ:SWKS) and reduced its price target from $68 to $65 on August 6. Based in part on Apple’s previous remarks, the research firm noticed that the supply chain for smartphones has outperformed […]', 'url': 'https://finnhub.io/api/news?id=dd93604c17d502c50685fcce411f0ad5afa787886bc30b3edeebde6530455293'}, {'category': 'company', 'datetime': 1756380630, 'headline': 'Apple says UK mobile market shake-up could harm users and developers', 'id': 136557620, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"LONDON -Apple said on Thursday Britain's plans to increase competition in the mobile operating system market could harm users and developers, and potentially force the company to share its technology with foreign competitors for free. Last month, Britain's competition regulator told Apple and Android-owner Google to be fairer in how they distribute apps on their mobile platforms, setting out possible interventions as it plans to designate the U.S. tech companies with strategic market status over their duopoly.\", 'url': 'https://finnhub.io/api/news?id=4586d9fb5c2a41f4c8105a80667c11835661ad496368946acf15b94c6272ad1d'}, {'category': 'company', 'datetime': 1756378650, 'headline': \"Tesla sales drop 40% across Europe in July as China's BYD sees jump\", 'id': 136557621, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Sales of Tesla cars have continued to decline across Europe, falling 40% in July, as Chinese rival BYD saw a surge in registrations in the region last month.', 'url': 'https://finnhub.io/api/news?id=46d0e09bc4cfda7fd65bf1f247e15ce13082d242766a227b93cc70e92bcf6bf2'}, {'category': 'company', 'datetime': 1756377360, 'headline': 'AGs attack deepfake porn payments', 'id': 136560769, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple, Visa and others must be “more aggressive” in banning payment authorization for nonconsensual deepfake content, state AGs told the companies.', 'url': 'https://finnhub.io/api/news?id=5b99f45abab1c5465df76ca6c27da2afd266ebef62599d480a55d33d7590e981'}, {'category': 'company', 'datetime': 1756376520, 'headline': \"12 Stocks Warren Buffett's Berkshire Hathaway Has Been Loading Up On in 2025\", 'id': 136557622, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Despite a few big stock sales, there have been a lot of additions to Berkshire's portfolio.\", 'url': 'https://finnhub.io/api/news?id=3d261fc0e50b40a48d492134da9a6984c463cd0ba69e573fa387ef3c50489f9f'}, {'category': 'company', 'datetime': 1756376229, 'headline': 'Apple (AAPL): Examining Valuation as AI Concerns and Product Launches Dominate Attention', 'id': 136557623, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple (AAPL) has always had a knack for capturing headlines, but lately, it’s been the company’s moves—or lack of moves—in artificial intelligence that are drawing outsized attention from investors. As Apple prepares for its upcoming product event with new iPhones and wearables expected, multiple reports suggest the tech giant is under mounting pressure to prove it can catch up in the AI race. Recent partnership talks and news of possible acquisitions only add to the drama, as the market...', 'url': 'https://finnhub.io/api/news?id=9a405abfbd5a198d23b48942eeaf8cd2758d491872dc294d2d477e168c22259c'}, {'category': 'company', 'datetime': 1756375801, 'headline': 'How Twilio’s (TWLO) Global RCS Launch Could Shape Its Messaging Platform and Customer Trust', 'id': 136557624, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Twilio recently announced the global general availability of Rich Communication Services (RCS) messaging, enabling more than 349,000 active customers to send branded, verified, and interactive messages across Android and iOS devices through its Programmable Messaging and Verify APIs. This launch, following Apple’s rollout of RCS support and expanding Twilio's reach across 20+ countries, positions the company to address rising messaging fraud by bolstering customer trust and enabling richer,...\", 'url': 'https://finnhub.io/api/news?id=ca2307c8e7be2ecfaff7e462350f223f2840e596cd366e3fe1573e6bd327b14b'}, {'category': 'company', 'datetime': 1756372500, 'headline': 'Prediction: 1 Artificial Intelligence (AI) Stock Will Be Worth More Than Palantir Technologies and Amazon Combined by 2030', 'id': 136557607, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Palantir is one of the most valuable software businesses in the world, while Amazon remains a trillion-dollar giant.', 'url': 'https://finnhub.io/api/news?id=fc96e4f9665522a0c22481cd146e66d9b5ce8ce2934077c86c504f0697260d9a'}, {'category': 'company', 'datetime': 1756370411, 'headline': 'Bitcoin price recovers as Nvidia earnings fuel risk appetite', 'id': 136557626, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'It came as the S&P 500 notched a record high and Nvidia delivered stronger-than-expected quarterly results, reinforcing investor appetite for risk assets.', 'url': 'https://finnhub.io/api/news?id=8c3119a8a72d87a448ff861e8e4d4b8619a0635371e0e3713c949308eb32f044'}, {'category': 'company', 'datetime': 1756368912, 'headline': 'LIVE: Wall Street and European stocks mixed as US GDP revised higher and weekly jobless claims fall', 'id': 136557627, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"US GDP grew at a 3.3% annualised pace last quarter, according to the government's second estimate.\", 'url': 'https://finnhub.io/api/news?id=94bd66317beaa9f8b873ea175cd746f9091c5c1fd8938424b2ca4e20259b5df2'}, {'category': 'company', 'datetime': 1756364760, 'headline': 'Zacks Investment Ideas feature highlights: Apple, Meta Platforms and DoorDash', 'id': 136557628, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple, Meta and DoorDash all smashed Q2 expectations with record-breaking growth, strong margins and bullish post-earnings momentum.', 'url': 'https://finnhub.io/api/news?id=753d4c569e19112422028eb00f371cfd015fbeeca321005775f91b9d77d6b158'}, {'category': 'company', 'datetime': 1756364400, 'headline': 'Apple accuses Britain of ‘EU-style’ crackdown', 'id': 136557629, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple has accused Britain’s competition watchdog of stifling growth with an “EU-style” crackdown on the iPhone maker.', 'url': 'https://finnhub.io/api/news?id=88bb9408c819df29b22469513d47540a5d54f0585fc8caf47ac8288a93fd41b8'}, {'category': 'company', 'datetime': 1756326420, 'headline': 'Apple Teases iPhone 17 Launch With Sept. 9 Showcase', 'id': 136541162, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Event to spotlight slimmer phone, new watches, AirPods and AI', 'url': 'https://finnhub.io/api/news?id=57f533b5c833e80c1d77f63268da8555521d3d5583d5684b46ac7036d8b0d570'}, {'category': 'company', 'datetime': 1756323780, 'headline': \"Warren Buffett's Berkshire Hathaway Trims Apple Stake, Again. What's the Deal?\", 'id': 136541163, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The massive conglomerate now has a cash hoard of $344 billion.', 'url': 'https://finnhub.io/api/news?id=7dc81e41b6376258c7eb512fa47525b93dbc56d436b9acee7318023adae6a69f'}, {'category': 'company', 'datetime': 1756320350, 'headline': 'Apple (AAPL) Buy Rating Maintained Ahead of Potential September Event', 'id': 136541164, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc. (NASDAQ:AAPL) is one of the AI Stocks Analysts Are Tracking Closely. On August 25, Bank of America reiterated the stock as “Buy” and acknowledged that even though there are reports that there is no official iPhone event yet scheduled on September 9 for Apple, investors should tone down their expectations for the next cycle […]', 'url': 'https://finnhub.io/api/news?id=36ef4b48e9a75c5faaad802d9779733bd8eb0d2ed1aff058090ccf2ffbf76544'}, {'category': 'company', 'datetime': 1756317830, 'headline': 'Chipolo, an AirTag rival, debuts rechargeable trackers with a six-month battery life', 'id': 136541165, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Chipolo debuts a lineup of rechargeable trackers to compete with AirTag and others.', 'url': 'https://finnhub.io/api/news?id=058e82cd659bfbb73fd85321d63d0825a8cd02ec4774a2cb53eda240bbffd98d'}, {'category': 'company', 'datetime': 1756315800, 'headline': '[Latest] Global Motion Graphics Market Size/Share Worth USD 280 Billion by 2034 at a 12.2% CAGR: Custom Market Insights (Analysis, Outlook, Leaders, Report, Trends, Forecast, Segmentation, Growth Rate, Value, SWOT Analysis)', 'id': 136539413, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': '[220+ Pages Latest Report] According to a market research study published by Custom Market Insights, the demand analysis of Global Motion Graphics Market size & share revenue was valued at approximately USD 85.5 Billion in 2024 and is expected to reach USD 98.3 Billion in 2025 and is expected to reach around USD 280 Billion by 2034, at a CAGR of 12.2% between 2025 and 2034. The key market players listed in the report with their sales, revenues and strategies are Adobe Inc., Autodesk Inc., Maxon', 'url': 'https://finnhub.io/api/news?id=e6f397e64732b302a0646b559119b00c38feacf9f0c5daffee527ec2fb030208'}, {'category': 'company', 'datetime': 1756315645, 'headline': 'Pfizer: Finally Some Fortune, Plus Twenty High-Quality Dividend Growth Valuations', 'id': 136542130, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2203006359/image_2203006359.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"Discover high-quality dividend-growth stocks near 52-week lows. Explore Pfizer's strong dividend and valuations, plus other top picks like Merck and Qualcomm.\", 'url': 'https://finnhub.io/api/news?id=ec425284e980cf083d7d06feec4294590bc48a5d33b2fdd798c828b58de26570'}, {'category': 'company', 'datetime': 1756312967, 'headline': \"Cracker Barrel logo debacle isn't CEO Julie Masino's only challenge: Opening Bid top takeaway\", 'id': 136538441, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Cracker Barrel has a host of issues.', 'url': 'https://finnhub.io/api/news?id=5d954f41f3cbb1bd20135e12731d5043295f6c7a22381c604c77986feb3e3dd7'}, {'category': 'company', 'datetime': 1756310381, 'headline': 'The Gap Between Nvidia and the Next Largest Company Is Now $700 Billion', 'id': 136539403, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Nvidia's market capitalization stood at about $4.4 trillion this week, about $700 billion ahead of the next most valuable company, Microsoft. The gap between the AI chip giant and the next largest public company has never been wider, according to Dow Jones Market Data.\", 'url': 'https://finnhub.io/api/news?id=f9ce19a19e80e96971dc5bb4e5998b4f73764cfdb89fda81e2cd7672edc77884'}, {'category': 'company', 'datetime': 1756308600, 'headline': 'Q2 Earnings: These 3 Tech Stocks Shattered Expectations', 'id': 136539416, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The 2025 Q2 earnings cycle is nearing its end, with these three companies' results stealing the spotlight. Can they repeat their stellar performances in the Q3 season?\", 'url': 'https://finnhub.io/api/news?id=c8908ad4d0110207fd887b4cbe53973de66b66981914f3ae3f421964cfd4e39d'}, {'category': 'company', 'datetime': 1756305529, 'headline': 'How Apple investors should weigh India tariffs & ongoing AI lag', 'id': 136539417, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple (AAPL) is ramping up production at five factories in India ahead of its iPhone 17 launch, all while facing new 50% tariffs from the US on Indian goods. Yahoo Finance Senior Reporter Ines Ferré and Slatestone Wealth chief market strategist Kenny Polcari, who is also the host of Yahoo Finance's Trader Talk podcast, join Opening Bid host Brian Sozzi to weigh in on the headline risk to Apple. To watch more expert insights and analysis on the latest market action, check out more\\xa0Opening Bid.\", 'url': 'https://finnhub.io/api/news?id=f985e17b57b8661a44209cdab0364c36ab40feed82fbacbada76d466df119581'}, {'category': 'company', 'datetime': 1756303740, 'headline': 'Apple Music Taps TuneIn to Expand Global Access to Its Live Radio Stations', 'id': 136539418, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Beginning today, listeners around the world can stream all six commercial-free Apple Music live radio stations on TuneIn SAN FRANCISCO, Aug. 27, 2025 (GLOBE NEWSWIRE) -- TuneIn, the world’s leader in live audio, today announced a new partnership with Apple to expand access to Apple Music’s commercial-free live radio stations to listeners around the world. This marks the first time Apple’s 24/7 global radio stations are available outside of its own native platform. Starting today, all six free Ap', 'url': 'https://finnhub.io/api/news?id=e0413ec85f8c3aca11dd19d3b50b0f1680a6191a99c9e1760725d09871ab2e5f'}, {'category': 'company', 'datetime': 1756302300, 'headline': 'My 3 Favorite Stocks to Buy Right Now', 'id': 136536616, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Contrary to a common assumption at this time, not every stock is priced too richly or poses too much risk. Several underappreciated and undervalued names are just waiting to be found.', 'url': 'https://finnhub.io/api/news?id=5c9c5ad47420d627cfdffdc181bb0a20b74931b5b9a4ee6e4b598a7fe15ffe94'}, {'category': 'company', 'datetime': 1756300020, 'headline': 'COLLEGE FOR CREATIVE STUDIES LAUNCHES APPLE FOUNDATION PROGRAM, FREE CODING COURSES FOR DETROITERS', 'id': 136536132, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Apple Foundation Program at CCS will welcome its first cohort in October 2025, offering a free introductory app development course with access to laptops and additional devices. CCS Apple Foundation Lab Courtesy of College for Creative Studies CCS Apple Foundation Lab Courtesy of College for Creative Studies Detroit, MI, Aug. 27, 2025 (GLOBE NEWSWIRE) -- The College for Creative Studies (CCS) is excited to launch the Apple Foundation Program, a free app development program coming to the Coll', 'url': 'https://finnhub.io/api/news?id=c39f266620c5451aea0891907dfe081dc8bad553e13b1175be1a2c1955a20968'}, {'category': 'company', 'datetime': 1756299600, 'headline': 'Apple Makes Music Push in Radio After Losing Ground to Spotify', 'id': 136539420, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The deal with digital radio platform TuneIn marks the first time Apple Music’s six radio stations will be available outside the company’s app.', 'url': 'https://finnhub.io/api/news?id=2b3af74ab5be8c92b9fc60e9ddf9ea2316e2a7b47b4705db59639bc775ff1581'}, {'category': 'company', 'datetime': 1756299600, 'headline': 'ESR to Unveil Game-Changing Tech Innovations at IFA 2025', 'id': 136536133, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'ESR, a global tech brand trusted by over 123 million users, will present its newest innovations at IFA 2025 from September 5–9 at Messe Berlin. Guided by its mission \"Tech Made Easier,\" ESR is set to unveil industry-first accessories that deliver wired-speed magnetic charging, stronger device protection, and more flexible productivity.', 'url': 'https://finnhub.io/api/news?id=ab2ce5abbf3516bc95c82979500217ce98402582a6083375f7b1edb7e0e92ab8'}, {'category': 'company', 'datetime': 1756298700, 'headline': 'Billionaire Bill Ackman Just Bought This Magnificent Artificial Intelligence (AI) Stock, Which Could Join Nvidia, Microsoft, and Apple in the $3 Trillion Club By 2028', 'id': 136536103, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Ackman\\'s hedge fund, Pershing Square, recently added another \"Magnificent Seven\" stock to its portfolio.', 'url': 'https://finnhub.io/api/news?id=0dcbb9593b57a4f988911c73d340dec2c9ee67cf5fe2dc86402a13ec133409be'}, {'category': 'company', 'datetime': 1756298544, 'headline': 'MetaMask Adds Google and Apple Login to Simplify Self-Custodial Wallet Access', 'id': 136536135, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'MetaMask has launched social login functionality, allowing users to create and recover self-custodial wallets using Google or Apple accounts, eliminating the need to manually manage traditional 12-word Secret Recovery Phrases while preserving complete user control over private keys. The feature combines familiar Web2 authentication with advanced cryptographic techniques, including Threshold ...', 'url': 'https://finnhub.io/api/news?id=fefb7a0bd947b9ea884c2ad78bba45b797bbc2fe6e7e419fbc1f41f9bc40b0fe'}, {'category': 'company', 'datetime': 1756297975, 'headline': 'Alphabet At The Crossroads: Legal Minefield Or Money Machine', 'id': 136538321, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/872409924/image_872409924.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Alphabet faces antitrust risk, but a breakup could unlock hidden value.', 'url': 'https://finnhub.io/api/news?id=94344a89f867ac85036a39124e9fd93cc16cff445838394e0d8c309e5273eceb'}, {'category': 'company', 'datetime': 1756295929, 'headline': 'Microsoft vs. Apple: Which Stock Has Performed Better Since Trump Took Office?', 'id': 136536116, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple and Microsoft stocks have surged—but which one performed better? See how these tech giants stack up during Trump’s second term so far.', 'url': 'https://finnhub.io/api/news?id=854230d76b6fd36b2a4ae52e69d5f5bec794619ea75e004e447c9a78ffa760ca'}, {'category': 'company', 'datetime': 1756295100, 'headline': 'As Warren Buffett Continues to Trim Apple Stake, Should Investors Be Worried?', 'id': 136536137, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple now comprises 21% of Berkshire's closely monitored equity portfolio.\", 'url': 'https://finnhub.io/api/news?id=5d982d0ed73fdda2a4280275c09cefba88552b34a1299052e0f5263e263ba3a5'}, {'category': 'company', 'datetime': 1756291928, 'headline': 'What happens to your pension if your relationship ends?', 'id': 136536138, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"If there's an overreliance on one partner’s pension and you end up breaking up you could find yourself close to retirement with little in the way of income.\", 'url': 'https://finnhub.io/api/news?id=c3f07c39e3f7a9bf94894372a3977c0b5aad0f22174af5931a31c0f99e318f63'}, {'category': 'company', 'datetime': 1756291569, 'headline': \"Tesla Stock 'Could Fall 90% Tomorrow,' Fund Manager Still Won't Buy — Here's Where He's Investing Instead\", 'id': 136536120, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Tesla Inc (NASDAQ:TSLA) stock has fallen 8% year-to-date in 2025 and some investors and analysts believe the stock remains overvalued with more room to fall. One of the top-performing fund managers thinks Tesla stock could have significant downside ...', 'url': 'https://finnhub.io/api/news?id=434f7927d77afa8219186d9fdcb67ead90bbb30935a3a8e8f48580f5bcbf65a1'}, {'category': 'company', 'datetime': 1756291392, 'headline': 'AI Weekly: grouchy Grok and the wizard of bots', 'id': 136536140, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"STORY: From why Elon Musk says Apple is being mean to Grok, to how bots reinvented the Wizard of Oz, this is AI Weekly.:: AI Weekly:: Sphere Entertainment\\xa0Elon Musk’s xAI is suing Apple and OpenAI, claiming they conspired to thwart competition.He says they gave prominence to ChatGPT in Apple’s app store, while limiting the profile of his competing chatbot Grok.OpenAI said the case was just another example of what it called Musk’s “pattern of harassment”.Meta is set to back political candidates who back lighter regulation of AI.The Facebook parent says it will set up a California-focused political action committee to back state-level candidates from either party.It plans to spend tens of millions of dollars on the effort, potentially putting it among the state's top politicial spenders ahead of a 2026 governor race.\\xa0DeepSeek has unveiled an upgraded model that it says is can be optimised to work with Chinese chips.That may signal it’s positioned to work with the country’s own semiconductor makers, as Beijing pushes to reduce its reliance on U.S. tech.Earlier this year, DeepSeek shook the sector when it released an AI model able to compete with the likes of ChatGPT, but developed at much lower cost.:: Sphere EntertainmentAI has reimagined “The Wizard of Oz”.The famous film will be shown in Las Vegas on a towering spherical screen that surrounds viewers.AI tools preserve the original performances, but also add new elements.Ben Grossman is the boss of visual effects firm Magnopus:“We need to drastically increase the resolution and detail of the original movie, we need to complete the missing parts of the people who were cut off and then we need to create the continuity of the scene so that the performances that you know are there are actually there.”And Google focused on AI when unveiling its latest Pixel phones.:: Google\\xa0That includes a “coach” in the camera app that can help users take better pictures.There’s also an AI assistant that can display useful information before it’s even asked, such as showing a flight confirmation email when the user calls an airline.\", 'url': 'https://finnhub.io/api/news?id=2b6a4d8f83a26751f9c767abe00e26abbabfb1071fff7f699c0518d49891f5ce'}, {'category': 'company', 'datetime': 1756290780, 'headline': 'It’s Trump’s Market Now. How to Navigate Fed Threats, State Stock Buying, Economic Curveballs.', 'id': 136536141, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Trump escalates Fed fight, Apple teases product event next week, Cracker Barrel drops new logo, and more news to start your day.', 'url': 'https://finnhub.io/api/news?id=67a5e0f03199596b736b0f4d450d0b0f50f5413e3f39010b9f387d60351fe739'}, {'category': 'company', 'datetime': 1756288800, 'headline': 'The Best \"Magnificent Seven\" Stock to Buy Right Now, According to Wall Street (Hint: Not Nvidia)', 'id': 136536125, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Almost every analyst agrees this AI giant is a buy with plenty of upside left.', 'url': 'https://finnhub.io/api/news?id=d6cefbf6bd2b81a2d3edda7b925845062de2a510ca2d395594240036c0b0c4dc'}, {'category': 'company', 'datetime': 1756285332, 'headline': 'EU to Propose Removing US Tariffs This Week to Meet Trump Demand', 'id': 136539421, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The European Commission, which handles trade matters for the EU, will also give preferential tariff rates on certain seafood and agricultural goods, according to people familiar with the matter. The EU has conceded that the trade arrangement struck with Trump favors the US but that the accord is necessary to give businesses stability and certainty.', 'url': 'https://finnhub.io/api/news?id=612cccf472079a1f84ac02fea985ed07785463e11fce1542fde2df16313aa3ce'}, {'category': 'company', 'datetime': 1756285263, 'headline': 'Crypto Industry Unites Against Senate Bill Over Protections for Software Devs', 'id': 136536143, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Top crypto and tech groups said they would not support the Senate’s market structure bill without new language shielding developers from criminal liability.', 'url': 'https://finnhub.io/api/news?id=c1422933d13544e8a6ea15de880fcc0b45d85931f54e313abb4d5f1d9dc447c4'}, {'category': 'company', 'datetime': 1756285020, 'headline': 'Prediction: This Unstoppable Vanguard ETF Will Keep Beating the S&P 500 Over the Long Term', 'id': 136536127, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The S&P 500 typically delivers strong long-term returns, but this Vanguard ETF has consistently outperformed it.', 'url': 'https://finnhub.io/api/news?id=de010cb83b6d643dc3697d4fcd9dee466c036b714ed688738a4d10e9b0ab9387'}, {'category': 'company', 'datetime': 1756284300, 'headline': 'Ben Graham Misquoted: The Stock Market Is Never A Weighing Machine', 'id': 136535891, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1329937320/image_1329937320.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"The stock market is not a weighing machine in the long run. Check out Graham's insights on why the stock market operates as a voting machine.\", 'url': 'https://finnhub.io/api/news?id=1f8e990b991e9dd7e08e7bbe07edf4020234609d120abc13241f0507716fe9e4'}, {'category': 'company', 'datetime': 1756282320, 'headline': 'The New Conversational Standard: Rich Communication Services Market Forecast Report 2025-2030, with Profiles of Google, Apple, Twilio, Sinch, Infobip, MessageBird, and GSMA', 'id': 136536145, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The RCS market is poised for rapid growth, driven by Apple\\'s RCS integration in iOS 18, unifying global users. Key opportunities lie in leveraging RCS Business Messaging for enhanced brand-consumer interaction, exploring high-growth regions like Asia-Pacific, and integrating RCS into digital strategies for MNOs, enterprises, and CPaaS providers.Dublin, Aug. 27, 2025 (GLOBE NEWSWIRE) -- The \"New Conversational Standard: Rich Communication Services (RCS) Market Analysis, RBM Opportunities, and Glo', 'url': 'https://finnhub.io/api/news?id=cdf9963e9810636d6dd5ad679403d87a7fe343bdfeb4099a71f0413bebce46b6'}, {'category': 'company', 'datetime': 1756281713, 'headline': 'FTSE 100 LIVE: Stocks mixed as UK energy prices set to rise more than expected', 'id': 136536146, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The increase kicks in at start of October, which campaigners say will mean another winter of relatively high energy bills.', 'url': 'https://finnhub.io/api/news?id=c651e4c616007403c5a8acfaffde18b8820eec9726a0ae66c4e971e13aadc1cf'}, {'category': 'company', 'datetime': 1756279166, 'headline': 'IMAX Corporation (IMAX) Signs Expansion Agreement with Apple Cinemas for New IMAX with Laser Systems', 'id': 136536147, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'With strong upside potential and significant hedge fund interest, IMAX Corporation (NYSE:IMAX) secures a spot on our list of the 10 Must-Buy Canadian Stocks to Invest in. A significant expansion agreement for five new IMAX with Laser systems around the United States was announced by IMAX Corporation (NYSE:IMAX) and Apple Cinemas on August 7, 2025, […]', 'url': 'https://finnhub.io/api/news?id=fbfd81ca0494903d8d382c281080e814876acca5f579b9bc868ceec4ef3aec61'}, {'category': 'company', 'datetime': 1756278300, 'headline': 'Parallels Launches Parallels Desktop 26 with Support for macOS Tahoe 26, Compatibility with Windows 11 25H2, and New IT Management Tools', 'id': 136536131, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The latest release introduces more secure VM management, accurate Mac disk visibility in Windows, renewed SOC 2 Type II compliance, and more simplified deployment and device management for enterprise IT teams Parallels Desktop 26 for Mac Parallels Desktop is the only Microsoft-authorized way to run Windows 11 on Macs with Apple silicon. Parallels Desktop for Mac Enterprise Edition Parallels Desktop 26 introduces powerful enterprise features, making it easier for IT teams to manage, monitor, and', 'url': 'https://finnhub.io/api/news?id=a16e2511406c745e43e1cbd4a820454a72f67143b38c49df587d7f919b067ee8'}, {'category': 'company', 'datetime': 1756274568, 'headline': 'Trump Slaps India With 50% Tariffs, Upending Ties With Modi', 'id': 136536149, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The new tariffs, the highest in Asia, took effect at 12:01 a.m. in Washington on Wednesday, doubling the existing 25% duty on Indian exports. The levies will hit more than 55% of goods shipped to the US — India’s biggest market — and hurt labor-intensive industries like textiles and jewelry the most. Key exports like electronics and pharmaceuticals are exempt, sparing Apple Inc.’s massive new factory investments in India for now.', 'url': 'https://finnhub.io/api/news?id=fe4f2d299dc86ea71bb917b7cd3ca3260f0913917841a08a8b2e61130f156555'}, {'category': 'company', 'datetime': 1756267201, 'headline': 'The Chinese gadget maker taking on Tesla and Apple', 'id': 136536150, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'An electric vehicle factory built by China’s largest smartphone maker has become a tourist attraction in Beijing, with visits to the company...', 'url': 'https://finnhub.io/api/news?id=4cd753b8caeb83784586d510ce431255fbfe91882b4713b02fb81661cecef582'}, {'category': 'company', 'datetime': 1756266829, 'headline': 'Can Apple’s (AAPL) AI Partnerships Revive Investor Sentiment?', 'id': 136536151, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc. (NASDAQ:AAPL) is one of the top stocks to buy and hold forever. Apple Inc. (NASDAQ:AAPL) is often seen as a textbook example of how to build and strengthen a moat over time. Its brand strength, device and services ecosystem lock-in, and customer loyalty enable it to generate recurring revenues, maintain strong pricing power, and consistently […]', 'url': 'https://finnhub.io/api/news?id=3ebfed59c2e2e7119d0b4077fd406bb25fd5f0e2ef25dbf50f73bd57e334546f'}, {'category': 'company', 'datetime': 1756263240, 'headline': 'The Most Overvalued Of Mag7: Why Apple Gets My Sell', 'id': 136534658, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1705316992/image_1705316992.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Apple is recognized as a leader, but execution lags. Click here to read more about AAPL stock and why it is rated as a Sell.', 'url': 'https://finnhub.io/api/news?id=1926506c568d5cc3875b9c40c9a3b211652036847eb5d504f84db226cf67ade7'}, {'category': 'company', 'datetime': 1756235481, 'headline': 'Alphabet Lands $10B Meta Cloud Deal--Is A Siri-Gemini Deal Close?', 'id': 136532253, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2210768067/image_2210768067.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"Alphabet Inc.'s Google Cloud lands a $10B Meta deal, challenging AWS and Azure. Click for my updated look at GOOGL stock and why I remain bullish.\", 'url': 'https://finnhub.io/api/news?id=86e5017e035d7aea11fa1ea7fec5b5fb9004d28101950c42bee1a638795926d5'}, {'category': 'company', 'datetime': 1756231255, 'headline': \"Apple Promises 'Awe Dropping' Event Sept. 9\", 'id': 136529950, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple announced Tuesday that it will hold its fall product launch event on Sept. 9, likely headlined by the iPhone 17 series handsets.', 'url': 'https://finnhub.io/api/news?id=eb6ebae095d68639321c7bc616ac6707bbdf8b06f84f539109f00dbba2859e61'}, {'category': 'company', 'datetime': 1756228823, 'headline': 'OMAH: A Berkshire Hathaway Copycat With A 15% Distribution Yield', 'id': 136531630, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1030142522/image_1030142522.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"OMAH ETF seeks 15% annual yield via covered calls on Berkshire's holdings, ideal for income investors. Click here to read my most recent analysis of OMAH.\", 'url': 'https://finnhub.io/api/news?id=58990138d8fe8d477a6838738136d46cb3da707c449f5d2bca585ad94a3798e7'}, {'category': 'company', 'datetime': 1756228320, 'headline': \"Can Strong Content Portfolio Drive Apple's Streaming Prospects?\", 'id': 136529951, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple TV+ hits record Emmy nods and box office success as Services revenues jump double digits despite tough streaming competition.', 'url': 'https://finnhub.io/api/news?id=24b80129567e08f81469955913d3e7c594cf01f50aca4b2796eda55dc206bf7a'}, {'category': 'company', 'datetime': 1756228268, 'headline': \"Elon Musk's xAI sues Apple, OpenAI over AI competition and App Store rankings\", 'id': 136529952, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Elon Musk's xAI filed a lawsuit against Apple and OpenAI in federal court, alleging the companies conspired to prevent competition in the market for artificial intelligence tools.\", 'url': 'https://finnhub.io/api/news?id=13d253c2491e234963d5e88a6cbbdf36bf22ffeebb0b00664a073e991643a738'}, {'category': 'company', 'datetime': 1756228243, 'headline': 'Apple product launch, Meta Super PAC, Trump & Cracker Barrel', 'id': 136529953, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Yahoo Finance's John Hyland tracks Tuesday's top moving stocks and biggest market stories in this Market Minute: Apple's (AAPL) upcoming fall product launch on Sept. 9, Meta (META) reportedly launching a Super PAC focused on artificial intelligence (AI), and President Trump weighing in on the new Cracker Barrel (CBRL) logo. Stay up to date on the latest market action, minute-by-minute, with Yahoo Finance's Market Minute.\", 'url': 'https://finnhub.io/api/news?id=35b93c4400f7b555a2910620d9bca12e0bd6cfaa86ba56d5de59646fba94d752'}, {'category': 'company', 'datetime': 1756226940, 'headline': 'Apple’s Annual Event Will Be Sept 9. What to Expect for the iPhone and AI.', 'id': 136529954, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple will host its annual product event on Sept. 9, the company said Tuesday. Investors and customers alike will be looking for announcements regarding the company’s next iPhone launch and artificial intelligence updates. The Apple event—almost always takes place in September—unveils what new products and updates the company will be launching in the weeks to follow.', 'url': 'https://finnhub.io/api/news?id=b5a5a400b786c4cc164f9ec881a2311d566332bdf548a2fc5818ef858d748573'}, {'category': 'company', 'datetime': 1756226127, 'headline': 'Not so fast: German court says Apple can’t call Watch carbon neutral', 'id': 136529955, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple's carbon neutral claims are undermined by the short-term nature of carbon credits used to support them, the court said.\", 'url': 'https://finnhub.io/api/news?id=83f2575c7a3b3ada4263ced904f915e73685c92c56a4c9b377936566bd926fdc'}, {'category': 'company', 'datetime': 1756225200, 'headline': 'More Volatility Ahead In This AI Bull Market', 'id': 136531096, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1388937775/image_1388937775.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Gary Vaughan from Daily Stock PicksÂ\\xa0on buying the dip, crypto long-term and why bonds might now be a once in a lifetime buy.', 'url': 'https://finnhub.io/api/news?id=02e88f1c840a10605837aa875c0e48f3a5667a8415226907fb48b5338249b884'}, {'category': 'company', 'datetime': 1756224432, 'headline': 'Apple to hold fall event on September 9, new iPhones expected', 'id': 136529956, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The event will be held at the Steve Jobs Theater at Apple's headquarters in Cupertino, California and serve as a showcase of the company's efforts to integrate artificial intelligence into its devices. Media reports have said Apple will also unveil a slimmer version of its latest iPhone, possibly branded as the iPhone Air, echoing its iPad Air and MacBook Air lines. The company is also expected to showcase new entry-level, high-end Apple Watches, upgraded iPad Pros and a faster version of the Vision Pro headset, Bloomberg News has reported recently.\", 'url': 'https://finnhub.io/api/news?id=2f9081e1f78dab4b8fd7ca3a839bced221a1007faee91a43904a3dc0b3927604'}, {'category': 'company', 'datetime': 1756224300, 'headline': 'Apple is holding its iPhone 17 event on September 9', 'id': 136529957, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Along with the iPhones, Apple will likely have updated the Apple Watch Series 11, Ultra 3, and SE 3. The Apple Watch Ultra 3 would be a notable update amid the trio, with a bigger screen and faster charging support.', 'url': 'https://finnhub.io/api/news?id=798c01eeaa99f2a20a2b540332738653ac0ab5e56bb56102f362eb33fba1f0b2'}, {'category': 'company', 'datetime': 1756222621, 'headline': \"GM's $1 billion bet on F1 rolls on with star driver pairing for Cadillac team\", 'id': 136526543, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'GM’s Cadillac F1 team unveiled its driver pairing for the 2026 season, when the Big Three automaker’s big bet on F1 begins.', 'url': 'https://finnhub.io/api/news?id=d5dadf0c2d424b03eb856d6fd5771083fd61b82952d49619bf7ac66d82ee49d5'}, {'category': 'company', 'datetime': 1756221211, 'headline': 'Attorneys general tell AI companies to protect kids', 'id': 136529944, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Attorneys general in a letter highlighted Meta's scandal over its recent AI chatbot policies allowing romantic conversations with minors\", 'url': 'https://finnhub.io/api/news?id=c80eac904cb211ce08b917cdbdb49c14b6e9716c160c11c91f1134b00dd02cf7'}, {'category': 'company', 'datetime': 1756220400, 'headline': '2 High-Conviction Picks For 7.73% Growth And 4.22% Yield Within A Dividend Portfolio', 'id': 136529227, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2188450078/image_2188450078.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"Through DPSTF and META, we increased Dividend Income Accelerator Portfolio's sector diversification and global exposure. Learn more about the portfolio here.\", 'url': 'https://finnhub.io/api/news?id=3452d5cd9b4cf8d4251a0ea48074df10fe22dad78a44764ff71b7843f2de36f2'}, {'category': 'company', 'datetime': 1756219920, 'headline': 'Apple has an AI problem — and a Google partnership could actually make things worse', 'id': 136541516, 'image': '', 'related': 'AAPL', 'source': 'MarketWatch', 'summary': 'Apple has an AI problem — and a Google partnership could actually make things worse', 'url': 'https://finnhub.io/api/news?id=872986dd4f00566feaa310ee2fa0ab6a465476060222213ade9a930c4715aea1'}, {'category': 'company', 'datetime': 1756219440, 'headline': 'The Zacks Analyst Blog Highlights Alphabet, Apple and Garmin', 'id': 136529960, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Alphabet expands its Pixel lineup with new smartphones, watches, and earbuds, but faces fierce competition from Apple's AI push and Garmin's health-focused wearables.\", 'url': 'https://finnhub.io/api/news?id=93db37c7152895bb7d2a2f3d8de26eb915baea8ac2eea26dc76b571b118beb92'}, {'category': 'company', 'datetime': 1756218652, 'headline': 'Trump vs. Lisa Cook and what it really means for the stock market: Opening Bid top takeaway', 'id': 136525458, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The battle is well underway.', 'url': 'https://finnhub.io/api/news?id=6db1fb4523672e793b334b0953a0e3e17809d60f1522dc0a42d6ec9943d2cf40'}, {'category': 'company', 'datetime': 1756218587, 'headline': \"'Sexualized' AI Chatbots Pose Threat to Kids, Warn Attorneys General in Letter\", 'id': 136529961, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'A coalition of 44 state attorneys general have written to 13 AI firms demanding they protect children from sexually suggestive chatbot content.', 'url': 'https://finnhub.io/api/news?id=beae4eff89cbbac582eebe5b2a564df1ab0402115fab0f6ec44b4adcd3948cb6'}, {'category': 'company', 'datetime': 1756217611, 'headline': 'Apple internally discussed buying Mistral, Perplexity, the Information reports', 'id': 136529962, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple has trailed rivals such as Alphabet's Google and Samsung in terms of roll-out of AI features in its devices. CEO Tim Cook signaled last month that Apple was open to larger AI-related acquisitions to accelerate its roadmap, a shift from its historically conservative M&A posture. Perplexity, which is backed by Nvidia and Amazon founder Jeff Bezos, said it is unaware of any merger conversations including the company, aside from its own acquisitions.\", 'url': 'https://finnhub.io/api/news?id=9238d3913f4ea061860ef4435dc0e5662ad535c650c489b04e155b56238db7e5'}, {'category': 'company', 'datetime': 1756217332, 'headline': \"Apple To Invest $2.5 Billion For This Company's Glass, Making Its Shares Jump\", 'id': 136525500, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'This fiber-optics stock is in a buy zone after a positive earnings report. Shares are up 40% so far this year.', 'url': 'https://finnhub.io/api/news?id=ff60a2ae2dd68824095f1deab9962e8de096976d954b3edb4561105d00e430c6'}, {'category': 'company', 'datetime': 1756216626, 'headline': 'Only 19 Companies Have More Money Than Elon Musk — Which Are Worth Investing In?', 'id': 136525463, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'These 19 companies top Elon Musk in wealth. See which ones could be solid picks for your investment portfolio.', 'url': 'https://finnhub.io/api/news?id=4905c4e94e17d8585183949d95e9c37c7ddbc86c60581365e44ab2c72bd56384'}, {'category': 'company', 'datetime': 1756216248, 'headline': 'Trump vows retaliation against countries with digital rules targeting US tech', 'id': 136525502, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Trump administration has long held the EU’s tech regulations in contempt.', 'url': 'https://finnhub.io/api/news?id=486e26a45bbbc11a274fd4612cdc325097aa3e314abca130893d90e6cf31b151'}, {'category': 'company', 'datetime': 1756206060, 'headline': 'Apple’s August Stock Revival Gives Hope to Concerned Investors', 'id': 136524134, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Shares of the tech giant entered August down 17% for the year due in part to concerns about the impact of President Donald Trump’s sweeping levies, which cost the company $800 million in its fiscal third quarter alone. The US president has long criticized Apple for its reliance on overseas production partners, at one point even threatening to punish the company with tariffs if it didn’t make its iPhones in the US. Then, at an event in the Oval Office on Aug. 6, Apple Chief Executive Officer Tim Cook committed to spending an additional $100 billion on manufacturing in the US.', 'url': 'https://finnhub.io/api/news?id=d4af929538b268228162d9bd3115adb945972a5278888c20ddcf0732ece89dc8'}, {'category': 'company', 'datetime': 1756215276, 'headline': \"Is the tide turning on the AI boom's myth of destiny?\", 'id': 136525465, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'For over a year, AI was gospel. Now, Wall Street, Silicon Valley, and regulators are asking the same question: What if it’s not?', 'url': 'https://finnhub.io/api/news?id=c93c2e83ece71b1b0d6f6ea8daae7246a98738e2c7aad1a53853d61b079ea23b'}, {'category': 'company', 'datetime': 1756215114, 'headline': 'Apple: Breakdown Of $600B Investment Commitment (Rating Downgrade)', 'id': 136527045, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1705316992/image_1705316992.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"Apple's $600B US investment bolsters supply chain resilience, AI growth, and govt ties, minimizing risks.\", 'url': 'https://finnhub.io/api/news?id=001db74a945b3e627a70dce9199b32d4b815fdf4e9e58c7354aa60e4eb00f8ef'}, {'category': 'company', 'datetime': 1752586675, 'headline': 'S&P 500 stocks: List of additions and removals in 2025', 'id': 135946875, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'These stocks have been added or removed from the S&P 500 this year.', 'url': 'https://finnhub.io/api/news?id=c82b8aa916b7627eff6a48b9619bcb02464992951170719c78e81c3c1e3cd758'}, {'category': 'company', 'datetime': 1756214040, 'headline': 'Trump Takes Aim at Digital Taxes. What It Means for Tech Stocks.', 'id': 136525506, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Digital taxes largely hit U.S. firms such as Google-parent Alphabet, retailer Amazon, and Facebook-parent Meta.', 'url': 'https://finnhub.io/api/news?id=75278f14b5dfe4ab92541fb57c79de69ac9768b17c951ff637fe0d3865c3e459'}, {'category': 'company', 'datetime': 1756213680, 'headline': 'Atomic Data Expands Leadership Team', 'id': 136525507, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Additions Will Accelerate Growth Across Three Operating CompaniesMINNEAPOLIS, Aug. 26, 2025 (GLOBE NEWSWIRE) -- Atomic Data, a leading IT services provider and technology teammate, has announced two key leadership appointments that reinforce its long-term strategic vision and strengthen its shared services operating model. Jay Bozicevich, a three-decade veteran of the financial services industry, will step into the dual roles of President of Atomic Data and Chief Operating Officer of Shared', 'url': 'https://finnhub.io/api/news?id=cf6f397f00502ab95b260e3bef757f58fa106e5105c39e77df9b8e0bd803d1ee'}, {'category': 'company', 'datetime': 1756213200, 'headline': 'Level Launches Level Lock Pro: The Ultimate Blend of Design, Performance, and Security', 'id': 136525508, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'REDWOOD CITY, Calif., August 26, 2025--Level, the company that redefined smart home today introduces Level Lock Pro, the ultimate in smart home performance, security and design. Level Lock Pro provides enhanced performance, security, and features such as door status detection to show when a door is left open, all while retaining the same award-winning invisible design Level is known for. There has never before been a smart lock that packs so much technology in the footprint of a traditional dead', 'url': 'https://finnhub.io/api/news?id=ba6aaa945fdf72d7b0ff6ec45454b30944831abf27e68bd11de8db5b8c1fa58e'}, {'category': 'company', 'datetime': 1756212744, 'headline': 'Apple Loses German Case On Green Marketing Pledge', 'id': 136525509, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple Watch can't be advertised as CO?-neutral, court rules\", 'url': 'https://finnhub.io/api/news?id=2ce75c880408058d8a276d83753fe01903ac146b8c6b12ab0e798d1b2418f5b2'}, {'category': 'company', 'datetime': 1756212272, 'headline': 'EU Defends Digital Taxes After Trump Calls Them Unfair on US', 'id': 136525510, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': '“It’s the sovereign right of the EU and its member states to regulate our economic activities on our territory that are consistent with our democratic values,” European Commission Spokeswoman Paula Pinho told reporters Tuesday in Brussels. Without specifying any government, Trump threatened export restrictions on US advanced technology and semiconductors and higher tariffs in retaliation for nations’ digital services taxes that hit American companies.', 'url': 'https://finnhub.io/api/news?id=7de834c2295cd83ee6630cf06bc371f15816a768702ce246a190d1133a4baa23'}, {'category': 'company', 'datetime': 1756212208, 'headline': 'Latest News In Cloud AI - Aurasell Transforms CRM Landscape With AI-Native Platform Launch', 'id': 136525493, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Aurasell has launched as the world's first AI-native CRM platform, introducing a significant shift in the landscape of cloud-based business software. The platform integrates a comprehensive suite of tools into a single system, aiming to eliminate the inefficiencies and high costs associated with traditional, fragmented CRM and go-to-market (GTM) systems. By leveraging AI, Aurasell provides enhanced automation and data unification, which can streamline operations from prospecting to contract...\", 'url': 'https://finnhub.io/api/news?id=207ea8323e1b58d3848a4374d82364443f6b0455e6408f0507c116e10ddbf39c'}, {'category': 'company', 'datetime': 1756211520, 'headline': 'AI Powers AR: Spotselfie Debuts Real-World Ad Marketplace for Brands & Creators', 'id': 136525512, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Spotselfie®, the self-funded AR real-world social metaverse with 16 issued patents, is rolling out its next-generation platform. This AI-powered creator marketplace lets brands and independent creators place GPS-anchored brand experiences in the real world. Built for mobile AR and the next wave of XR smart glasses, it opens new income streams for creators and delivers brands unmatched local targeting.', 'url': 'https://finnhub.io/api/news?id=90be422c09d26a51591bdec839617db7929d82f81f97ba77a05df28e656398a3'}, {'category': 'company', 'datetime': 1756210560, 'headline': 'Boring Is Better Than Amazon, Apple, and Alphabet. These 3 Stocks Prove It.', 'id': 136525495, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Torsten Sløk, the chief economist at Apollo Global Management, says some big tech stocks are being outdone by what might be considered ho-hum names.', 'url': 'https://finnhub.io/api/news?id=91abe67ba7809fa434c3ca366e8a93ff76cea29a866a1272fd1007da924b21f8'}, {'category': 'company', 'datetime': 1756206900, 'headline': 'Tech, Media & Telecom Roundup: Market Talk', 'id': 136525514, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Find insight on Samsung SDI, Cambricon Technologies, Nvidia and more in the latest Market Talks covering technology, media and telecom.', 'url': 'https://finnhub.io/api/news?id=6f3c57dee3ef235b9c03327c1368efb31c146d3c0770094cd015d9072c9ee71b'}, {'category': 'company', 'datetime': 1756204680, 'headline': 'Exploring Trends Across Asset Classes, Mega-Caps, And Banks', 'id': 136525746, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1308271745/image_1308271745.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"Equities have stalled out in the last half of August as a buyer's strike ahead of the seasonally weak month of September takes hold. Click to read.\", 'url': 'https://finnhub.io/api/news?id=e261ed2b3678ac77557c1b354cdc074ed03a8137a6ce9fe9d83108f769ba1221'}, {'category': 'company', 'datetime': 1756204200, 'headline': 'Trump Fires Another Shot at the Fed. The Economy Could Be Collateral Damage.', 'id': 136525515, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Trade deals are still in flux, Musk sues Apple, OpenAI, Intel’s deal with U.S. comes with a catch, and more news to start your day.', 'url': 'https://finnhub.io/api/news?id=feea0a87baf07a24584e4e8b8248a325a74996a515c6f040e4bcbf11919f7830'}, {'category': 'company', 'datetime': 1756202400, 'headline': 'Apple-Google Likely Tie-Up for Siri Revamp Puts These ETFs in Focus', 'id': 136523788, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple and Google's AI talks lift both stocks, putting ETFs like IYW, FTEC, FCOM and VOX, with heavy exposure to the tech giants, in focus.\", 'url': 'https://finnhub.io/api/news?id=94c168d3e743b209b245da5b32ecc7207d844937d4d278cf72a515e5a0057625'}, {'category': 'company', 'datetime': 1756202400, 'headline': 'Circular Economy Market to Soar from $149.86 Billion in 2024 to $355.44 Billion by 2032, Driven by ESG Adoption and Recycling Innovation | Report by DataM Intelligence', 'id': 136523787, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'According to research report published by DataM Intelligence, \"The Circular Economy Market Size valued US$149.86 billion in 2024, is projected to reach US$355.44 billion by 2032, expanding at a robust CAGR of 11.40% from 2025 to 2032.\" Global concerns over waste management and resource scarcity are significantly driving the circular economy market, as nations and industries face the dual challenge of rising waste volumes and depleting raw materials.', 'url': 'https://finnhub.io/api/news?id=7ae834401cec373cbbebc6770403f421198ff3a98febd8a0a916ffaf4027c8bb'}, {'category': 'company', 'datetime': 1756202329, 'headline': \"Apple Watch not a 'CO2-neutral product,' German court finds\", 'id': 136523789, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'BERLIN (Reuters) -Apple can no longer advertise its Apple Watch as a \"CO2-neutral product\" in Germany, following a court ruling on Tuesday that upheld a complaint from environmentalists, finding that the U.S. tech company had misled consumers. Apple had promoted the device online as \"our first CO2-neutral product,\" a claim found by a panel of judges to be unfounded and in violation of German competition law, according to a statement from a regional court in Frankfurt. An Apple spokesperson said the court ruling \"broadly upheld our rigorous approach to carbon neutrality\" and declined to comment on whether the company would appeal Tuesday\\'s ruling.', 'url': 'https://finnhub.io/api/news?id=6bba43b58fbaa3325141222ddf982d019366b4f7af671d3278bcea9d588d4ec3'}, {'category': 'company', 'datetime': 1756199205, 'headline': 'Elon Musk’s xAI files lawsuit against Apple and OpenAI', 'id': 136523790, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The lawsuit alleges Apple's ChatGPT integration sidelines rival apps such as xAI's Grok in App Store rankings.\", 'url': 'https://finnhub.io/api/news?id=d4ee4300cb2fbdea35e2495786189edac83b6f9f477ab491f5251d1a371f90e6'}, {'category': 'company', 'datetime': 1756198863, 'headline': \"Elon Musk Sues Apple, OpenAI Over iPhone AI 'Monopoly'\", 'id': 136523791, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The lawsuit claims Apple and OpenAI's exclusive iPhone AI deal locks out rivals from 80% of the chatbot market.\", 'url': 'https://finnhub.io/api/news?id=eb6c93280471945b15f63b8433082dc950ee64a93ed4fedc248ad5d566b1c58b'}, {'category': 'company', 'datetime': 1756198800, 'headline': 'Labour accused of abandoning UK tech in AI push', 'id': 136523771, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Labour has been accused of abandoning British tech firms despite Sir Keir Starmer’s pledge to transform the country into an artificial intelligence (AI) powerhouse.', 'url': 'https://finnhub.io/api/news?id=afa0535831fcd97266559a9d37f57a658c3075f6d66955f03b2c79cb1ff64bb0'}, {'category': 'company', 'datetime': 1756198015, 'headline': 'Trump threatens tariffs on nations imposing digital taxes on US tech', 'id': 136523778, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The president said the taxes against US firms “give a complete pass to China’s largest tech companies”.View on euronews', 'url': 'https://finnhub.io/api/news?id=b776efdb64af47c5fe1e927b709c73cbe5c9c0d14ced2ac5e16a21f1476bbb8e'}, {'category': 'company', 'datetime': 1756197600, 'headline': \"Prediction: 2 Stocks That'll Be Worth More Than Berkshire Hathaway 5 Years From Now\", 'id': 136523779, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'These two megacap stocks have Berkshire Hathaway in their sights.', 'url': 'https://finnhub.io/api/news?id=f33417a3a5a437980a5180f2bf5f6287f63409452b581252b1955fcea7108cbc'}, {'category': 'company', 'datetime': 1756195620, 'headline': 'Wall Street Breakfast Podcast: Trump Fires Cook,\\xa0Threatens More Tariffs', 'id': 136524231, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1717444876/image_1717444876.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Trump fires Fed Governor Cook,Â\\xa0threatens more tariffs, andÂ\\xa0Hassett on Fed chair nominee.', 'url': 'https://finnhub.io/api/news?id=dfb538777ae981067d19edc7864c752efabdf58a28713289109d61c75297a09b'}, {'category': 'company', 'datetime': 1756193878, 'headline': 'Heard on the Street Monday Recap: Trump’s New Deal', 'id': 136523795, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'President Trump said he wants to pursue more deals like the government’s equity investment in Intel. The U.S. converted funds previously allocated for manufacturing expansion into a 9.9% stake in the chip maker. The government also obtained a five-year warrant, under which it could receive an additional 5% if Intel spins out or sells off its manufacturing operations.', 'url': 'https://finnhub.io/api/news?id=31535f8995229bc9f0c38c870b6e861a6d0c18dd7d1ea1cab9a0c56060fb920e'}, {'category': 'company', 'datetime': 1756192028, 'headline': \"Elon Musk's xAI sues Apple, OpenAI over competition claims\", 'id': 136523796, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'STORY: Elon Musk’s xAI is suing Apple and OpenAI over claims they conspired to thwart rivals on artificial intelligence.The suit was filed in a Texas court on Monday (August 26).It says the pair “locked up markets to maintain their monopolies” after Apple integrated OpenAI’s ChatGPT into its products.The suit says the partnership led the iPhone maker to promote ChatGPT in its app store, while limiting prominence for Musk’s competing chatbot Grok.In a social media post, Musk said “a million reviews with 4.9 average for Grok and still Apple refuses to mention Grok on any lists”.Apple didn’t respond to a request for comment on the suit.While OpenAI said the case was consistent with what it called Musk’s “ongoing pattern of harassment”.Some legal experts said Apple’s dominant position in the smartphone market could bolster xAI’s allegation that it was suppressing competition.But Ohio State University law professor Amy Schmitz cast doubt on some of Musk’s claims:“The fact remains that Grok is in the app store and it has ranked highly in some months. In fact, one report I looked at had it ranked at, I think, number one on the App Store in February of 2025, which shows that there is competition, right?”Musk cofounded OpenAI with Sam Altman in 2015.Its ChatGPT bot would later become the fastest-growing consumer application in history.But the pair fell out, and Musk went on to found the rival xAI.In a separate case, he’s suing the ChatGPT maker over its plan to convert from a nonprofit to a for-profit entity.', 'url': 'https://finnhub.io/api/news?id=20e1a5980ae6bfeaa51588fb7adf04a8a77455ce6b836af5680092325a6affbf'}, {'category': 'company', 'datetime': 1756191720, 'headline': 'Prediction: This Unstoppable Stock Will Join Nvidia, Microsoft, and Apple in the $3 Trillion Club Before 2028', 'id': 136523782, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Multiple avenues for growth will help this tech stalwart ascend to new heights.', 'url': 'https://finnhub.io/api/news?id=0a902a286165aa31474fa39cd6d738bff751ff0a50ada011825d386ccd1e8ec8'}, {'category': 'company', 'datetime': 1756184435, 'headline': 'How to close the menopause pay gap', 'id': 136523798, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Women experience an average 10% reduction in earnings by the fourth year following a menopause diagnosis.', 'url': 'https://finnhub.io/api/news?id=4a9e22064b284c05ab6ed13378a663bd282d07b3a51b0d5867a7b0d0b20b906d'}, {'category': 'company', 'datetime': 1756181665, 'headline': 'Trump vows retaliation against countries proposing digital taxes or regulation on American tech giants', 'id': 136523799, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The President seeks to curb rules taking aim at U.S. tech conglomerates', 'url': 'https://finnhub.io/api/news?id=ce623059cb32952ee4c09957bbb8fecad99152bf240a69a20402253669f856ee'}, {'category': 'company', 'datetime': 1756180826, 'headline': 'The $5.5bn cup of coffee', 'id': 136523800, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'One thing to start: Elon Musk’s xAI has sued Apple and OpenAI alleging they broke antitrust rules by thwarting competition in artificial intelligence...', 'url': 'https://finnhub.io/api/news?id=b784bf1bbf51f2a7ae66430e9a9fe87f284667b812b7af3558f0ad86558cc92e'}, {'category': 'company', 'datetime': 1756171860, 'headline': 'Phinge®, Home of Netverse® and Netaverse™ With Verified and Safer AI Announces \"Test the Waters\" Campaign for Potential Regulation A+ Offering', 'id': 136523801, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Phinge Corporation today announced its intention to gauge market interest for a potential Regulation A+ offering, referred to as \"testing the waters\" under SEC Rule 255.', 'url': 'https://finnhub.io/api/news?id=23effc0ec59ab92a7532012a0b3ec4f1493fc83f940cb4d7bdc783cc24d844ee'}, {'category': 'company', 'datetime': 1756168269, 'headline': \"Jeff Bezos Said He Would Have 'Felt Icky' Had He Taken Any More Shares Of Amazon: 'I Just Didn't Feel Good...'\", 'id': 136523802, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Jeff Bezos once revealed in an interview that he never needed more stock to stay motivated at Amazon.com and that asking for it would have felt \"icky.\" Jeff Bezos Was ‘Proud’ Of His Compensation Package At Amazon In a 2024 interview at The New York ...', 'url': 'https://finnhub.io/api/news?id=93c751516e3666864e8c2e9ae96f5d91f74e81629b54bd48d507cb0dc4368d85'}, {'category': 'company', 'datetime': 1756154463, 'headline': \"Elon Musk's xAI sues Apple and OpenAI over AI competition\", 'id': 136523803, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Elon Musk\\'s xAI seeks billions in damages from Apple and OpenAI for allegedly “perpetrating their anticompetitive scheme\"', 'url': 'https://finnhub.io/api/news?id=81d1ba51ee5956233684563e8c4b5b066a6bc8955c78796b911b419a6633806f'}, {'category': 'company', 'datetime': 1756153867, 'headline': 'Stock Market Today: Dow Drops, Apple Firm Despite Musk Threat; Cathie Wood Loads Up On This Stock (Live Coverage)', 'id': 136522222, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Dow fell as Nvidia shined on the stock market today. Apple held up despite an Elon Musk AI move. Cathie Wood bought a diving stock.', 'url': 'https://finnhub.io/api/news?id=741cc617526e6af9d4f9f3bc5a38ad75e609a0e15933233540034f15031a65bc'}, {'category': 'company', 'datetime': 1756153307, 'headline': \"Elon Musk's X & xAI sue Apple & Open AI: What happens next?\", 'id': 136522261, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"X (formerly Twitter) and xAI (XAAI.PVT), owned by Tesla (TSLA) CEO Elon Musk, are suing Apple (AAPL) and OpenAI (OPAI.PVT). Musk's companies allege that Apple and OpenAI's partnership is anti-competitive and that the government should intervene due to antitrust laws. Yahoo Finance Senior Legal Reporter Alexis Keenan outlines the details of the suit. To watch more expert insights and analysis on the latest market action, check out more Market Domination.\", 'url': 'https://finnhub.io/api/news?id=7da38784a0869068ff9d0cb848412665a7729714621f73e14ae7b1b5bc3e5f30'}, {'category': 'company', 'datetime': 1756153296, 'headline': 'Why Apple Stock Could Sell Off After iPhone 17 Reveal', 'id': 136522262, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple stock could sell off after the company announces its iPhone 17 series smartphones next month, a Wall Street analyst said Monday.', 'url': 'https://finnhub.io/api/news?id=33011ae688343f7c45f9f05da64def83f3063e2686e7fa2da5d99883b981b78c'}, {'category': 'company', 'datetime': 1756152841, 'headline': \"Apple's Biggest iPhone Overhaul in a Decade Could Redefine the Stock's Next Growth Cycle\", 'id': 136522263, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Three years, three redesigns, foldables, AI-powered Siri, and a $100B services pivot -- Apple's next chapter begins.\", 'url': 'https://finnhub.io/api/news?id=554f3fddfdd67d0566bf7df68d092df224df5b41f44680af01e3a839730d68e8'}, {'category': 'company', 'datetime': 1756151760, 'headline': 'Apple no longer innovates — it waits. And with AI, anyone playing it safe will get left behind.', 'id': 136541521, 'image': '', 'related': 'AAPL', 'source': 'MarketWatch', 'summary': 'Apple no longer innovates — it waits. And with AI, anyone playing it safe will get left behind.', 'url': 'https://finnhub.io/api/news?id=272058be85f6596bdceae844d391faf2a80d7f1e1321f59ab01ab25b65b1400a'}, {'category': 'company', 'datetime': 1756151544, 'headline': 'Sector Update: Tech Stocks Mixed in Late Afternoon Trading', 'id': 136522229, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Tech stocks were mixed late Monday afternoon, with the Technology Select Sector SPDR Fund (XLK) frac', 'url': 'https://finnhub.io/api/news?id=2c0bfc5d0dd6af1cab926d1fd2505d8d19703009bdda35aef17ff2936d1bda65'}, {'category': 'company', 'datetime': 1756151528, 'headline': 'US Equity Indexes Mixed Amid Higher Treasury Yields, Dollar', 'id': 136522230, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'US equity indexes traded mixed heading into the close on Monday amid gains in both government bond y', 'url': 'https://finnhub.io/api/news?id=c702f097666c85b6e3990aac44ae65118eeb133cd08498eefa5f99174f46f849'}, {'category': 'company', 'datetime': 1756150843, 'headline': \"Inside Elon Musk's suit against Apple and OpenAI: 'This is a tale of two monopolists'\", 'id': 136522266, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Elon Musk followed through on Monday with a warning to sue Apple and OpenAI over their agreement to integrate OpenAI’s chatbot into Apple’s operating systems and prioritize the chatbot in its app store.', 'url': 'https://finnhub.io/api/news?id=bbb6426526db4acbd3ad432e567665510f3ece060f0b6d8a4dd0f3a7036d3ace'}, {'category': 'company', 'datetime': 1756147860, 'headline': 'Elon Musk’s xAI Sues Apple and OpenAI, Alleging They Are Monopolists', 'id': 136522267, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Musk said the partnership between the two companies has given the ChatGPT-maker access to “billions of user prompts.”', 'url': 'https://finnhub.io/api/news?id=c10d9f0635e4eb3fe91f2c5c05a1507f6a9aaeaf682671a9f0d6f767c60f9271'}, {'category': 'company', 'datetime': 1756147440, 'headline': 'Musk Sues OpenAI and Apple Over AI Access in App Store', 'id': 136522268, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'xAI filed suit against OpenAI and Apple, alleging anticompetitive behavior, according to a report from CNBC.', 'url': 'https://finnhub.io/api/news?id=3e8876dd844b1ac11ecfa0256361a8de7798d4d2629948be49edfbeeced54463'}, {'category': 'company', 'datetime': 1756146753, 'headline': 'Musk sues Apple and ChatGPT maker for ‘conspiring’ against him', 'id': 136522269, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Elon Musk has filed a lawsuit against Apple and ChatGPT maker OpenAI, accusing the companies of conspiring against his AI business.', 'url': 'https://finnhub.io/api/news?id=0dcf5c23d8b030b5e284a4fa60a5aabab4e2943880014f0b573c49c8fd96f2dc'}, {'category': 'company', 'datetime': 1756144729, 'headline': 'Elon Musk accuses Apple and OpenAI of stifling AI competition in antitrust lawsuit', 'id': 136522270, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Elon Musk on Monday targeted Apple and OpenAI in an antitrust lawsuit alleging that the iPhone maker and the ChatGPT maker are teaming up to thwart competition in artificial intelligence. The 61-page complaint filed in Texas federal court follows through on a threat that Musk made two weeks ago when he accused Apple of unfairly favoring OpenAI and ChatGPT in the iPhone's app store rankings for top AI apps. Musk's post insinuated that Apple had rigged the system against ChatGPT competitors such as the Grok chatbot made by his own xAI.\", 'url': 'https://finnhub.io/api/news?id=d53b55c1be0e7744d4bab3e799f1456ecca1191cdbe747fccc03753864f98cb9'}, {'category': 'company', 'datetime': 1756143185, 'headline': 'Sector Update: Tech Stocks Mixed Monday Afternoon', 'id': 136522248, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Tech stocks were mixed Monday afternoon, with the Technology Select Sector SPDR Fund (XLK) adding 0.', 'url': 'https://finnhub.io/api/news?id=4f72b52f62dbadbf3a017217986ed454470b3ce6dff0f140a7d02c16d36e871d'}, {'category': 'company', 'datetime': 1756143125, 'headline': 'US Equity Indexes Mixed as Nvidia Helps Lift Nasdaq Composite', 'id': 136522249, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'US equity indexes traded mixed after midday Monday, with the Nasdaq Composite eking out a gain amid', 'url': 'https://finnhub.io/api/news?id=97583c089a3ab8dbbfc9195508c38b6a74ebc23e472c43727b756eaa05a0dcf2'}, {'category': 'company', 'datetime': 1756143038, 'headline': 'Elon Musk’s xAI sues Apple and OpenAI, alleging anticompetitive collusion', 'id': 136522273, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'According to Musk, Apple and OpenAI are colluding to stifle competition from other AI companies.', 'url': 'https://finnhub.io/api/news?id=516a56dece05e72da77f994ec08b1f901e8a1a28c2f28f9a0c0b9412c42a8d70'}, {'category': 'company', 'datetime': 1756142987, 'headline': 'Elon Musk Sues Apple, OpenAI', 'id': 136522274, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Bloomberg\\'s Mark Gurman details the latest on Apple as Elon Musk files a lawsuit against the tech giant and OpenAI, accusing them of unfairly favoring OpenAI on its smartphones. He joins Caroline Hyde on \"Bloomberg Tech.\"', 'url': 'https://finnhub.io/api/news?id=071349467edabf0c07f743af2407158405cc21bc874e0e86ce02f4acd35995be'}, {'category': 'company', 'datetime': 1756141964, 'headline': \"Elon Musk sues Apple & OpenAI, Roblox rises, Alphabet's new high\", 'id': 136522275, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Yahoo Finance's John Hyland tracks Monday's top moving stocks and biggest market stories in this Market Minute: Tesla (TSLA) CEO and xAI (XAAI.PVT) founder Elon Musk suing Apple (AAPL) and OpenAI (OPAI.PVT), Roblox (RBLX) stock rallying, and Alphabet (GOOG, GOOGL) stock hitting a new record. Stay up to date on the latest market action, minute-by-minute, with Yahoo Finance's Market Minute.\", 'url': 'https://finnhub.io/api/news?id=cd37f083513a4b43ce601efcf627712b2ba7c6ced97d0b6ce53bb151c3b93deb'}, {'category': 'company', 'datetime': 1756141742, 'headline': \"Musk's X, xAI Sue Apple, OpenAI for Alleged 'Anticompetitive Scheme'\", 'id': 136522276, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Elon Musk\\'s companies X and xAI on Monday sued Apple and OpenAI in federal court, alleging they have engaged in an \"anticompetitive scheme\" that prevents competitors like xAI\\'s Grok from competing fairly and ascending the App Store charts.', 'url': 'https://finnhub.io/api/news?id=9e539309f995339b843e01c6ce1eb901aea061bde6652385aacec2c901748116'}, {'category': 'company', 'datetime': 1756140046, 'headline': \"Apple iPhone 17 Launch Could Trigger 'Sell The News' Reaction, Analyst Warns\", 'id': 136522277, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple Inc. (NASDAQ:AAPL) is gearing up for its next iPhone cycle with a September launch expected to spotlight a new ultra-thin iPhone 17 Air, but muted consumer buzz and restrained carrier promotions suggest the release may lack the blockbuster momentum of past product cycles. Bank of America Securities analyst Wamsi Mohan maintained a Buy rating on Apple (NASDAQ:AAPL) with a price forecast of $250. Mohan said expectations for Apple's next iPhone cycle remain modest despite reports suggesting a\", 'url': 'https://finnhub.io/api/news?id=e4ab774ba6dcf3899d4162abc2facb5d717884b38aef2e050ccb0da3ad3ab090'}, {'category': 'company', 'datetime': 1756139126, 'headline': 'American Eagle downgraded, Puma soars, Musk sues Apple & OpenAI', 'id': 136509512, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Market Catalysts host Allie Canal dives into what's driving interest in some of Monday's trending tickers on Yahoo Finance's platform, including American Eagle Outfitters (AEO), Puma (PUM.DE), Apple (AAPL), and OpenAI (OPAI.PVT). To watch more expert insights and analysis on the latest market action, check out more Market Catalysts.\", 'url': 'https://finnhub.io/api/news?id=624249acd2ebf5c12f5827252807b7ecb625e9f3357bbf43d1947fb2b2a2669d'}, {'category': 'company', 'datetime': 1756137739, 'headline': \"Musk's xAI sues Apple, OpenAI alleging antitrust violations\", 'id': 136522279, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Elon Musk's companies xAI and X filed a sweeping US antitrust lawsuit Monday against Apple and OpenAI, alleging the tech giants formed an illegal partnership to stifle competition in artificial intelligence and smartphone markets.The plaintiffs claim Apple holds 65 percent of the US smartphone market, while OpenAI controls at least 80 percent of the generative AI chatbot market through ChatGPT.\\nApple and OpenAI announced their partnership in June 2024, making ChatGPT the exclusive AI assistant a\", 'url': 'https://finnhub.io/api/news?id=4995a61d78bd0b891e214d004f7d3c718694b4b41939294746f2667f1e98297d'}, {'category': 'company', 'datetime': 1756129771, 'headline': 'Stock Market Today: Dow Falls Ahead Of Nvidia Earnings, Inflation Data; Palantir Sells Off (Live Coverage)', 'id': 136507733, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Dow Jones index falls Monday ahead of Nvidia earnings and key inflation data. Palantir stock drops.', 'url': 'https://finnhub.io/api/news?id=683641b210c1124848bd7d6581630691a3455bdce5b964676579ed0e2d8aa9bc'}, {'category': 'company', 'datetime': 1756127340, 'headline': 'Apple Plans Foldable, Curved-Glass iPhones: Report. What It Means for the Stock.', 'id': 136507777, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The shares are in a slump as investors wait to see how the company integrates artificial intelligence with its flagship product.', 'url': 'https://finnhub.io/api/news?id=928c434fc143e6e69f0e54225b9c755fc9080278e8da14fe7586966936d419b5'}, {'category': 'company', 'datetime': 1756121820, 'headline': 'What Is the Highest Apple Stock Has Ever Been?', 'id': 136507778, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple's all-time high was reached in late 2024, and it is well below this level today.\", 'url': 'https://finnhub.io/api/news?id=9a00ef0f43eb87671050f652a9f1dd0f502d8732e636adc1a6e6f870b57c1713'}, {'category': 'company', 'datetime': 1755870060, 'headline': 'Suze Orman reveals her favorite stock right now and the investing mistake that shaped her strategy', 'id': 136487722, 'image': '', 'related': 'AAPL', 'source': 'MarketWatch', 'summary': 'Suze Orman reveals her favorite stock right now and the investing mistake that shaped her strategy', 'url': 'https://finnhub.io/api/news?id=03c9e876a9f29d950a1dfa70089118437b7e02856f9547f278c249c14c0797fb'}, {'category': 'company', 'datetime': 1756116566, 'headline': 'Could Apple’s (AAPL) Airline Move Reveal a New Approach to Audience Growth?', 'id': 136507780, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"In August 2025, United Airlines announced that full seasons of select Apple TV+ original series, including Severance and Ted Lasso, are now available for free on over 130,000 seatback screens and in the United app, significantly expanding the airline's inflight entertainment content. This partnership could boost awareness and trial of Apple TV+ among United travelers, broadening Apple’s services reach beyond traditional streaming audiences. We'll explore how Berkshire Hathaway’s sizable...\", 'url': 'https://finnhub.io/api/news?id=8d1ec568e2355141d78aad1cadc0dc78a7410789f281182fa35436398a4f81cf'}, {'category': 'company', 'datetime': 1756114020, 'headline': \"If You'd Invested $1,000 in SoFi Technologies (SOFI) Stock 3 Years Ago, Here's How Much You'd Have Today. (Spoiler: Wow.)\", 'id': 136507781, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Spoiler: You'd have a lot.\", 'url': 'https://finnhub.io/api/news?id=cc372f93fc694e46f10bb1bfac7534e774ec28014abef59053ca2fdc87cd1e9d'}, {'category': 'company', 'datetime': 1756111500, 'headline': 'IBM: The Retracement An Opportunity As IBM Has Transformed Its Business', 'id': 136507588, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1445810162/image_1445810162.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"IBM's focus on hybrid cloud, AI, and innovation boosts growth potential. Discover why its undervalued shares offer income & capital appreciation.\", 'url': 'https://finnhub.io/api/news?id=bd07496ca6f4bf66e1a45fb96943d6eda47f5938fe184effb5ca3bd4c30d1ad1'}, {'category': 'company', 'datetime': 1756109296, 'headline': 'BDJ: This Fund Provides Diversification Benefits Along With A High Yield (Rating Downgrade)', 'id': 136507375, 'image': '', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': '', 'url': 'https://finnhub.io/api/news?id=638320c4013e8c18f47c802a7de2f3e0726a7af7dac1e8eae884dee0a4d4eeb2'}, {'category': 'company', 'datetime': 1756102306, 'headline': \"Apple: The Future Is Bright, But That Doesn't Mean To Buy\", 'id': 136507010, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2203575435/image_2203575435.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Apple shows robust growth and strong margins, driven by its services segment, but a high valuation tempers buy potential.', 'url': 'https://finnhub.io/api/news?id=31f874ee1dcdd39caf82979740b96b0578f9ab14109c20d15d7c1274b63c0b12'}, {'category': 'company', 'datetime': 1756088516, 'headline': 'ETV: Decent Price Right Now, But Not As Diversified As I Would Like', 'id': 136506262, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2153687482/image_2153687482.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"ETV's strategy relies on writing index options, but its heavy technology weighting reduces diversification. Read why ETV CEF is a Hold.\", 'url': 'https://finnhub.io/api/news?id=e609d8759451296d6349d17fdd99438fa94156eeb9a23a86f2d0e912ae4441a0'}, {'category': 'company', 'datetime': 1756083600, 'headline': 'Tech Rally Shows Signs of Losing Steam', 'id': 136507772, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Nvidia and other stocks in the Magnificent Seven have been buffeted recently by growing doubts about their valuations and the potential of artificial intelligence.', 'url': 'https://finnhub.io/api/news?id=0f8fa3e29ac4bd95c89354949c4161a2d35db2381f83831109a9b2f473e5024f'}, {'category': 'company', 'datetime': 1756077120, 'headline': 'Prediction: All \"Ten Titans\" Stocks Will Surpass $1 Trillion in Market Cap by 2030', 'id': 136507773, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Ten Titans already make up 38% of the S&P 500, but their share could grow if companies keep delivering on investor expectations.', 'url': 'https://finnhub.io/api/news?id=21506a32bd26bd2e8cb299d0693e1834738da72b97c33b4ccc8a045bbd406e21'}, {'category': 'company', 'datetime': 1756072815, 'headline': 'If you bought Bitcoin instead of every new iPhone, you’d have $250M', 'id': 136507784, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Bitcoin or iPhone, which investment would have paid more?', 'url': 'https://finnhub.io/api/news?id=2219010c26b8b851571c82f93c92505738ad14bc5c10403441a6544a640d2cd3'}, {'category': 'company', 'datetime': 1756066081, 'headline': 'Tracking Renaissance Technologies (RenTec) 13F Portfolio - Q2 2025 Update', 'id': 136504690, 'image': '', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': '', 'url': 'https://finnhub.io/api/news?id=5af03a9d2830ba72b2e198c9657b545ae8d7d8941028d9d6e3cde20a2dffefca'}, {'category': 'company', 'datetime': 1756065569, 'headline': 'Netflix’s ‘KPop Demon Hunters’ is probably the biggest movie in theaters', 'id': 136507785, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"This is Netflix's first time winning the domestic box office.\", 'url': 'https://finnhub.io/api/news?id=390d947eadec7e91d89abc8db8b332bcd287771bd8582c26f09c9b33d5e1ad3a'}, {'category': 'company', 'datetime': 1756058400, 'headline': \"Prediction: These 2 Trillion-Dollar Artificial Intelligence (AI) Stocks Could Strike a Megadeal That Wall Street Isn't Ready For\", 'id': 136502572, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Most of the \"Magnificent Seven\" companies have built and scaled legitimate artificial intelligence (AI) platforms, but two outliers in big tech remain.', 'url': 'https://finnhub.io/api/news?id=4aa61de7969df2e537fcbf75911a5d0975ee96cf94d45ea916556d38a6a8a54d'}, {'category': 'company', 'datetime': 1756051200, 'headline': 'Chinese backer of UK tech takeover accused of military ties', 'id': 136502573, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'A Chinese tech giant funding the takeover of a British semiconductor company has been accused of links to the country’s military.', 'url': 'https://finnhub.io/api/news?id=3b55f1aa895d7b89e582f60248f0424a158bb4d34316de66b42018335c7ae2bc'}, {'category': 'company', 'datetime': 1756047600, 'headline': 'The \"Ten Titans\" Stocks Now Make Up 38% of the S&P 500. Here\\'s What It Means for Your Investment Portfolio', 'id': 136502531, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Massive growth stocks are driving the performance of the S&P 500, for better or for worse.', 'url': 'https://finnhub.io/api/news?id=0beed2ea303bafdbcdee6489b172454ab0df5c2c868733b172d80693a4b795d7'}, {'category': 'company', 'datetime': 1756041990, 'headline': 'The Best Ways To Use the Apple Stocks App To Build Your Best Portfolio', 'id': 136502575, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Discover how Apple’s built-in Stocks app can help investing beginners track funds, set alerts and grow their investing skills.', 'url': 'https://finnhub.io/api/news?id=5ca7e4d33ae50bc068d77ba9e3f590dcd3ec53763ff7a803fc9da8abb40fc20c'}, {'category': 'company', 'datetime': 1756034640, 'headline': \"Here's How Many Shares of Apple Stock You'd Need for $10,000 in Yearly Dividends\", 'id': 136502576, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'This powerful consumer brand has found remarkable success because of its ongoing focus on innovation.', 'url': 'https://finnhub.io/api/news?id=b8be2c8adfc45a2581f853334d822802bab801a5392766dc7210bc22fd02c7a9'}, {'category': 'company', 'datetime': 1756033110, 'headline': 'Nvidia will deliver key earnings report this week', 'id': 136502538, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Check out the stocks that propelled last week's huge Dow rally.\", 'url': 'https://finnhub.io/api/news?id=7b86059d86ff84352acd6fae86a8258b87a44dd3f1d25102d65586b83cc7a8d5'}, {'category': 'company', 'datetime': 1756032600, 'headline': 'Why Is Warren Buffett Dumping Apple Stock Right Now?', 'id': 136502578, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Berkshire Hathaway has been rapidly reducing its Apple stock holdings. What's going on?\", 'url': 'https://finnhub.io/api/news?id=73ff48685f460de5f73fe6ecf015179bc929e73c78a4bed4aefadbf48985bb15'}, {'category': 'company', 'datetime': 1756028040, 'headline': 'Best Stock to Buy Right Now: Apple vs. Microsoft', 'id': 136502563, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Which of these roughly half-century-old companies presents a better investment opportunity?', 'url': 'https://finnhub.io/api/news?id=8a5e42a9d73e09b83190dc51513b368fd5f813da7aada8001706e41188f20fa0'}, {'category': 'company', 'datetime': 1756027390, 'headline': \"Ethereum's next upgrade: What you need to know\", 'id': 136502580, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Ethereum is gearing up for another major upgrade with the Fusaka hard fork, set for November 5', 'url': 'https://finnhub.io/api/news?id=b8308a5310cab511f1c7f66260442bcb62a56effedfb06262eb84d6b01983bd5'}, {'category': 'company', 'datetime': 1756022520, 'headline': '‘It’s almost tragic’: Bubble or not, the AI backlash is validating what one researcher and critic has been saying for years', 'id': 136502566, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Gary Marcus told Fortune that AI valuations remind him of Wile E Coyote. \"We are off the cliff.\"', 'url': 'https://finnhub.io/api/news?id=c02f68e789e6c621e714c92b71596e170bad8e3e5e606e8c3dc0c7c7d5e951be'}, {'category': 'company', 'datetime': 1756012944, 'headline': 'No Base iPhone in 2026 as Apple Bets Big on Foldable Launch', 'id': 136502582, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc. (NASDAQ:AAPL) is among the best stocks to buy now according to AI. According to the report by South Korean outlet ETNews, Apple Inc. (NASDAQ:AAPL) will skip the launch schedule in 2026, breaking from its tradition by not releasing its base model. The reason is simple – it’s saving the spotlight for its first-ever […]', 'url': 'https://finnhub.io/api/news?id=808ae2d0c49ab9b03f5ff9655f9330c6676802665ea8750cf5937e302a0d3582'}, {'category': 'company', 'datetime': 1756012786, 'headline': 'Amazon AI Chip Executive Joins Arm to Build Complete Chips', 'id': 136502583, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Amazon.com, Inc. (NASDAQ:AMZN) is among the best stocks to buy now according to AI. On Monday, it was revealed that Arm Holdings has hired Rami Sinno, artificial intelligence chip director at Amazon.com, Inc. (NASDAQ:AMZN), in an effort to develop its own complete chips. Up to this point, Arm has not developed its own chips; rather, […]', 'url': 'https://finnhub.io/api/news?id=2c4675a4789aea76a1abe4ded69dab761cf657957e5b375d54245308b9a8cda2'}, {'category': 'company', 'datetime': 1756011644, 'headline': \"'We quit our jobs to launch a £2.5m tequila cocktail business'\", 'id': 136502584, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Co-founders Alice Parmiter and Wynter Karo quit their corporate jobs to launch premium tequila cocktail brand Pimentae.', 'url': 'https://finnhub.io/api/news?id=6d5de702003b9d1be6bd2638afa73d0025eaf761609e9f36f47ef9ec5d753072'}, {'category': 'company', 'datetime': 1755988028, 'headline': '3 Reasons You Should Buy Apple Stock Ahead of a Major Product Launch', 'id': 136502585, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'When it comes to the rise and fall of Apple stock, there are a number of catalysts investors look out for, and one of them is product launches. Apple consistently moves the market with their new...', 'url': 'https://finnhub.io/api/news?id=94beb6b43d176186a159a51c9c3deeda2a003e3c97a587160b4d0c7c7b64b3cf'}, {'category': 'company', 'datetime': 1755967620, 'headline': 'Prediction: This Quantum Computing Stock Will Still Be Worth More Than Berkshire Hathaway, Palantir, and Tesla Combined in 2030', 'id': 136495839, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Quantum computing could become the next frontier of the artificial intelligence revolution.', 'url': 'https://finnhub.io/api/news?id=963004d4b5e80bab2c5fff729f22be257f34cf9ebb2bedd4c494b9da856a2d25'}, {'category': 'company', 'datetime': 1755964802, 'headline': 'Should You Buy Nvidia Stock Before August 27?', 'id': 136497749, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'While U.S.-China tensions continue, Nvidia remains the undisputed king of AI hardware.', 'url': 'https://finnhub.io/api/news?id=98f85b2449e45b2ff2677d9b64411d13507b8092f83be42f053ed7cdaabb7cb8'}, {'category': 'company', 'datetime': 1755958200, 'headline': 'Warren Buffett Is Selling Apple and Bank of America and Piling Into This Beaten Down Value Stock Instead', 'id': 136495877, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'This stock looks like a classic \"bear greedy when others are fearful\" investment.', 'url': 'https://finnhub.io/api/news?id=aea4c08e323cb64a8b592182ebcbde4ebf32768cce3245433c496ead6e48207f'}, {'category': 'company', 'datetime': 1755957919, 'headline': 'This week in Trumponomics: A government hedge fund?', 'id': 136495842, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Trump wants to nationalize Intel and make other big companies do his bidding. Everybody fine with that?', 'url': 'https://finnhub.io/api/news?id=7197f4b7e60502eeab5cbd8a0a8f7b4c4e183277572e2ee0635531c7ecf46a26'}, {'category': 'company', 'datetime': 1755950400, 'headline': 'How Tech Is Tackling the New Age-Verification Rules', 'id': 136495879, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Selfies, government IDs and AI are all being used by companies in an effort to adhere to new laws and regulations aimed at protecting children.', 'url': 'https://finnhub.io/api/news?id=2ebcad4799efbcb2a4e34a0eec8c391bf65a92be17fe05d73e0f8b732927209d'}, {'category': 'company', 'datetime': 1755943669, 'headline': 'Foxconn’s Recall of More Chinese Staff Tests Apple’s India Push', 'id': 136495880, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The extraction of Chinese workers from the factory of Yuzhan Technology, a Foxconn component unit, in southern Tamil Nadu state is the second such move in a few months. Foxconn has started flying in Taiwanese engineers to replace staff leaving, people familiar with the matter said, asking not to be named as the information is private. Earlier this year, officials in Beijing verbally encouraged regulatory agencies and local governments to curb technology transfers and equipment exports to India and Southeast Asia in what is a potential attempt to prevent companies from shifting manufacturing elsewhere.', 'url': 'https://finnhub.io/api/news?id=ce0350a1cada1abfc2638e13fd6f5ce5d031693e9c391e8c7d25d188f75d151a'}, {'category': 'company', 'datetime': 1755943531, 'headline': 'Did Trump save Intel? Not really, analysts say.', 'id': 136495849, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'SAN FRANCISCO (Reuters) -U.S. President Donald Trump is injecting nearly $9 billion into Intel in exchange for a 9.9% equity stake. What Intel needs is external customers for its so-called cutting-edge 14A manufacturing process - a tough ask, at least in the short term. CEO Lip Bu Tan, who took the top job in March, warned last month that the company may have to quit the chip contracting business if it does not land any big clients.', 'url': 'https://finnhub.io/api/news?id=f9dc938c9ab927a7ae254533f06a600f1daf54df8050ee606becea6f1ec5df0b'}, {'category': 'company', 'datetime': 1755941400, 'headline': 'Warren Buffett Is Selling Apple Stock Again. Should You Follow His Lead?', 'id': 136495882, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Buffett hadn't sold Apple stock in nearly a year.\", 'url': 'https://finnhub.io/api/news?id=67a819077623f6d8344de845e6097c7d733def259f5a1be9305512e41bc53398'}, {'category': 'company', 'datetime': 1755936600, 'headline': \"Goodbye Growth? Here's What I'm Buying As Value Mounts A Comeback\", 'id': 136493917, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2193071535/image_2193071535.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Recent underperformance in growth tech stocks reflects doubts about AI, while value-oriented dividend stocks have shown resilience and defensiveness. See more here.', 'url': 'https://finnhub.io/api/news?id=cd45534dafc843f5318537f56c7fad06e00d25a8e4c8fbf6789d1ab654d988d8'}, {'category': 'company', 'datetime': 1755935280, 'headline': 'Is Apple Stock Your Ticket to Becoming a Millionaire?', 'id': 136495883, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Shares of the tech giant have produced a total return of 68,660% in the past three decades.', 'url': 'https://finnhub.io/api/news?id=d2eec603ce17842f284932a4a3e5c03aff9daa6de5e5d86ddb6af845553352f9'}, {'category': 'company', 'datetime': 1755930600, 'headline': 'Brace for a Second China Shock. Advanced Manufacturing Is at Risk.', 'id': 136495884, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The U.S. could face a second version of the “China shock” that hollowed out parts of the U.S. manufacturing sector, according to Dan Wang, a veteran China technology analyst. The first China shock kept prices low for Americans and boosted corporate profitability. It also helped China transform into a more formidable rival, feeding the current frictions in the U.S.-China relationship.', 'url': 'https://finnhub.io/api/news?id=850292052d1c0a7a2f63dfb7d5c37273a14e9bc420558fbc9ca6bd344ab50a71'}, {'category': 'company', 'datetime': 1755925257, 'headline': 'The Guns N’ Roses-inspired company helping to make job search less soul-crushing', 'id': 136495885, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'As a fan of rock band Gun N’ Roses, Jérémy Clédat wanted to start his company with a name that resonated with the global job search market.', 'url': 'https://finnhub.io/api/news?id=01ebf524fba8ec60e739cfab45a16b7d5294a516e1158a9db36238ffab7015cd'}, {'category': 'company', 'datetime': 1755921418, 'headline': 'Apple (AAPL) off the Hook on Britain’s iPhone ‘Backdoor’ Push', 'id': 136495886, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc. (NASDAQ:AAPL) is one of the best stocks to buy according to billionaire Ken Fisher. On August 19, U.S. Director of National Intelligence Tulsi Gabbard, confirmed that Britain has dropped its demand for the company to provide a backdoor to its encrypted devices. British authorities were pushing the iPhone maker to provide a backdoor […]', 'url': 'https://finnhub.io/api/news?id=a98cd2b33fc9c36638974f17b290dc1f9f9a5c17ae1a7662d24e54cd8f5f3662'}, {'category': 'company', 'datetime': 1755913206, 'headline': 'Bernstein Reiterates Market Perform on Alphabet (GOOGL) Amid AI Competition', 'id': 136495887, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Alphabet Inc. (NASDAQ:GOOGL) is one of the Must-Watch AI Stocks for Investors. On August 19, Bernstein SocGen Group analyst Mark Shmulik reiterated a Market Perform rating on the stock with a $185.00 price target. Drawing parallels between the current artificial intelligence landscape and the mobile platform wars of the early 2010s, the firm noted that they […]', 'url': 'https://finnhub.io/api/news?id=52e18599d510ed5d44cc4be72d8bce573a555e0a3d6b252b19a42c7a6cb4f948'}, {'category': 'company', 'datetime': 1755909000, 'headline': 'Prediction: This Unstoppable Stock Will Join Nvidia, Microsoft, and Apple in the $3 Trillion Club Before 2029', 'id': 136495867, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'This tech giant is firing on all cylinders.', 'url': 'https://finnhub.io/api/news?id=06994cc452da8b68a81d3fd95c7879eb25b2ad61afb29c7393e040155999f3e9'}, {'category': 'company', 'datetime': 1755901072, 'headline': 'Apple Explores Using Google Gemini AI to Power Siri', 'id': 136495889, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple is in early talks to use Google\\'s Gemini to power a revamped Siri, a potential step toward outsourcing more AI technology. Bloomberg\\'s Mark Gurman speaks with Vonnie Quinn and Caroline Hyde on \"The Close\" about Apple\\'s next moves.', 'url': 'https://finnhub.io/api/news?id=c363ca48e9308ec13ce2347c2fc1cd4819e52806ed374d2df3427bef570f13d1'}, {'category': 'company', 'datetime': 1755896497, 'headline': \"Dow Hits Record High as Powell's Dovish Tilt Fuels Stock Market Rally\", 'id': 136495871, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Wall Street's equity indexes rallied on Friday, with the Dow Jones Industrial Average hitting a reco\", 'url': 'https://finnhub.io/api/news?id=c45ffc6ab579368ee4943ead165a214976c8fd630c32c9e71cd71bd0eb4b2699'}, {'category': 'company', 'datetime': 1755895238, 'headline': 'Apple-Google Talks Heating Up Over Siri-Gemini IPhone Agreement?', 'id': 136495891, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Google stock rose Friday amid a report Apple and Alphabet are in talks over a Gemini-Siri iPhone deal as well as a Meta cloud computing pact.', 'url': 'https://finnhub.io/api/news?id=7bdfa9590bbf6abc5c8bae96c1af4c0d60442f4a5eec8f6169a0bb11714408eb'}, {'category': 'company', 'datetime': 1755894360, 'headline': 'Apple Looks at Using Gemini for AI, Report Says. Alphabet Stock Jumps.', 'id': 136495892, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Alphabet stock jumped to a record high Friday afternoon after a report said Apple is exploring using Google’s Gemini to run the highly anticipated Siri voice assistant. Bloomberg reported that the iPhone maker has approached Google to look into possibly building a custom artificial-intelligence model that would be the foundation of the long-awaited AI-powered Siri. Shares of Alphabet climbed 3.2% to $206.09.', 'url': 'https://finnhub.io/api/news?id=b7caed03521886a7c082609b0a414963bb97e1a8291cc7d3a2f6509f6ff7e550'}, {'category': 'company', 'datetime': 1755892834, 'headline': 'Apple gets ready for AI in the enterprise with new ChatGPT configuration options', 'id': 136495893, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple will let businesses configure ChatGPT enterprise access in the fall.', 'url': 'https://finnhub.io/api/news?id=ff16d935a7e5e70d4af11beac775853b8403fc5f2ca7ac8ae912094e619e5c7d'}, {'category': 'company', 'datetime': 1755892096, 'headline': 'Apple May Use Google AI to Power Revamped Siri', 'id': 136495894, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple is in early discussions about using Google Gemini to power a revamped version of its Siri voice assistant. The work is part of an effort to catch up in generative AI, a field where the company arrived late and then struggled to gain traction. Bloomberg's Denitsa Tsekova reports.\", 'url': 'https://finnhub.io/api/news?id=10cb0d9b54ab072a06079afacfbaa7e40b93ffdeeb1addc9744763603cd2ff39'}, {'category': 'company', 'datetime': 1755891483, 'headline': 'Ethereum, Gap, Apple: Trending tickers', 'id': 136495895, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Market Domination Host Josh Lipton and Prairie Operating Co. EVP of market strategy Lou Basenese discuss some of the day's top trending tickers, including Etherium (ETH-USD), Gap (GAP), and Apple (AAPL). To watch more expert insights and analysis on the latest market action, check out more Market Domination.\", 'url': 'https://finnhub.io/api/news?id=513c75a2bddffce5c5da870e661aadeafdcfe6e8b9e9f2fbf9f1cfd5ddec103b'}, {'category': 'company', 'datetime': 1755885259, 'headline': 'Apple reportedly wants Google’s Gemini to power new Siri', 'id': 136478817, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Investing.com -- Apple Inc (NASDAQ:AAPL). is said to be exploring the possibility of using Google’s Gemini model to power a revamped version of its Siri voice assistant, potentially outsourcing more of its artificial intelligence technology.', 'url': 'https://finnhub.io/api/news?id=139913ae884d4863c0bbcee60a33d4d4d9f1e1fbc699de4f12026bbdb69cd234'}, {'category': 'company', 'datetime': 1755885159, 'headline': 'MP Materials (MP) Surges 247% Over Last Quarter Amid Market Optimism', 'id': 136478818, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"MP Materials (MP) has showcased significant developments, including improved quarterly sales and a notable partnership with Apple to supply rare earth magnets. However, despite better sales figures, the company's ongoing losses reflect its challenging financial landscape. While the shares of MP surged 247% over the last quarter, the broader market also saw upward momentum, highlighted by optimism from potential interest rate cuts indicated by Fed Chair Powell. The news of strategic buyback...\", 'url': 'https://finnhub.io/api/news?id=c0a05d2b9539b4bcd299176f87094a644b42b9779339447aa52c38680f183729'}, {'category': 'company', 'datetime': 1755883746, 'headline': \"Stock Market Today: Dow Soars 900 Points As Fed's Powell Raises Rate-Cut Hopes; Nvidia Earnings Loom (Live Coverage)\", 'id': 136478797, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Dow Jones soared to an all-time Friday on increased hopes of a rate cut at the September Federal Reserve meeting.', 'url': 'https://finnhub.io/api/news?id=a805579fc4172735f665585fd7d8d2a3aee69a6e9ed896a0dacacba43613f053'}, {'category': 'company', 'datetime': 1755883350, 'headline': \"Apple in talks to use Google's Gemini AI to power revamped Siri, Bloomberg News reports\", 'id': 136478822, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Alphabet's shares were up 3.7% while Apple's stock was up 1.6%, both extending gains in afternoon trading following the report. Apple recently approached Alphabet's Google to develop a custom AI model to power a redesigned Siri next year, the report said. Apple remains weeks from deciding whether to stick with in-house Siri models or switch to an external partner, and it has not yet chosen a partner.\", 'url': 'https://finnhub.io/api/news?id=d3f01a1dc2bd8cd8fa3dca65439ad99cb28cdf8a1b5e063380b30e92c19949a6'}, {'category': 'company', 'datetime': 1755883164, 'headline': \"Apple's latest security update directly hits crypto users\", 'id': 136478824, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple urges users to immediately update their devices. Here is how it impacts crypto users.', 'url': 'https://finnhub.io/api/news?id=43dc0a0ae76e081ac38f1854ea4461d80362a55dfa7f6c726aafc7c5b3c1ef44'}, {'category': 'company', 'datetime': 1755883110, 'headline': 'Apple Explores Using Google Gemini AI to Power Revamped Siri', 'id': 136478826, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The iPhone maker recently approached Alphabet Inc.’s Google to explore building a custom AI model that would serve as the foundation of the new Siri next year, according to people familiar with he matter. Google has started training a model that could run on Apple’s servers, said the people, who asked not to be identified because the discussions are private. Earlier this year, Apple also explored partnerships with Anthropic PBC and OpenAI, weighing whether Claude or ChatGPT could serve as Siri’s new brain.', 'url': 'https://finnhub.io/api/news?id=5e934c677d156a05ca72ffc602338342dc5957ea7a3940b1c7f3c9f7cd140763'}, {'category': 'company', 'datetime': 1755883020, 'headline': 'Dell Technologies vs. Apple: Which PC Maker Stock is a Better Buy?', 'id': 136478827, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'DELL or AAPL, which PC maker is a better pick, given the strong demand for AI-powered devices amid rising tariffs?', 'url': 'https://finnhub.io/api/news?id=985c2070d00aa745e59ca55a11d5cf8f10bccddc7ea2a5b87f42435be096d554'}, {'category': 'company', 'datetime': 1755882000, 'headline': 'Y Combinator says Apple’s App Store has hindered startup growth', 'id': 136478829, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Y Combinator is asking the court to deny Apple’s appeal.', 'url': 'https://finnhub.io/api/news?id=5d2b4f1964b618a05375b8680527bf6bc517f240daa4d5075c2794a020440546'}, {'category': 'company', 'datetime': 1755881142, 'headline': 'Masimo files lawsuit against US border patrol amid Apple patent dispute', 'id': 136478830, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Masimo contests that US border patrol inaction over prohibiting the import of Apple Watch’s determined to include features that infringe on its light-based pulse oximetry technology is unlawful.', 'url': 'https://finnhub.io/api/news?id=a12e0b45d7d58437876740c7036ac6c966f4dc171bb3912cc877fe0001f2811c'}, {'category': 'company', 'datetime': 1755870090, 'headline': 'Stock Market Today: Dow Jones Index Rises Ahead Of Big Powell Speech; Nvidia Falls On AI Chip News (Live Coverage)', 'id': 136476309, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The Dow Jones index rose Friday ahead of Fed Chair Powell's speech. Nvidia stock fell on AI chip news, while Palantir also dropped.\", 'url': 'https://finnhub.io/api/news?id=e0f20dd04abda6bce17068f4b17e56a1a8dcc47f435d132d48fde56d027940e5'}, {'category': 'company', 'datetime': 1755872329, 'headline': 'Apple just indirectly boosted the value of its all-in-one subscription service', 'id': 136478832, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple hiked the price of Apple TV+ earlier this week, the third time it’s done so since 2019.', 'url': 'https://finnhub.io/api/news?id=472c9b6e27318765aa4454bee42e36228b952463214fa850d0eb8520c24ea1c0'}, {'category': 'company', 'datetime': 1755872220, 'headline': 'Meta Doubles Down on ‘Superintelligence’ Investment. It’s Good News for AI Stocks.', 'id': 136478814, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Meta Platforms is “investing more and more” into its artificial-intelligence efforts according to chief AI officer Alexandr Wang.', 'url': 'https://finnhub.io/api/news?id=574da7668862eeecb690af573b4e31a3d1517185457513bc7b9f6d0ea9108559'}, {'category': 'company', 'datetime': 1755871202, 'headline': 'How To Make An Iron Condor Fly With Options On Apple Stock', 'id': 136476454, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple has had some up-and-down price action, and it's a good bet it will go sideways. This could make for an iron condor setup.\", 'url': 'https://finnhub.io/api/news?id=7222792f96523088014e91d64f3462b712538e9071a0bb7ac00b2dfdb4c592a0'}, {'category': 'company', 'datetime': 1755871200, 'headline': 'Meet the Unstoppable Vanguard ETF With 55% Invested in \"Ten Titans\" Growth Stocks', 'id': 136476419, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Vanguard S&P 500 Growth ETF has especially high weightings in select \"Ten Titans\" stocks.', 'url': 'https://finnhub.io/api/news?id=5ca186cfc0502126d6873ca3ceec89c7428c922342b104a6f94ff4b550759b22'}, {'category': 'company', 'datetime': 1755870571, 'headline': 'Meta Hires Another Apple AI Leader Amid Headcount Freeze, Report Says', 'id': 136476456, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Meta Platforms is reportedly hiring another senior AI executive from Apple for its Meta Superintelligence Labs, where it is moving to freeze headcount.', 'url': 'https://finnhub.io/api/news?id=03aa9b139c6a4ad64e005804e63597136c919603c45a2cd4352e19874da2e23e'}, {'category': 'company', 'datetime': 1755868678, 'headline': 'What If You’d Invested $500 in Apple Stock Instead of Buying the First iPhone?', 'id': 136476457, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The very first iPhone customers got plenty of use and enjoyment out of it, but they might have felt even better if they had invested that money in Apple stock.', 'url': 'https://finnhub.io/api/news?id=be031bbd19fc281a4c21acc193a683e5434e5f7d0d0e24e9ca71c8477134e368'}, {'category': 'company', 'datetime': 1755866651, 'headline': 'Latest News In Cloud AI - AI-Powered Security Boosts Cloud Protection in New Partnership', 'id': 136476439, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Radware and EPIC Cloud Company have entered into a Managed Security Service Provider (MSSP) agreement aimed at enhancing cloud application security through AI-powered solutions. This collaboration allows EPIC Cloud to integrate Radware’s advanced security services into their offerings, thereby bolstering protection for cloud-based applications and data. Radware’s service includes a comprehensive security platform featuring web application firewalls, bot management, API protection, and DDoS...', 'url': 'https://finnhub.io/api/news?id=314fd848df66c32f01bc147fc013d5799bff38e4d2c32d3c6a92d1dd11874575'}, {'category': 'company', 'datetime': 1755863178, 'headline': \"Mark Zuckerberg Halts AI Hiring After Million-Dollar Talent Poaching Sparks Investor Backlash Amid Meta's 'Superintelligence Efforts:' Report\", 'id': 136476459, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Meta Platforms Inc. (NASDAQ:META) has implemented a hiring freeze in its artificial intelligence division following months of aggressive recruitment that included nine-figure compensation packages. Hiring Moratorium Follows Talent War Spending The ...', 'url': 'https://finnhub.io/api/news?id=8392d7b0547d3be92c922c19b5b9bd2c19f89bd4d75b0cad5df90a38cb53c227'}, {'category': 'company', 'datetime': 1755863100, 'headline': 'Could Uber Become a Trillion-Dollar Company One Day?', 'id': 136476443, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Uber is quietly becoming one of the most powerful transport infrastructure companies.', 'url': 'https://finnhub.io/api/news?id=1a88598da212691416aa7304d8d80ba3f4a1799f409e0516ddd06f76997742b7'}, {'category': 'company', 'datetime': 1755861140, 'headline': 'Russia mandates pre-installation of MAX app', 'id': 136476461, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The app is designed to integrate with various government services.', 'url': 'https://finnhub.io/api/news?id=ab881b4b983e5a4c86ee13cbc6b2dbcd43f3e5ebe97eabdce44243da948f2b89'}, {'category': 'company', 'datetime': 1755858809, 'headline': \"Broadcom's AI Push Gains Speed With Microsoft, Meta, And Apple Pouring Billions Into Data Infrastructure\", 'id': 136476321, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Broadcom Inc. (NASDAQ:AVGO) is riding the artificial intelligence boom as soaring Big Tech investments in data infrastructure fuel demand for its custom chips and networking solutions, propelling the stock to strong year-to-date gains even as the company faces regulatory challenges in Europe. The custom chipmaker has surged 25% year-to-date, outpacing the NASDAQ Composite’s 9% gain, as booming demand for its networking and Application-Specific Integrated Circuit (ASIC) businesses positions the c', 'url': 'https://finnhub.io/api/news?id=b4fc561e1ea668faf67baf1d647f0ee877585164271fb7c5eaa8eda827e5caa6'}, {'category': 'company', 'datetime': 1755857452, 'headline': 'Investors zero in on Nvidia results as US tech stocks waver', 'id': 136476450, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"NEW YORK (Reuters) -A wobble in U.S. technology shares has raised the stakes for Nvidia Corp's quarterly results on Wednesday, with earnings from the semiconductor giant posing a crucial test for the scorching AI trade. The benchmark S&P 500 has pulled back this week from record levels, dragged lower by a roughly 3% drop so far this week in the heavyweight tech sector after a huge run for the group. Fueled by its dominant artificial intelligence (AI) products, Nvidia's massive share price gains have buoyed both the tech sector and the overall market in recent years.\", 'url': 'https://finnhub.io/api/news?id=8e0bae9104c2d5c3445963999e6df31717d9966102ad20374b5d1646d468c1d4'}, {'category': 'company', 'datetime': 1755856544, 'headline': '6 Stocks That Turned $1,000 Initial Investments Into Millions by Mid-2025', 'id': 136476464, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'These 6 stocks turned modest $1K investments into millions by mid-2025. See which companies delivered massive returns.', 'url': 'https://finnhub.io/api/news?id=066447d8e4c79d6dc79a1f3d956f70e2f43f3a8d059cc46665f961522bf3648d'}, {'category': 'company', 'datetime': 1755853743, 'headline': 'Should CEO pay be capped? Readers have their say', 'id': 136476465, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Pay for CEOs at FTSE 100 firms has hit a record high for the third year in a row, raising questions about equity and fairness.', 'url': 'https://finnhub.io/api/news?id=171ce63d87c11410ef52b55c53490aeee7a4389be2ea324c1cfbfa50c06fc116'}, {'category': 'company', 'datetime': 1755852300, 'headline': 'Do Extreme Concentration And Bad Breadth Signify A Bubble?', 'id': 136475952, 'image': '', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': '', 'url': 'https://finnhub.io/api/news?id=7157f6bce8ab4cae4100f74e195d5e82876e640cbc5f8436d773bb24af2eee88'}, {'category': 'company', 'datetime': 1755850500, 'headline': 'BNY Mellon Equity Income Fund Q2 2025 Commentary', 'id': 136475862, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2158808037/image_2158808037.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'BNY Mellon Equity Income Fund returned -3.31% during the first quarter of 2025. Click here to read more.', 'url': 'https://finnhub.io/api/news?id=49d43786806274bdfd92a192f7ae853e14fd9144cdadf9898889b5496ea6be41'}, {'category': 'company', 'datetime': 1755850413, 'headline': 'FTSE 100 LIVE: Stocks eke out gains as traders await key Jackson Hole speech from Federal Reserve chair', 'id': 136476324, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Traders look for comments that could help confirm expectations that a US interest rate cut is on the cards.', 'url': 'https://finnhub.io/api/news?id=86dfe633de7c66a75f0be7a6a3f1d3edf5360d215952aa1d0201f141758d78a4'}, {'category': 'company', 'datetime': 1755849060, 'headline': \"Billionaire Warren Buffett Sold 69% of Berkshire's Stake in Apple and Has Loaded Up on This Industry-Leading Stock for 4 Straight Quarters\", 'id': 136476467, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The Oracle of Omaha is paring down his No. 1 holding, yet again, in favor of a company that's delivered a nearly 48,000% total return since it went public.\", 'url': 'https://finnhub.io/api/news?id=e8e188c0ad3059e6099a6e54429a1a0668c28439de8808827a8dced673eb4c33'}, {'category': 'company', 'datetime': 1755838802, 'headline': 'IBM head of research on how quantum computing will change businesses', 'id': 136476468, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"IBM's Alessandro Curioni says companies must act now to gain an edge from quantum computing.\", 'url': 'https://finnhub.io/api/news?id=2bc8ddfcbb9c7ee49ef066106ef1d70077e630f55f9e2c01828995feadef7955'}, {'category': 'company', 'datetime': 1755837281, 'headline': 'Apple makes move sure to frustrate loyal customers', 'id': 136476469, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple's services division is a huge moneymaker and the company is milking it for all it's worth.\", 'url': 'https://finnhub.io/api/news?id=9099051383c0d494301133812162f480bc17fa1987c0999552108ee8c98e5f96'}, {'category': 'company', 'datetime': 1755830400, 'headline': \"The Visible Alpha AI Monitor Update: What's Next For AI?\", 'id': 136474705, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2151904577/image_2151904577.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'The Visible Alpha AI Monitor aggregates publicly traded US technology companies, providing a comprehensive measure of the current state and projected growth of the core AI industry.', 'url': 'https://finnhub.io/api/news?id=6fefae13e9d9825b6cf0023b8e57db778fe619013fbe6242efa6e859633469e7'}, {'category': 'company', 'datetime': 1755826084, 'headline': 'Meta makes huge cloud computing deal with Google: source', 'id': 136476470, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Meta has made a cloud computing deal with Google worth more than $10 billion over the course of six years, a source close to the transaction told AFP Thursday.Google parent Alphabet's cloud computing business was on pace to bring in $50 billion over the course of the year, the company said in a recent earnings report.\", 'url': 'https://finnhub.io/api/news?id=c16a5b49617a847ebffe2155701fc8c66b73d16b6238a4e45affc5c246c2d67f'}, {'category': 'company', 'datetime': 1755820705, 'headline': 'Trump administration is not eyeing equity in TSMC, Micron, official says', 'id': 136476471, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'WASHINGTON (Reuters) -The Trump administration is considering taking equity stakes in companies getting funds from the 2022 CHIPS Act but has no similar plans for bigger firms boosting U.S. investments, such as TSMC and Micron, a White House official told Reuters. The official confirmed a Wall Street Journal report that the administration does not intend to seek equity stakes in semiconductor companies, such as Micron and TSMC, that plan to step up investment.', 'url': 'https://finnhub.io/api/news?id=d551c06b88c15bfad192c4d46a69b45d12c9af5300867d14d6d4d269e122b1e9'}]\n", + "2025-08-29 02:30:06,375 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-29 02:30:39,933 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-29 02:30:39,939 [INFO] Executing tool: get_market_news with args: {'category': 'forex'}\n", + "2025-08-29 02:30:39,941 [INFO] Tool get_market_news called for category 'forex'\n", + "2025-08-29 02:30:40,166 [INFO] Tool get_market_news [{'category': 'forex', 'datetime': 1756412432, 'headline': \"Trump official announces 'transitory' taxes for the next six months\", 'id': 7510362, 'image': 'https://images.investinglive.com/images/Tariff%20Trump_id_6a2dc517-dc8d-4e19-84db-f22c99095372_size975.jpg', 'related': '', 'source': 'Forexlive', 'summary': \"

Senior Trump administration official:

  • Package shipments to U.S. to face flat duties of $80–$200 for six months before shifting to specific duty rates

This is in relation to Trump's removal of the 'de minimis' exemption on buying low value products from overseas. US consumers will now be taxed a minimum of $80, and up to $200, for ordering such items from offshore now.

More now, senior Trump administration official:

  • CBP has collected over $492 million in additional duties on packages from China and Hong Kong since de minimis exemption was ended for them
  • Engaged with foreign partners to ensure there is minimal disruption to shipments
  • Britain, Canada, Ukraine have said there will be no interruption in mail coming to U.S
  • There will not be any exceptions to the end of the de minimis exemption.
\\n This article was written by Eamonn Sheridan at investinglive.com.\", 'url': 'https://investinglive.com/news/trump-official-announces-transitory-taxes-for-the-next-six-months-20250828/'}]\n", + "2025-08-29 02:30:56,552 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n" + ] + } + ], "source": [ - "gr.ChatInterface(fn=chat, type=\"messages\").launch()" + "gr.ChatInterface(fn=chat, type=\"messages\", title=\"TickerBot\", description=\"Ask about stock prices, company profiles and market news!\").launch(debug=True)" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "ef238ae3-353f-462f-a7f7-2378cc482edb", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "09d7f664-7252-4fa0-b817-10dbda83e3f1", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6cd3c913-c486-4d33-8f3d-c110e127fe66", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "id": "473e5b39-da8f-4db1-83ae-dbaca2e9531e", @@ -1172,7 +1347,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.7" + "version": "3.11.13" } }, "nbformat": 4, From a490884a329c005c10469ecb393598581b2b45fc Mon Sep 17 00:00:00 2001 From: Daniel Fernandez Colon Date: Fri, 29 Aug 2025 20:46:55 +0200 Subject: [PATCH 18/25] Added my contribution to week1 day1 exercise --- .../day1-email-subject-implementation.ipynb | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 week1/community-contributions/day1-email-subject-implementation.ipynb diff --git a/week1/community-contributions/day1-email-subject-implementation.ipynb b/week1/community-contributions/day1-email-subject-implementation.ipynb new file mode 100644 index 0000000..e968e7c --- /dev/null +++ b/week1/community-contributions/day1-email-subject-implementation.ipynb @@ -0,0 +1,115 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4e2a9393-7767-488e-a8bf-27c12dca35bd", + "metadata": {}, + "outputs": [], + "source": [ + "# imports\n", + "\n", + "import os\n", + "from dotenv import load_dotenv\n", + "from openai import OpenAI\n", + "\n", + "# If you get an error running this cell, then please head over to the troubleshooting notebook!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b87cadb-d513-4303-baee-a37b6f938e4d", + "metadata": {}, + "outputs": [], + "source": [ + "# Load environment variables in a file called .env\n", + "\n", + "load_dotenv(override=True)\n", + "api_key = os.getenv('OPENAI_API_KEY')\n", + "\n", + "# Check the key\n", + "\n", + "if not api_key:\n", + " print(\"No API key was found - please head over to the troubleshooting notebook in this folder to identify & fix!\")\n", + "elif not api_key.startswith(\"sk-proj-\"):\n", + " print(\"An API key was found, but it doesn't start sk-proj-; please check you're using the right key - see troubleshooting notebook\")\n", + "elif api_key.strip() != api_key:\n", + " print(\"An API key was found, but it looks like it might have space or tab characters at the start or end - please remove them - see troubleshooting notebook\")\n", + "else:\n", + " print(\"API key found and looks good so far!\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "019974d9-f3ad-4a8a-b5f9-0a3719aea2d3", + "metadata": {}, + "outputs": [], + "source": [ + "openai = OpenAI()\n", + "\n", + "# If this doesn't work, try Kernel menu >> Restart Kernel and Clear Outputs Of All Cells, then run the cells from the top of this notebook down.\n", + "# If it STILL doesn't work (horrors!) then please see the Troubleshooting notebook in this folder for full instructions" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "00743dac-0e70-45b7-879a-d7293a6f68a6", + "metadata": {}, + "outputs": [], + "source": [ + "# Step 1: Create your prompts\n", + "\n", + "system_prompt = \"Eres un analista acostumbrado a trabajar con correos electrónicos que contiene un gran conocimiento sobre la mejor manera de resumir contenido releveante \\\n", + "dejando de lado cualquier información que no despierte interés o no sea el tema principal del correo. Tu función será leer contenido de correos y definir un listado de las 3 mejores opciones con el formato: Opción *numero de la opción*: *sujeto* Motivo: *que palabras clave dentro del texto has utilizado para llegar a esa conclusion y la relación semántica con tu idea\"\n", + "user_prompt = \"\"\"\n", + "Tengo un correo que le quiero enviar a mi profesor pero no se muy bien como llamarlo, ayudame. El correo es el siguiente:\n", + "Hola profe,\n", + "Ultimamente estoy disfrutando mucho sus clases y la información que presenta me parece muy importante. Este fin de semana me voy de vacaciones y no podré\n", + "ir a sus clases la semana que viene. Me gustaría si pudiera pasarme los pdfs de la siguiente semana para echarle un vistazo por mi cuenta durante mi ausencia en Francia.\n", + "\n", + "Un saludo,\n", + "Daniel.\n", + "\"\"\"\n", + "\n", + "# Step 2: Make the messages list\n", + "\n", + "messages = [{\"role\" : \"system\" , \"content\": system_prompt},\n", + " {\"role\": \"user\", \"content\": user_prompt}]\n", + "\n", + "# Step 3: Call OpenAI\n", + "\n", + "response = openai.chat.completions.create( \n", + " model = \"gpt-4o-mini\",\n", + " messages = messages)\n", + "\n", + "# Step 4: print the result\n", + "\n", + "print(response.choices[0].message.content)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 831dab9597ef1d6b204901b1a87c5e4feae203e9 Mon Sep 17 00:00:00 2001 From: Ahsan-Ullah <69212320+TechQaiser@users.noreply.github.com> Date: Fri, 29 Aug 2025 13:23:24 -0700 Subject: [PATCH 19/25] TechQaiser Youtube Video Summarizer. Paste Youtube Link & Get Summary Of Video --- .../youtube_video_summarize.ipynb | 216 ++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 week1/community-contributions/youtube_video_summarize.ipynb diff --git a/week1/community-contributions/youtube_video_summarize.ipynb b/week1/community-contributions/youtube_video_summarize.ipynb new file mode 100644 index 0000000..c96714f --- /dev/null +++ b/week1/community-contributions/youtube_video_summarize.ipynb @@ -0,0 +1,216 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 36, + "id": "8ca2e60d-17c0-40fc-91c6-c16915b39c06", + "metadata": {}, + "outputs": [], + "source": [ + "import re, html, json\n", + "import requests\n", + "from urllib.error import HTTPError\n", + "from openai import OpenAI\n", + "from IPython.display import Markdown, display, update_display\n", + "from youtube_transcript_api import YouTubeTranscriptApi, NoTranscriptFound, TranscriptsDisabled, VideoUnavailable\n", + "\n", + "OLLAMA_API = \"http://localhost:11434/api/chat\"\n", + "HEADERS = {\"Content-Type\": \"application/json\"}\n", + "MODEL = \"llama3.2\"\n", + "api_key='ollama'\n", + "\n", + "def yt_title_desc_transcript(url: str, lang=\"en\"):\n", + " \"\"\"\n", + " Returns {\"title\": str|None, \"description\": str|None, \"transcript\": str|None}.\n", + " - Title via oEmbed (no API key).\n", + " - Description scraped from the watch page (shortDescription).\n", + " - Transcript via youtube-transcript-api, gracefully handling 400/disabled.\n", + " \"\"\"\n", + " # --- extract 11-char video id ---\n", + " m = re.search(r\"(?:v=|/)([0-9A-Za-z_-]{11})|^([0-9A-Za-z_-]{11})$\", url)\n", + " vid = (m.group(1) or m.group(2)) if m else None\n", + " if not vid:\n", + " return {\"title\": None, \"description\": None, \"transcript\": None}\n", + "\n", + " # --- title via oEmbed (very robust) ---\n", + " title = None\n", + " try:\n", + " r = requests.get(\"https://www.youtube.com/oembed\",\n", + " params={\"url\": f\"https://www.youtube.com/watch?v={vid}\", \"format\": \"json\"},\n", + " timeout=10)\n", + " if r.ok:\n", + " title = r.json().get(\"title\")\n", + " except Exception:\n", + " pass\n", + "\n", + " # --- description from watch page (shortDescription in initial JSON) ---\n", + " description = None\n", + " try:\n", + " page = requests.get(f\"https://www.youtube.com/watch?v={vid}\", timeout=10).text\n", + " # Look for ytInitialPlayerResponse JSON\n", + " jmatch = re.search(r\"ytInitialPlayerResponse\\s*=\\s*({.*?});\", page, re.DOTALL)\n", + " if jmatch:\n", + " data = json.loads(jmatch.group(1))\n", + " desc = data.get(\"videoDetails\", {}).get(\"shortDescription\")\n", + " if desc:\n", + " description = html.unescape(desc)\n", + " except Exception:\n", + " pass\n", + "\n", + " # --- transcript (handle 400 cleanly) ---\n", + " transcript_text = None\n", + " try:\n", + " items = YouTubeTranscriptApi.get_transcript(vid, languages=[lang])\n", + " transcript_text = \" \".join(ch[\"text\"].strip() for ch in items if ch.get(\"text\"))\n", + " except (NoTranscriptFound, TranscriptsDisabled, VideoUnavailable, HTTPError):\n", + " # HTTPError covers the \"HTTP Error 400: Bad Request\" case\n", + " transcript_text = None\n", + " except Exception:\n", + " transcript_text = None\n", + "\n", + " return {\"title\": title, \"description\": description, \"transcript\": transcript_text}\n" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "ad9be496-4e91-4562-90f3-54d11208da55", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "system_prompt = '''\n", + "You are an assistant that generates detailed yet concise summaries of YouTube videos.\n", + "When the user provides a title and description of a YouTube video, your task is to write a coherent, engaging, and informative summary of around 500 words.\n", + "The summary should:\n", + "\n", + "Capture the main themes and key points the video likely covers.\n", + "\n", + "Expand on the description logically, providing context and flow.\n", + "\n", + "Stay neutral, factual, and clear (no personal opinions).\n", + "\n", + "Be self-contained so it makes sense without needing to watch the video.\n", + "'''" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "dd4be0bc-df1f-47e0-9e03-9b734117f80a", + "metadata": {}, + "outputs": [], + "source": [ + "def user_prompt(title, description):\n", + " prompt = '''Provide me the YouTube video title and description.\\n\n", + " I will generate a clear, engaging, and concise summary of the video content in around 500 words,\\n\n", + " highlighting the main ideas, key points, and important details.\\n'''\n", + " prompt += f'here is the title : {title} \\n Description : {description} '\n", + " return prompt" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "46896ad3-db1e-448a-8a03-036b9568c69f", + "metadata": {}, + "outputs": [], + "source": [ + "def stream_youtube(yt_url):\n", + " ollama = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama')\n", + " video_metadata = yt_title_desc_transcript(yt_url)\n", + " stream = ollama.chat.completions.create(\n", + " model=MODEL,\n", + " messages = [\n", + " {\"role\":\"system\", \"content\": system_prompt},\n", + " {\"role\":\"user\", \"content\": user_prompt(video_metadata['title'], video_metadata['description'])}\n", + " ],\n", + " stream=True\n", + " \n", + " )\n", + " response = \"\"\n", + " display_handle = display(Markdown(\"\"), display_id=True)\n", + " for chunk in stream:\n", + " response += chunk.choices[0].delta.content or ''\n", + " response = response.replace(\"```\",\"\").replace(\"markdown\", \"\")\n", + " update_display(Markdown(response), display_id=display_handle.display_id)" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "b59f8773-c13e-4050-ad3c-b578d07ef5e7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "Here is a summary of the YouTube video:\n", + "\n", + "**Monta Re: A Baul-Inspired Tribute to the Mystic Guru Shankaracharya**\n", + "\n", + "The music video for \"Monta Re\" by Amit Trivedi, featuring Swanand Kirkire and Amitabh Bhattacharya, is a soulful tribute to the mystic guru Shankaracharya. Set in the Bengali folk music tradition, this song brings to life the ancient tales of Shankaracharya's spiritual journey.\n", + "\n", + "With elegant lyrics penned by Amitabh Bhattacharya, \"Monta Re\" transports listeners to the banks of the Ganges River, where Shankaracharya wandered in search of wisdom and inner peace. The song's haunting melodies and emotive vocals evoke a sense of longing and introspection, perfectly capturing the mystic guru's spiritual essence.\n", + "\n", + "The music video beautifully illustrates the baul-inspired style, with intricate traditional dance movements performed by a group of energetic dancers. The choreography seamlessly blends elements of Bengal's folk heritage with modern sensibilities, making the song an engaging watch for audience members interested in Indian classical music.\n", + "\n", + "**Music and Lyric Credit:**\n", + "Amit Trivedi handles the music composition, ensuring that the melody complements the song's themes without overpowering them. Amitabh Bhattacharya takes credit for the lyrics, which tell stunning stories of Shankaracharya's spiritual adventures. The song features Swanand Kirkire and Amitabh Bhattacharya as vocalists, further enriching its emotional impact.\n", + "\n", + "**Relevance to Bengali Culture:**\n", + "\"Monta Re\" is a heartwarming tribute to Bengal's rich cultural heritage. Inspired by the baul traditions of the region, this song honors Shankaracharya's life and spiritual journey without diminishing his significance in modern times. By showcasing these folk roots, \"Monta Re\" provides fans with an enriching sensory experience.\n", + "\n", + "You can listen to \"Monta Re\" along with other T-Series music videos released by Amit Trivedi at the links provided below:\n", + "\n", + "- Watch \"Ankahee\"\n", + "- Check out \"Sawaar Loon\"\n", + "- Explore \"Zinda Hoon\"\n", + "\n", + "Follow the official T-SERIES YouTube channel for an ever-growing variety of original music tracks!\n", + "\n", + "By embracing the richness of Bengali folk traditions, \"Monta Re\" embodies a musical reflection of Shankaracharya's extraordinary journey as both spiritual guide and symbol of timeless wisdom." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "stream_youtube('https://youtu.be/99NUJ1cLbBI?list=RDdJ6_aU6auZc')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "649287ca-aff8-4b59-91b7-731c007e83a7", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From f126a5aba0eaa4e4fa943ad4d8baa5cd3c16a990 Mon Sep 17 00:00:00 2001 From: Daniel Fernandez Colon Date: Fri, 29 Aug 2025 22:51:10 +0200 Subject: [PATCH 20/25] week 1 day 2 exercise contribution --- .../day2_exercise_using_input.ipynb | 319 ++++++++++++++++++ 1 file changed, 319 insertions(+) create mode 100644 week1/community-contributions/day2_exercise_using_input.ipynb diff --git a/week1/community-contributions/day2_exercise_using_input.ipynb b/week1/community-contributions/day2_exercise_using_input.ipynb new file mode 100644 index 0000000..f616d96 --- /dev/null +++ b/week1/community-contributions/day2_exercise_using_input.ipynb @@ -0,0 +1,319 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "d15d8294-3328-4e07-ad16-8a03e9bbfdb9", + "metadata": {}, + "source": [ + "# Welcome to your first assignment!\n", + "\n", + "Instructions are below. Please give this a try, and look in the solutions folder if you get stuck (or feel free to ask me!)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4e2a9393-7767-488e-a8bf-27c12dca35bd", + "metadata": {}, + "outputs": [], + "source": [ + "# imports\n", + "\n", + "import requests\n", + "from bs4 import BeautifulSoup\n", + "from IPython.display import Markdown, display" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "29ddd15d-a3c5-4f4e-a678-873f56162724", + "metadata": {}, + "outputs": [], + "source": [ + "# Constants\n", + "\n", + "OLLAMA_API = \"http://localhost:11434/api/chat\"\n", + "HEADERS = {\"Content-Type\": \"application/json\"}\n", + "MODEL = \"llama3.2\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dac0a679-599c-441f-9bf2-ddc73d35b940", + "metadata": {}, + "outputs": [], + "source": [ + "# Create a messages list using the same format that we used for OpenAI\n", + "\n", + "messages = [\n", + " {\"role\": \"user\", \"content\": \"Describe some of the business applications of Generative AI\"}\n", + "]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7bb9c624-14f0-4945-a719-8ddb64f66f47", + "metadata": {}, + "outputs": [], + "source": [ + "payload = {\n", + " \"model\": MODEL,\n", + " \"messages\": messages,\n", + " \"stream\": False\n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7745b9c4-57dc-4867-9180-61fa5db55eb8", + "metadata": {}, + "outputs": [], + "source": [ + "import ollama\n", + "\n", + "response = ollama.chat(model=MODEL, messages=messages)\n", + "print(response['message']['content'])" + ] + }, + { + "cell_type": "markdown", + "id": "a4704e10-f5fb-4c15-a935-f046c06fb13d", + "metadata": {}, + "source": [ + "## Alternative approach - using OpenAI python library to connect to Ollama" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "23057e00-b6fc-4678-93a9-6b31cb704bff", + "metadata": {}, + "outputs": [], + "source": [ + "# There's actually an alternative approach that some people might prefer\n", + "# You can use the OpenAI client python library to call Ollama:\n", + "\n", + "from openai import OpenAI\n", + "ollama_via_openai = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama')\n", + "\n", + "response = ollama_via_openai.chat.completions.create(\n", + " model=MODEL,\n", + " messages=messages\n", + ")\n", + "\n", + "print(response.choices[0].message.content)" + ] + }, + { + "cell_type": "markdown", + "id": "1622d9bb-5c68-4d4e-9ca4-b492c751f898", + "metadata": {}, + "source": [ + "# NOW the exercise for you\n", + "\n", + "Take the code from day1 and incorporate it here, to build a website summarizer that uses Llama 3.2 running locally instead of OpenAI; use either of the above approaches." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "0c1f84c4-4cc0-4085-8ea5-871a8ca46a47", + "metadata": {}, + "outputs": [], + "source": [ + "# imports\n", + "\n", + "import ollama" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "890852ab-2cd4-41dc-b168-6bd1360b967a", + "metadata": {}, + "outputs": [], + "source": [ + "MODEL = \"llama3.2\"" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "6de38216-6d1c-48c4-877b-86d403f4e0f8", + "metadata": {}, + "outputs": [], + "source": [ + "# A class to represent a Webpage\n", + "\n", + "# Some websites need you to use proper headers when fetching them:\n", + "headers = {\n", + " \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36\"\n", + "}\n", + "\n", + "class Website:\n", + "\n", + " def __init__(self, url):\n", + " \"\"\"\n", + " Create this Website object from the given url using the BeautifulSoup library\n", + " \"\"\"\n", + " self.url = url\n", + " response = requests.get(url, headers=headers)\n", + " soup = BeautifulSoup(response.content, 'html.parser')\n", + " self.title = soup.title.string if soup.title else \"No title found\"\n", + " for irrelevant in soup.body([\"script\", \"style\", \"img\", \"input\"]):\n", + " irrelevant.decompose()\n", + " self.text = soup.body.get_text(separator=\"\\n\", strip=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "9d398f9a-c66e-42b5-91b4-5417944b8408", + "metadata": {}, + "outputs": [], + "source": [ + "def user_prompt_generator(website) -> str:\n", + " user_prompt = f\"You will act as a website summarizer with knowledge of Web Content Accessibility Guidelines. You will look into the web: {website.title} and \"\n", + " user_prompt += \"break down the relevant information about it in this categories: What is the website about, \\\n", + " to whom the website belongs and what practises should improve to have a better user experience. \\n\\n\"\n", + " user_prompt += website.text\n", + "\n", + " return user_prompt" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "156d7c67-b714-4156-9f69-faf0c50aaf13", + "metadata": {}, + "outputs": [], + "source": [ + "def messages_generator(user_prompt : str) -> list[dict[str, str]]:\n", + " messages = [{\"role\" : \"user\", \"content\" : user_prompt}]\n", + "\n", + " return messages" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "f07c4143-6cc5-4d28-846c-a373564e9264", + "metadata": {}, + "outputs": [], + "source": [ + "def user_request_reader() -> str:\n", + " while True:\n", + " website_url = input(\"Define what website you want to summarize by giving the url: \")\n", + " if website_url.lower().startswith(\"http\"):\n", + " return website_url\n", + " print(\"URL not valid. Please provide a full url.\\n\")" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "94933255-2ca8-40b5-8f74-865d3e781058", + "metadata": {}, + "outputs": [], + "source": [ + "def summarizer_bot():\n", + " website_url = user_request_reader()\n", + " website = Website(website_url)\n", + " \n", + " user_prompt = user_prompt_generator(website)\n", + " messages = messages_generator(user_prompt)\n", + "\n", + " response = ollama.chat(model=MODEL, messages=messages)\n", + " print(response['message']['content'])" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "2d81faa4-25b3-4d5d-8f36-93772e449b5c", + "metadata": {}, + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Define what website you want to summarize by giving the url: test.com\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "URL not valid. Please provide a full url.\n", + "\n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Define what website you want to summarize by giving the url: https://edwarddonner.com\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "**Summary:**\n", + "\n", + "The website \"Home - Edward Donner\" belongs to Edward Donner, a co-founder and CTO of Nebula.io, an AI startup. The website is about Edward's interests in writing code, experimenting with Large Language Models (LLMs), and DJing, as well as his work in applying AI to help people discover their potential.\n", + "\n", + "**Categories:**\n", + "\n", + "### What is the website about?\n", + "\n", + "The website is primarily about Edward Donner's personal brand, showcasing his expertise in AI and LLMs. It includes information about his work at Nebula.io, which applies AI to talent management. The website also features a \"Connect Four\" arena where LLMs compete against each other, as well as sections for learning more about LLMs and staying up-to-date with Edward's courses and publications.\n", + "\n", + "### To whom does the website belong?\n", + "\n", + "The website belongs to Edward Donner, a co-founder and CTO of Nebula.io. It appears to be a personal website or blog, showcasing his expertise and interests in AI and LLMs.\n", + "\n", + "### Practices to improve for better user experience:\n", + "\n", + "1. **Clearer navigation**: The website's menu is simple but not intuitive. Adding clear categories or sections would help users quickly find the information they're looking for.\n", + "2. **More detailed about section**: The \"About\" section provides a brief overview of Edward's work and interests, but it could be more detailed and comprehensive.\n", + "3. **Improved accessibility**: While the website is likely following general web accessibility guidelines, there are no clear indications of this on the page. Adding alt text to images, providing a clear font size and color scheme, and ensuring sufficient contrast between background and foreground would improve the user experience for people with disabilities.\n", + "4. **Better calls-to-action (CTAs)**: The website could benefit from more prominent CTAs, guiding users towards specific actions such as signing up for courses or following Edward on social media.\n", + "5. **SEO optimization**: The website's content and meta tags appear to be optimized for search engines, but a more thorough SEO analysis would help identify areas for improvement.\n", + "\n", + "Overall, the website provides a clear overview of Edward Donner's interests and expertise in AI and LLMs, but could benefit from some tweaks to improve accessibility, navigation, and CTAs.\n" + ] + } + ], + "source": [ + "# The call\n", + "summarizer_bot()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From d7cf761930e56a54a0592272795bb61be858988e Mon Sep 17 00:00:00 2001 From: Oluwaseyi-A <62573285+Oluwaseyi-A@users.noreply.github.com> Date: Fri, 29 Aug 2025 18:20:26 -0400 Subject: [PATCH 21/25] Added week 5 challenge to community-contributions --- .../RAG-based-academic-assistant-v3.ipynb | 409 ++++++++++++++++++ 1 file changed, 409 insertions(+) create mode 100644 week5/community-contributions/RAG-based-academic-assistant-v3.ipynb diff --git a/week5/community-contributions/RAG-based-academic-assistant-v3.ipynb b/week5/community-contributions/RAG-based-academic-assistant-v3.ipynb new file mode 100644 index 0000000..7899ff8 --- /dev/null +++ b/week5/community-contributions/RAG-based-academic-assistant-v3.ipynb @@ -0,0 +1,409 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "97a93fee-6bbd-477b-aba8-577d318a9f9d", + "metadata": {}, + "source": [ + "# AI-Powered Academic Knowledge Assistant\n", + "AI-powered RAG (Retrieval-Augmented Generation) system that transforms document collections into queryable knowledge bases using OpenAI embeddings and vector search. Features configurable chunking, file size limits, and retrieval parameters with a Gradio interface for processing PDFs and generating contextually-aware responses via LangChain and ChromaDB." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3589eee0-ce34-42f4-b538-b43f3b0d9f6f", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "import glob\n", + "from dotenv import load_dotenv\n", + "import gradio as gr\n", + "import shutil\n", + "import tiktoken\n", + "import time\n", + "import uuid\n", + "from typing import List, Tuple, Optional\n", + "\n", + "# imports for langchain and Chroma\n", + "from langchain.document_loaders import DirectoryLoader, TextLoader, PyPDFLoader\n", + "from langchain.text_splitter import CharacterTextSplitter\n", + "from langchain.schema import Document\n", + "from langchain_openai import OpenAIEmbeddings, ChatOpenAI\n", + "from langchain_chroma import Chroma\n", + "from langchain.memory import ConversationBufferMemory\n", + "from langchain.chains import ConversationalRetrievalChain\n", + "from langchain.embeddings import HuggingFaceEmbeddings\n", + "\n", + "from langchain_community.document_loaders import PyPDFLoader, TextLoader\n", + "from langchain.docstore.document import Document\n", + "\n", + "# Load environment variables\n", + "load_dotenv(override=True)\n", + "os.environ['OPENAI_API_KEY'] = os.getenv('OPENAI_API_KEY', 'your-key-if-not-using-env')\n", + "\n", + "# Global variables to store the current setup\n", + "current_vectorstore = None\n", + "current_conversation_chain = None\n", + "processing_status = \"\"\n", + "\n", + "def count_tokens(text: str, model: str = \"gpt-4o-mini\") -> int:\n", + " \"\"\"Count tokens in text using tiktoken\"\"\"\n", + " try:\n", + " encoding = tiktoken.encoding_for_model(model)\n", + " return len(encoding.encode(text))\n", + " except:\n", + " # Fallback estimation: roughly 4 characters per token\n", + " return len(text) // 4\n", + "\n", + "def filter_chunks_by_tokens(chunks: List[Document], max_total_tokens: int = 250000) -> List[Document]:\n", + " \"\"\"Filter chunks to stay within token limits\"\"\"\n", + " filtered_chunks = []\n", + " total_tokens = 0\n", + " \n", + " for chunk in chunks:\n", + " chunk_tokens = count_tokens(chunk.page_content)\n", + " \n", + " # Skip individual chunks that are too large (shouldn't happen with proper splitting)\n", + " if chunk_tokens > 8000: # Individual chunk limit\n", + " continue\n", + " \n", + " if total_tokens + chunk_tokens <= max_total_tokens:\n", + " filtered_chunks.append(chunk)\n", + " total_tokens += chunk_tokens\n", + " else:\n", + " break\n", + " \n", + " return filtered_chunks\n", + "\n", + "def add_metadata(doc, doc_type, file_path):\n", + " \"\"\"Add metadata including document type and file information\"\"\"\n", + " doc.metadata[\"doc_type\"] = doc_type\n", + " doc.metadata[\"file_path\"] = file_path\n", + " doc.metadata[\"file_name\"] = os.path.basename(file_path)\n", + " return doc\n", + "\n", + "def check_file_size(file_path, max_size_bytes):\n", + " \"\"\"Check if file size is within the limit\"\"\"\n", + " try:\n", + " file_size = os.path.getsize(file_path)\n", + " return file_size <= max_size_bytes, file_size\n", + " except OSError:\n", + " return False, 0\n", + "\n", + "def load_pdfs_with_size_limit(folder_path, doc_type, max_size_bytes):\n", + " \"\"\"Load PDF files from a folder with size restrictions\"\"\"\n", + " pdf_files = glob.glob(os.path.join(folder_path, \"**/*.pdf\"), recursive=True)\n", + " loaded_docs = []\n", + " skipped_files = []\n", + " \n", + " for pdf_file in pdf_files:\n", + " is_valid_size, file_size = check_file_size(pdf_file, max_size_bytes)\n", + " \n", + " if is_valid_size:\n", + " try:\n", + " loader = PyPDFLoader(pdf_file)\n", + " docs = loader.load()\n", + " docs_with_metadata = [add_metadata(doc, doc_type, pdf_file) for doc in docs]\n", + " loaded_docs.extend(docs_with_metadata)\n", + " except Exception as e:\n", + " skipped_files.append((pdf_file, f\"Loading error: {str(e)}\"))\n", + " else:\n", + " file_size_mb = file_size / 1024 / 1024\n", + " skipped_files.append((pdf_file, f\"File too large: {file_size_mb:.2f} MB\"))\n", + " \n", + " return loaded_docs, skipped_files\n", + "\n", + "def process_documents(knowledge_base_dir: str, max_file_size_mb: float, chunk_size: int, chunk_overlap: int) -> Tuple[str, str]:\n", + " \"\"\"Process documents and create vector store\"\"\"\n", + " global current_vectorstore, current_conversation_chain\n", + " \n", + " try:\n", + " # Validate directory\n", + " if not knowledge_base_dir or not knowledge_base_dir.strip():\n", + " return \"❌ Error: Please enter a directory path!\", \"\"\n", + " \n", + " directory_path = knowledge_base_dir.strip()\n", + " \n", + " if not os.path.exists(directory_path):\n", + " return \"❌ Error: Directory does not exist! Please check the path.\", \"\"\n", + " \n", + " # Configuration\n", + " MAX_FILE_SIZE_BYTES = int(max_file_size_mb * 1024 * 1024)\n", + " \n", + " # Find folders\n", + " if directory_path.endswith('*'):\n", + " folders = glob.glob(directory_path)\n", + " else:\n", + " folders = glob.glob(os.path.join(directory_path, \"*\"))\n", + " \n", + " if not folders:\n", + " return \"❌ Error: No folders found in the specified directory!\", \"\"\n", + " \n", + " # Process documents\n", + " documents = []\n", + " all_skipped_files = []\n", + " status_lines = []\n", + " \n", + " status_lines.append(f\"🔍 Processing folders with {max_file_size_mb} MB file size limit...\")\n", + " status_lines.append(\"-\" * 60)\n", + " \n", + " for folder in folders:\n", + " if os.path.isdir(folder):\n", + " doc_type = os.path.basename(folder)\n", + " status_lines.append(f\"📁 Processing folder: {doc_type}\")\n", + " \n", + " folder_docs, skipped_files = load_pdfs_with_size_limit(folder, doc_type, MAX_FILE_SIZE_BYTES)\n", + " documents.extend(folder_docs)\n", + " all_skipped_files.extend(skipped_files)\n", + " \n", + " if folder_docs:\n", + " status_lines.append(f\" ✅ Loaded {len(folder_docs)} document pages\")\n", + " if skipped_files:\n", + " status_lines.append(f\" ⚠️ Skipped {len(skipped_files)} files\")\n", + " \n", + " if not documents:\n", + " error_msg = \"❌ No PDF documents were loaded successfully.\"\n", + " if all_skipped_files:\n", + " error_msg += f\"\\n\\nAll {len(all_skipped_files)} files were skipped:\"\n", + " for file_path, reason in all_skipped_files[:10]: # Show first 10\n", + " error_msg += f\"\\n • {os.path.basename(file_path)}: {reason}\"\n", + " if len(all_skipped_files) > 10:\n", + " error_msg += f\"\\n ... and {len(all_skipped_files) - 10} more\"\n", + " return error_msg, \"\"\n", + " \n", + " # Text splitting\n", + " status_lines.append(\"\\n\" + \"=\"*40)\n", + " status_lines.append(\"✂️ TEXT SPLITTING\")\n", + " status_lines.append(\"=\"*40)\n", + " \n", + " text_splitter = CharacterTextSplitter(chunk_size=chunk_size, chunk_overlap=chunk_overlap)\n", + " chunks = text_splitter.split_documents(documents)\n", + " \n", + " # Filter chunks by token count to prevent API errors\n", + " status_lines.append(\"🔢 Checking token limits...\")\n", + " original_chunk_count = len(chunks)\n", + " chunks = filter_chunks_by_tokens(chunks, max_total_tokens=250000)\n", + " \n", + " if len(chunks) < original_chunk_count:\n", + " status_lines.append(f\"⚠️ Filtered from {original_chunk_count} to {len(chunks)} chunks to stay within token limits\")\n", + " \n", + " # Create vectorstore\n", + " status_lines.append(\"🧮 Creating vector embeddings...\")\n", + " embeddings = OpenAIEmbeddings()\n", + " \n", + " # Use a temporary database name\n", + " db_name = \"temp_vector_db\"\n", + " \n", + " # Delete if already exists\n", + " if os.path.exists(db_name):\n", + " shutil.rmtree(db_name)\n", + " \n", + " # Create vectorstore\n", + " vectorstore = Chroma.from_documents(\n", + " documents=chunks, \n", + " embedding=embeddings, \n", + " persist_directory=db_name\n", + " )\n", + " \n", + " # Update global variables\n", + " current_vectorstore = vectorstore\n", + " \n", + " # Create conversation chain\n", + " llm = ChatOpenAI(temperature=0.7, model_name=\"gpt-4o-mini\")\n", + " memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True)\n", + " retriever = vectorstore.as_retriever(search_kwargs={\"k\": 25})\n", + " current_conversation_chain = ConversationalRetrievalChain.from_llm(\n", + " llm=llm, \n", + " retriever=retriever, \n", + " memory=memory\n", + " )\n", + " \n", + " # Summary statistics\n", + " status_lines.append(\"\\n\" + \"=\"*40)\n", + " status_lines.append(\"📊 SUMMARY\")\n", + " status_lines.append(\"=\"*40)\n", + " status_lines.append(f\"✅ Total PDFs processed: {len(set(doc.metadata['file_path'] for doc in documents))}\")\n", + " status_lines.append(f\"📄 Total document pages: {len(documents)}\")\n", + " status_lines.append(f\"🧩 Total text chunks: {len(chunks)}\")\n", + " status_lines.append(f\"📁 Document types: {', '.join(set(doc.metadata['doc_type'] for doc in documents))}\")\n", + " status_lines.append(f\"🗃️ Vector store size: {vectorstore._collection.count()} embeddings\")\n", + " \n", + " if all_skipped_files:\n", + " status_lines.append(f\"\\n⚠️ Skipped files: {len(all_skipped_files)}\")\n", + " for file_path, reason in all_skipped_files[:5]: # Show first 5\n", + " status_lines.append(f\" • {os.path.basename(file_path)}: {reason}\")\n", + " if len(all_skipped_files) > 5:\n", + " status_lines.append(f\" ... and {len(all_skipped_files) - 5} more\")\n", + " \n", + " success_msg = \"✅ Knowledge base successfully created and ready for questions!\"\n", + " detailed_status = \"\\n\".join(status_lines)\n", + " \n", + " return success_msg, detailed_status\n", + " \n", + " except Exception as e:\n", + " error_msg = f\"❌ Error processing documents: {str(e)}\"\n", + " return error_msg, \"\"\n", + "\n", + "def chat_with_documents(message, history, num_chunks):\n", + " \"\"\"Chat with the processed documents\"\"\"\n", + " global current_conversation_chain, current_vectorstore\n", + " \n", + " if current_conversation_chain is None:\n", + " return \"❌ Please process documents first before asking questions!\"\n", + " \n", + " try:\n", + " # Update retriever with new chunk count\n", + " if current_vectorstore is not None:\n", + " retriever = current_vectorstore.as_retriever(search_kwargs={\"k\": num_chunks})\n", + " current_conversation_chain.retriever = retriever\n", + " \n", + " result = current_conversation_chain.invoke({\"question\": message})\n", + " return result[\"answer\"]\n", + " \n", + " except Exception as e:\n", + " return f\"❌ Error generating response: {str(e)}\"\n", + "\n", + "def reset_conversation():\n", + " \"\"\"Reset the conversation memory\"\"\"\n", + " global current_conversation_chain\n", + " if current_conversation_chain is not None:\n", + " current_conversation_chain.memory.clear()\n", + " return \"✅ Conversation history cleared!\"\n", + " return \"No active conversation to reset.\"\n", + "\n", + "# Create Gradio Interface\n", + "with gr.Blocks(title=\"AI-Powered Academic Knowledge Assistant\", theme=gr.themes.Soft()) as app:\n", + " gr.Markdown(\"# 🎓 AI-Powered Academic Knowledge Assistant\")\n", + " gr.Markdown(\"Transform your entire document library into an intelligent, searchable AI tutor that answers questions instantly.\")\n", + " \n", + " with gr.Tabs():\n", + " # Configuration Tab\n", + " with gr.Tab(\"⚙️ Configuration\"):\n", + " gr.Markdown(\"### 📁 Document Processing Settings\")\n", + " \n", + " gr.Markdown(\"💡 **Tip:** Copy and paste your folder path here. On mobile, you can use file manager apps to copy folder paths.\")\n", + " \n", + " with gr.Row():\n", + " with gr.Column():\n", + " knowledge_dir = gr.Textbox(\n", + " label=\"Knowledge Base Directory\",\n", + " value=r\"C:\\Users\\Documents\\Syllabi\\Georgia Tech\\Spring 22\\Microwave Design\",\n", + " placeholder=\"Enter or paste your document directory path\",\n", + " lines=1\n", + " )\n", + " \n", + " max_file_size = gr.Slider(\n", + " label=\"Max File Size (MB)\",\n", + " minimum=0.5,\n", + " maximum=50,\n", + " value=4,\n", + " step=0.5\n", + " )\n", + " \n", + " with gr.Column():\n", + " chunk_size = gr.Slider(\n", + " label=\"Chunk Size (characters)\",\n", + " minimum=200,\n", + " maximum=1500,\n", + " value=800,\n", + " step=100,\n", + " info=\"Smaller chunks = better token management\"\n", + " )\n", + " \n", + " chunk_overlap = gr.Slider(\n", + " label=\"Chunk Overlap (characters)\",\n", + " minimum=0,\n", + " maximum=300,\n", + " value=150,\n", + " step=25,\n", + " info=\"Overlap preserves context between chunks\"\n", + " )\n", + " \n", + " process_btn = gr.Button(\"🚀 Process Documents\", variant=\"primary\", size=\"lg\")\n", + " \n", + " with gr.Row():\n", + " status_output = gr.Textbox(\n", + " label=\"Status\",\n", + " lines=2,\n", + " max_lines=2\n", + " )\n", + " \n", + " detailed_output = gr.Textbox(\n", + " label=\"Detailed Processing Log\",\n", + " lines=15,\n", + " max_lines=20\n", + " )\n", + " \n", + " # Chat Tab\n", + " with gr.Tab(\"💬 Chat\"):\n", + " gr.Markdown(\"### 🤖 Ask Questions About Your Documents\")\n", + " \n", + " with gr.Row():\n", + " with gr.Column(scale=1):\n", + " num_chunks = gr.Slider(\n", + " label=\"Number of chunks to retrieve\",\n", + " minimum=1,\n", + " maximum=50,\n", + " value=25,\n", + " step=1\n", + " )\n", + " \n", + " reset_btn = gr.Button(\"🗑️ Clear Chat History\", variant=\"secondary\")\n", + " reset_output = gr.Textbox(label=\"Reset Status\", lines=1)\n", + " \n", + " with gr.Column(scale=3):\n", + " chatbot = gr.ChatInterface(\n", + " fn=lambda msg, history: chat_with_documents(msg, history, num_chunks.value),\n", + " type=\"messages\",\n", + " title=\"Academic Assistant Chat\",\n", + " description=\"Ask questions about your processed documents\"\n", + " )\n", + " \n", + " # Event handlers\n", + " process_btn.click(\n", + " fn=process_documents,\n", + " inputs=[knowledge_dir, max_file_size, chunk_size, chunk_overlap],\n", + " outputs=[status_output, detailed_output]\n", + " )\n", + " \n", + " reset_btn.click(\n", + " fn=reset_conversation,\n", + " outputs=reset_output\n", + " )\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9eb807e0-194b-48dd-a1e9-b1b9b8a99620", + "metadata": {}, + "outputs": [], + "source": [ + "app.launch(share=True, inbrowser=True)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 21fe2d9e2b13e6828f25626b33688ab613660fe0 Mon Sep 17 00:00:00 2001 From: Kartik Date: Sat, 30 Aug 2025 15:19:50 +0530 Subject: [PATCH 22/25] working with couple more tools --- week2/stock-api-day5.ipynb | 1013 ++++++++++++++---------------------- 1 file changed, 395 insertions(+), 618 deletions(-) diff --git a/week2/stock-api-day5.ipynb b/week2/stock-api-day5.ipynb index aadb3b9..8848482 100644 --- a/week2/stock-api-day5.ipynb +++ b/week2/stock-api-day5.ipynb @@ -10,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 170, "id": "b7bd1bd7-19d9-4c4b-bc4b-9bc9cca8bd0f", "metadata": {}, "outputs": [ @@ -33,7 +33,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 171, "id": "8b50bbe2-c0b1-49c3-9a5c-1ba7efa2bcb4", "metadata": {}, "outputs": [], @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 172, "id": "ba0ddc1a-c775-4ed3-9531-ed0c5799e87f", "metadata": {}, "outputs": [ @@ -60,7 +60,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "2025-08-29 02:28:59,653 [INFO] Logger initialized!\n" + "2025-08-30 15:05:58,159 [INFO] Logger initialized!\n" ] } ], @@ -80,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 173, "id": "747e8786-9da8-4342-b6c9-f5f69c2e22ae", "metadata": {}, "outputs": [ @@ -88,8 +88,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "2025-08-29 02:28:59,657 [INFO] OpenAI API Key exists and begins sk-proj-\n", - "2025-08-29 02:28:59,657 [INFO] FINNHUB_API_KEY exists!\n" + "2025-08-30 15:05:58,164 [INFO] OpenAI API Key exists and begins sk-proj-\n", + "2025-08-30 15:05:58,164 [INFO] FINNHUB_API_KEY exists!\n" ] } ], @@ -111,51 +111,100 @@ "else:\n", " logger.error(\"OpenAI API Key not set\")\n", " \n", - "MODEL = \"gpt-5-mini\"\n", + "MODEL = \"gpt-4.1-mini\" # not using gpt-5-mini as openai doesn't let you stream responses till you are a verified organisation :(\n", "openai = OpenAI()\n", "finnhub_client = finnhub.Client(api_key=FINNHUB_API_KEY)" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 174, "id": "ee3aaa9a-5495-42fd-a382-803fbfa92eaf", "metadata": {}, "outputs": [], "source": [ - "system_message = f\"\"\"\n", - "You are called \"TickerBot\", You are a helpful stock information assistant specializing in US stocks. You provide factual, educational information without investment advice. You have access to tools for:\n", - "- Stock symbol lookup\n", - "- Real-time quotes\n", - "- Company Financials\n", - "- Company News\n", - "- Market overview\n", + "system_message = f\"\"\"\n", + "You are \"TickerBot\" — a concise, factual, educational assistant specializing in U.S. stocks. \n", + "Your job: quickly and accurately explain stock and company information in plain English. NEVER give investment advice, buy/sell recommendations, or price predictions.\n", "\n", - "### **Core Principles**\n", - "**Educational Focus**: Explain financial metrics clearly and keep an educational tone.\n", - "**Factual**: NEVER give buy/sell advice or predictions.\n", - "**Accurate always**: If no data is available, inform the user in a friendly way. Always be accurate. If you don't know the answer, simply say so. Do not make up your own stock details information.\n", + "## PRIVACY ABOUT IMPLEMENTATION\n", + "- Do not reveal any internal implementation details to users. Never display or mention internal tool names, API names, developer notes, configured flags, date-range limits, or other system/developer constraints in user-facing replies.\n", + "- All runtime/tool constraints and capability detection are internal. Present only user-facing capabilities in plain language.\n", "\n", - "### **How to Handle Different Requests**\n", - "- For all temporal reasoning in this chat you can use `get_current_time()` tool to get time and then relative to current time you can proceed.\n", - "- When users mention companies, search for symbols with the tool `search_symbol()` else proceed directly if obvious match\n", - "- Try to search for news or data for only for a maximum of 1 month time range, else it becomes a lot of data to parse. If user asks for recent news just check the last 5 days from today; For example if today is 10-06-2025, use from=\"2025-06-05\", to=\"2025-06-10\"\n", + "## USER-FACING CAPABILITIES\n", + "- When asked \"What can you do?\", list only stock-relevant actions in plain language. Example reply:\n", + " \"I can look up tickers, show the latest quotes, provide key company financials and latest earnings details, summarize recent company or market headlines, and give a brief market overview.\"\n", + "- Do not list internal utilities or developer tools as user-facing capabilities.\n", "\n", - "**Market Overview Requests**:\n", - "- \"What's happening in the market?\" → Use `get_market_overview(\"general\")`\n", - "- Summarize all news stories with very brief analysis\n", + "## GENERAL PRINCIPLES\n", + "- Answer only what was asked for. \n", + "- Be brief, clear, and professional while still maintaining a warm tone. Use short paragraphs and one-line bullet explanations when requested.\n", + "- Return only what the system provides; do not invent, infer, or extrapolate unavailable data.\n", + "- Never offer or advertise any feature the environment does not actually support. Avoid offering attachments, direct downloads, or full-text article retrieval unless the system explicitly provides those outputs.\n", "\n", - "### **Error Handling**\n", - "- If symbol search fails: \"I couldn't find that company in US markets. Could you try a different name or provide the ticker symbol?\"\n", - "- If some information gathered from the tool call says unavailable or error do not present it to the user unless they had specifically asked for it. Present rest of the gathered information if any.\n", - "- If data is unavailable: \"Some data isn't available right now, but here's what I found...\"\n", - "- Stay helpful and suggest alternatives\n", - "\"\"\"" + "## Behavior Rules\n", + "- Stay professional and neutral at all times. \n", + "- Clarify only when user intent is ambiguous; never guess. \n", + "- Only disclose information the user explicitly requested. \n", + "- Never explain system limits (e.g., API ranges, date limits) ever. \n", + "- Summaries should be tight and relevant, not verbose. \n", + "\n", + "## NEWS & HEADLINES\n", + "- When interpreting date-related or temporal reasoning requests (e.g., “latest earnings,” “recent news,” “Q1 results”) Call `get_current_time` to determine the current date.\n", + "- Present news/headlines in concise bullet lines when requested. Default recent-window behavior is internal; do not describe or expose internal default windows or limits to the user.\n", + "- If the system only returns headlines/summaries, present those and do not offer to fetch full-text or additional ranges unless the user explicitly asks and the environment supports that action.\n", + "\n", + "## FOLLOW-UP & CLARIFYING QUESTIONS\n", + "- If no matching stock symbol is found, ask the user to clarify the name or ticker. Mention you only support U.S. stocks. If they confirm the symbol but no data exists, state that no results were found.\n", + "- Never append unsolicited menus, multi-choice lists, or repeated \"Would you like...\" prompts at the end of a normal reply.\n", + "- Ask a single direct clarifying question only when strictly necessary to fulfill the user's request (for example: ambiguous company name or missing ticker). That single question must be the final line of the reply.\n", + "- If the user's intent is clear, proceed and return results. Do not request confirmations or offer options unless required to complete the task.\n", + "\n", + "## MISSING-DATA / NOTE RULES\n", + "- Do NOT call out missing/unavailable single fields unless:\n", + " 1) the missing field was explicitly requested by the user; OR\n", + " 2) multiple (>1) key metrics required to answer the user's request are unavailable and their absence materially prevents a useful answer.\n", + "- If condition (1) or (2) applies, include at most one concise \"Note:\" line naming the specific missing field(s) and nothing else.\n", + "- Otherwise omit any comment about single, non-central missing fields.\n", + "\n", + "## ERROR HANDLING\n", + "- If a company/ticker cannot be found: \"I couldn't find that company on U.S. exchanges. Please provide the ticker or a clearer company name.\"\n", + "- If partial results are returned: present available data and at most one short note: \"Some data wasn't available: , .\"\n", + "- If you do not know the answer, say plainly: \"I don't have that information.\"\n", + "\n", + "## ADVICE / DISCLAIMER (CONDITIONAL)\n", + "- Do NOT include an investment-advice disclaimer in normal greetings or factual replies.\n", + "- Show a single-line disclaimer only when the user explicitly asks for recommendations/advice or uses clear advice-seeking language (e.g., \"should I buy\", \"recommend\", \"what should I do\", \"financial advice\").\n", + "- Disclaimer text when triggered: \"I can't provide investment advice or buy/sell recommendations. I can provide facts and explain metrics.\"\n", + "\n", + "EXAMPLES (templates — follow exactly)\n", + "\n", + "1) Clear factual request (no unsolicited follow-up)\n", + "User: \"What's AAPL last trade?\"\n", + "Assistant:\n", + "Last trade timestamp: 2025-08-28 20:00:00 UTC (U.S. market close — 4:00 PM ET)\n", + "\n", + "(—end: no menu, no offers—)\n", + "\n", + "2) Ambiguous request — single clarifying question only\n", + "User: \"Show me Apple\"\n", + "Assistant:\n", + "I found two matches. Do you mean Apple Inc. (AAPL) or Apple Hospitality REIT (APLE)?\n", + "\n", + "(—end: single question final line—)\n", + "\n", + "3) News returned as headlines only (do not offer unsupported fetches)\n", + "User: \"Recent NVDA news\"\n", + "Assistant:\n", + "- 2025-08-28: Headline A — short summary.\n", + "- 2025-08-26: Headline B — short summary.\n", + "(—end: do not offer full-article fetch or extended-range offers unless explicitly requested and supported—)\n", + "\"\"\"\n" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 175, "id": "fdf1a2b0-07be-47a0-9ce3-14d21b48c8f2", "metadata": {}, "outputs": [], @@ -177,7 +226,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 176, "id": "12d912fc-91fb-469e-9572-2876a099f5aa", "metadata": {}, "outputs": [], @@ -196,7 +245,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 177, "id": "61a2a15d-b559-4844-b377-6bd5cb4949f6", "metadata": {}, "outputs": [], @@ -238,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 178, "id": "173010e3-dfef-4611-8b68-d11256bd5fba", "metadata": {}, "outputs": [], @@ -265,7 +314,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 179, "id": "448bb4ce-8e86-4ceb-ab52-96bddfd33337", "metadata": {}, "outputs": [], @@ -323,7 +372,6 @@ "\n", " # --- API Call ---\n", " financials_resp = finnhub_client.company_basic_financials(symbol, \"all\")\n", - " logger.info(f\"Tool company_basic_financials {financials_resp}\")\n", "\n", " # Finnhub places primary values under \"metric\"\n", " metrics = financials_resp.get(\"metric\", {})\n", @@ -339,7 +387,6 @@ " \"Enterprise Value\": _format_big_number_from_millions(metrics.get(\"enterpriseValue\")),\n", " \"P/E Ratio (TTM)\": _safe_metric(metrics, \"peBasicExclExtraTTM\"),\n", " \"Forward P/E\": _safe_metric(metrics, \"forwardPE\"),\n", - " \"Revenue (TTM)\": _format_big_number_from_millions(metrics.get(\"revenueTTM\")),\n", " \"Gross Margin (TTM)\": _safe_metric(metrics, \"grossMarginTTM\"),\n", " \"Net Profit Margin (TTM)\": _safe_metric(metrics, \"netProfitMarginTTM\"),\n", " \"EPS (TTM)\": _safe_metric(metrics, \"epsTTM\"),\n", @@ -362,7 +409,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 180, "id": "9df7b74e-fec8-4e75-92a9-31acc75e6e97", "metadata": {}, "outputs": [], @@ -390,7 +437,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 181, "id": "cfeeb200-3f30-4855-82b9-cc8b2a950f80", "metadata": {}, "outputs": [], @@ -407,7 +454,6 @@ " \n", " symbol = symbol.strip().upper()\n", " data = finnhub_client.quote(symbol)\n", - " logger.info(f\"Tool get_stock_quote {data}\")\n", "\n", " if not data or \"c\" not in data:\n", " return {\"success\": False, \"error\": \"No quote data found\"}\n", @@ -437,7 +483,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 182, "id": "3724d92a-4515-4267-af6f-2c1ec2b6ed36", "metadata": {}, "outputs": [], @@ -462,14 +508,14 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 183, "id": "62f5d477-6626-428f-b8eb-d763e736ef5b", "metadata": {}, "outputs": [], "source": [ "def get_company_news(symbol: str, _from: str, to: str):\n", " \"\"\"\n", - " Fetch the top 5 latest company news for a stock symbol within a date range.\n", + " Fetch the top latest company news for a stock symbol within a date range.\n", " - Ensures the range does not exceed ~1 months (35 days).\n", " - Best practice: Keep searches to a month or less to avoid too much data.\n", "\n", @@ -501,7 +547,6 @@ " # Fetch data\n", " try:\n", " news = finnhub_client.company_news(symbol, _from=_from, to=to)\n", - " logger.info(f\"Tool get_company_news {news}\")\n", " except Exception as e:\n", " return {\"success\": False, \"error\": str(e)}\n", "\n", @@ -528,14 +573,14 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 184, "id": "5150ecb6-e3f1-46dc-94fa-2a9abe5165f6", "metadata": {}, "outputs": [], "source": [ "get_company_news_function = {\n", " \"name\": \"get_company_news\",\n", - " \"description\": \"Fetch the top 5 most recent company news articles for a given stock symbol. ⚠️ Avoid querying more than a 1-month range at a time as it may return too much data. Only tells news about company within last 1 year. An error is returned if the requested time range exceeds 1 month.\",\n", + " \"description\": \"Fetch the top most recent company news articles for a given stock symbol. ⚠️ Avoid querying more than a 1-month range at a time as it may return too much data. Only tells news about company within last 1 year. An error is returned if the requested time range exceeds 1 month.\",\n", " \"parameters\": {\n", " \"type\": \"object\",\n", " \"properties\": {\n", @@ -565,7 +610,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 185, "id": "26dd7375-626f-4235-b4a2-f1926f62cc5e", "metadata": {}, "outputs": [], @@ -573,7 +618,6 @@ "def get_market_news(category: str = \"general\"):\n", " \"\"\"\n", " Fetch the latest market news for a given category.\n", - " - Returns only the top 7 articles.\n", "\n", " Args:\n", " category (str): News category. One of [\"general\", \"forex\", \"crypto\", \"merger\"].\n", @@ -585,8 +629,8 @@ "\n", " try:\n", " news = finnhub_client.general_news(category)\n", - " logger.info(f\"Tool get_market_news {news}\")\n", " except Exception as e:\n", + " logger.error(f\"Tool get_market_news API call failed!\")\n", " return {\"success\": False, \"error\": str(e)}\n", "\n", " # Do not want to report just the latest news in the time period\n", @@ -605,7 +649,6 @@ " \"summary\": article.get(\"summary\"),\n", " \"source\": article.get(\"source\"),\n", " \"category\": article.get(\"category\"),\n", - " \"published_at\": datetime.utcfromtimestamp(article[\"datetime\"]).strftime(\"%Y-%m-%d %H:%M:%S UTC\"),\n", " \"related\": article.get(\"related\")\n", " })\n", "\n", @@ -614,7 +657,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 186, "id": "5bd1aa28-119c-4c7a-bdc0-161a582ab1cc", "metadata": {}, "outputs": [], @@ -639,19 +682,135 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 187, + "id": "fbe8ef6c-2d88-43a2-94dc-70b507fe9cd2", + "metadata": {}, + "outputs": [], + "source": [ + "def get_earnings_calendar(symbol: str = \"\", _from: str = \"\", to: str = \"\"):\n", + " \"\"\"\n", + " Fetch LATEST earnings calendar data for a stock symbol within a date range.\n", + " - End date must be within the last month. (Free tier only allows last 1 month data)\n", + " - Shows historical and upcoming earnings releases with EPS and revenue data.\n", + " Args:\n", + " symbol (str): Stock ticker (e.g., \"AAPL\"). Leave empty for all companies.\n", + " _from (str): Start date in YYYY-MM-DD format.\n", + " to (str): End date in YYYY-MM-DD format.\n", + " Returns:\n", + " list or dict: Cleaned earnings calendar data or error message.\n", + " \"\"\"\n", + " logger.info(f\"Tool get_earnings_calendar called for {symbol or 'all symbols'} from {_from} to {to}\")\n", + " \n", + " # Validate date format if provided\n", + " if _from or to:\n", + " try:\n", + " start_date = datetime.strptime(_from, \"%Y-%m-%d\") if _from else None\n", + " end_date = datetime.strptime(to, \"%Y-%m-%d\") if to else None\n", + " \n", + " # Check date range if both dates provided\n", + " # Check if end_date is within 1 month (≈30 days) of today\n", + " if end_date:\n", + " today = datetime.utcnow()\n", + " if (today - end_date).days > 30:\n", + " return {\n", + " \"success\": False,\n", + " \"error\": \"End date must be within the last month.\"\n", + " }\n", + " except ValueError:\n", + " return {\"success\": False, \"error\": \"Invalid date format. Use YYYY-MM-DD.\"}\n", + " \n", + " # Fetch earnings calendar data\n", + " try:\n", + " earnings_data = finnhub_client.earnings_calendar(_from=_from, to=to, symbol=symbol, international=False)\n", + " except Exception as e:\n", + " logger.error(f\"Error fetching earnings calendar: {e}\")\n", + " return {\"success\": False, \"error\": str(e)}\n", + " \n", + " # Check if data exists\n", + " if not earnings_data or \"earningsCalendar\" not in earnings_data:\n", + " return {\"success\": False, \"error\": \"No earnings data available for the specified criteria.\"}\n", + " \n", + " earnings_list = earnings_data[\"earningsCalendar\"]\n", + " \n", + " if not earnings_list:\n", + " return {\"success\": True, \"earnings\": [], \"message\": \"No earnings releases found for the specified period.\"}\n", + " \n", + " # Clean & transform earnings data\n", + " cleaned_earnings = []\n", + " for earning in earnings_list:\n", + " # Format hour description\n", + " hour_map = {\n", + " \"bmo\": \"Before Market Open\",\n", + " \"amc\": \"After Market Close\", \n", + " \"dmh\": \"During Market Hours\"\n", + " }\n", + " \n", + " cleaned_earnings.append({\n", + " \"symbol\": earning.get(\"symbol\"),\n", + " \"date\": earning.get(\"date\"),\n", + " \"quarter\": f\"Q{earning.get('quarter')} {earning.get('year')}\",\n", + " \"announcement_time\": hour_map.get(earning.get(\"hour\", \"\"), earning.get(\"hour\", \"Unknown\")),\n", + " \"eps_actual\": earning.get(\"epsActual\"),\n", + " \"eps_estimate\": earning.get(\"epsEstimate\"),\n", + " \"revenue_actual\": earning.get(\"revenueActual\"),\n", + " \"revenue_estimate\": earning.get(\"revenueEstimate\")\n", + " })\n", + " \n", + " return {\"success\": True, \"earnings\": cleaned_earnings}" + ] + }, + { + "cell_type": "code", + "execution_count": 188, + "id": "9eaeae75-d68f-4160-a26e-c13e40cf756b", + "metadata": {}, + "outputs": [], + "source": [ + "get_earnings_calendar_function = {\n", + " \"name\": \"get_earnings_calendar\",\n", + " \"description\": \"Fetch latest earnings calendar showing historical and upcoming earnings releases for companies. Shows EPS and revenue estimates vs actuals. End date must be within the last month.\",\n", + " \"parameters\": {\n", + " \"type\": \"object\",\n", + " \"properties\": {\n", + " \"symbol\": {\n", + " \"type\": \"string\",\n", + " \"description\": \"Stock ticker symbol, e.g., 'AAPL'. Leave empty to get earnings for all companies in the date range.\"\n", + " },\n", + " \"_from\": {\n", + " \"type\": \"string\", \n", + " \"description\": \"Start date in YYYY-MM-DD format. Ensure it is not more than 1 year ago from today. Ensure it is before or equal to the date in to.\"\n", + " },\n", + " \"to\": {\n", + " \"type\": \"string\",\n", + " \"description\": \"End date in YYYY-MM-DD format. Ensure it is not more than 1 year ago. Ensure it is after or equal to the date in from. To date must be within the last month.\"\n", + " }\n", + " },\n", + " \"required\": [\n", + " \"_from\",\n", + " \"to\"\n", + " ]\n", + " }\n", + "}\n", + "\n", + "get_earnings_calendar_tool = {\"type\": \"function\", \"function\": get_earnings_calendar_function}" + ] + }, + { + "cell_type": "code", + "execution_count": 189, "id": "bdca8679-935f-4e7f-97e6-e71a4d4f228c", "metadata": {}, "outputs": [], "source": [ "# List of tools:\n", - "tools = [search_symbol_tool, get_company_financials_tool, get_stock_quote_tool, get_company_news_tool, get_market_news_tool, get_current_time_tool]\n", + "tools = [search_symbol_tool, get_company_financials_tool, get_stock_quote_tool, get_company_news_tool, get_market_news_tool, get_current_time_tool, get_earnings_calendar_tool]\n", "tool_functions = {\n", " \"search_symbol\": search_symbol,\n", " \"get_company_financials\": get_company_financials,\n", " \"get_stock_quote\": get_stock_quote,\n", " \"get_company_news\": get_company_news,\n", " \"get_market_news\": get_market_news,\n", + " \"get_earnings_calendar\": get_earnings_calendar,\n", " \"get_current_time\": get_current_time\n", "}" ] @@ -672,7 +831,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 190, "id": "86f76f57-76c4-4dc7-94a8-cfe7816a39f1", "metadata": {}, "outputs": [], @@ -702,7 +861,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 191, "id": "ce9b0744-9c78-408d-b9df-9f6fd9ed78cf", "metadata": {}, "outputs": [], @@ -710,29 +869,87 @@ "def chat(message, history):\n", " messages = [{\"role\": \"system\", \"content\": system_message}] + history + [{\"role\": \"user\", \"content\": message}]\n", "\n", + " # Skip the first system message\n", + " to_log = messages[1:]\n", + "\n", + " # Print each dict on its own line\n", + " logger.info(\"\\nMessages:\\n\" + \"\\n\".join(str(m) for m in to_log) + \"\\n\")\n", + "\n", " while True:\n", - " # Send to OpenAI\n", - " response = openai.chat.completions.create(model=MODEL, messages=messages, tools=tools)\n", - " ai_message = response.choices[0].message\n", - " finish_reason = response.choices[0].finish_reason\n", - "\n", - " # If no tool calls, this is user-facing output\n", + " response = openai.chat.completions.create(\n", + " model=MODEL, \n", + " messages=messages, \n", + " tools=tools,\n", + " stream=True\n", + " )\n", + " \n", + " content = \"\"\n", + " tool_calls = []\n", + " finish_reason = None\n", + " \n", + " # Process the stream\n", + " for chunk in response:\n", + " choice = chunk.choices[0]\n", + " finish_reason = choice.finish_reason\n", + " \n", + " # Stream content\n", + " if choice.delta.content:\n", + " content += choice.delta.content\n", + " yield content\n", + " \n", + " # Collect tool calls\n", + " if choice.delta.tool_calls:\n", + " for tc_delta in choice.delta.tool_calls:\n", + " # Extend tool_calls list if needed\n", + " while len(tool_calls) <= tc_delta.index:\n", + " tool_calls.append({\n", + " \"id\": \"\",\n", + " \"function\": {\"name\": \"\", \"arguments\": \"\"}\n", + " })\n", + " \n", + " tc = tool_calls[tc_delta.index]\n", + " if tc_delta.id:\n", + " tc[\"id\"] = tc_delta.id\n", + " if tc_delta.function:\n", + " if tc_delta.function.name:\n", + " tc[\"function\"][\"name\"] = tc_delta.function.name\n", + " if tc_delta.function.arguments:\n", + " tc[\"function\"][\"arguments\"] += tc_delta.function.arguments\n", + " \n", + " # If no tool calls, we're done\n", " if finish_reason != \"tool_calls\":\n", - " return ai_message.content # ✅ Only return final assistant content\n", - "\n", - " # Otherwise, handle all tool calls in this message\n", + " return content\n", + " \n", + " # Execute tools\n", + " ai_message = {\n", + " \"role\": \"assistant\", \n", + " \"content\": content,\n", + " \"tool_calls\": [\n", + " {\n", + " \"id\": tc[\"id\"],\n", + " \"type\": \"function\",\n", + " \"function\": tc[\"function\"]\n", + " } for tc in tool_calls\n", + " ]\n", + " }\n", + " \n", " tool_responses = []\n", - " for tool_call in ai_message.tool_calls:\n", - " tool_responses.append(execute_tool_call(tool_call))\n", - "\n", - " # Add tool call request + tool responses to conversation\n", + " for tool_call in ai_message[\"tool_calls\"]:\n", + " # Convert dict back to object for your existing function\n", + " class ToolCall:\n", + " def __init__(self, tc_dict):\n", + " self.id = tc_dict[\"id\"]\n", + " self.function = type('obj', (object,), tc_dict[\"function\"])\n", + " \n", + " tool_responses.append(execute_tool_call(ToolCall(tool_call)))\n", + " \n", " messages.append(ai_message)\n", " messages.extend(tool_responses)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 192, "id": "f4be8a71-b19e-4c2f-80df-f59ff2661f14", "metadata": {}, "outputs": [ @@ -740,22 +957,22 @@ "name": "stderr", "output_type": "stream", "text": [ - "2025-08-29 02:29:05,739 [INFO] HTTP Request: GET http://127.0.0.1:7860/gradio_api/startup-events \"HTTP/1.1 200 OK\"\n", - "2025-08-29 02:29:05,746 [INFO] HTTP Request: HEAD http://127.0.0.1:7860/ \"HTTP/1.1 200 OK\"\n" + "2025-08-30 15:06:02,319 [INFO] HTTP Request: GET http://127.0.0.1:7871/gradio_api/startup-events \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:02,322 [INFO] HTTP Request: HEAD http://127.0.0.1:7871/ \"HTTP/1.1 200 OK\"\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "* Running on local URL: http://127.0.0.1:7860\n", + "* Running on local URL: http://127.0.0.1:7871\n", "* To create a public link, set `share=True` in `launch()`.\n" ] }, { "data": { "text/html": [ - "
" + "
" ], "text/plain": [ "" @@ -764,45 +981,120 @@ "metadata": {}, "output_type": "display_data" }, + { + "data": { + "text/plain": [] + }, + "execution_count": 192, + "metadata": {}, + "output_type": "execute_result" + }, { "name": "stderr", "output_type": "stream", "text": [ - "2025-08-29 02:29:07,097 [INFO] HTTP Request: GET https://api.gradio.app/pkg-version \"HTTP/1.1 200 OK\"\n", - "2025-08-29 02:29:17,018 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-29 02:29:17,024 [INFO] Executing tool: search_symbol with args: {'query': 'Apple'}\n", - "2025-08-29 02:29:17,025 [INFO] Tool search_symbol called for Apple\n", - "2025-08-29 02:29:17,777 [INFO] Tool search_symbol {'count': 11, 'result': [{'description': 'Apple Inc', 'displaySymbol': 'AAPL', 'symbol': 'AAPL', 'type': 'Common Stock'}, {'description': 'Apple Hospitality REIT Inc', 'displaySymbol': 'APLE', 'symbol': 'APLE', 'type': 'Common Stock'}, {'description': 'Apple iSports Group Inc', 'displaySymbol': 'AAPI', 'symbol': 'AAPI', 'type': 'Common Stock'}, {'description': 'Apple Flavor & Fragrance Group Co Ltd', 'displaySymbol': '603020.SS', 'symbol': '603020.SS', 'type': 'Common Stock'}, {'description': 'Maui Land & Pineapple Company Inc', 'displaySymbol': 'MLP', 'symbol': 'MLP', 'type': 'Common Stock'}, {'description': 'Apple International Co Ltd', 'displaySymbol': '2788.T', 'symbol': '2788.T', 'type': 'Common Stock'}, {'description': 'Applepark Co Ltd', 'displaySymbol': '164A.T', 'symbol': '164A.T', 'type': 'Common Stock'}, {'description': 'Pineapple Inc', 'displaySymbol': 'PNPL', 'symbol': 'PNPL', 'type': 'Common Stock'}, {'description': 'Pineapple Resources Bhd', 'displaySymbol': 'PINEAPP.KL', 'symbol': 'PINEAPP.KL', 'type': 'Common Stock'}, {'description': 'Pineapple Financial Inc', 'displaySymbol': 'PAPL', 'symbol': 'PAPL', 'type': 'Common Stock'}, {'description': 'Pineapple Energy Inc', 'displaySymbol': 'SUNE', 'symbol': 'SUNE', 'type': 'Common Stock'}]}\n", - "2025-08-29 02:29:19,090 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-29 02:29:19,096 [INFO] Executing tool: get_current_time with args: {}\n", - "2025-08-29 02:29:20,043 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-29 02:29:20,047 [INFO] Executing tool: get_stock_quote with args: {'symbol': 'AAPL'}\n", - "2025-08-29 02:29:20,049 [INFO] Tool get_stock_quote called for AAPL\n", - "2025-08-29 02:29:20,274 [INFO] Tool get_stock_quote {'c': 232.56, 'd': 2.07, 'dp': 0.8981, 'h': 233.41, 'l': 229.335, 'o': 230.82, 'pc': 230.49, 't': 1756411200}\n", - "2025-08-29 02:29:30,843 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-29 02:29:44,436 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-29 02:29:44,441 [INFO] Executing tool: get_current_time with args: {}\n", - "2025-08-29 02:29:46,801 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-29 02:29:46,806 [INFO] Executing tool: get_company_news with args: {'symbol': 'AAPL', '_from': '2025-08-21', 'to': '2025-08-28'}\n", - "2025-08-29 02:29:46,808 [INFO] Tool get_company_news called for AAPL from 2025-08-21 to 2025-08-28\n", - "2025-08-29 02:29:47,767 [INFO] Tool get_company_news [{'category': 'company', 'datetime': 1756408626, 'headline': 'Commentary: Trump’s trade war is hurting most sectors of the economy', 'id': 136563635, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The latest round of earnings reports revealed widespread damage from the Trump tariffs and other attacks on trade.', 'url': 'https://finnhub.io/api/news?id=f79d96aa415027377d39121c37660b242b4665192144f64a93b39b1515e24fdb'}, {'category': 'company', 'datetime': 1756405437, 'headline': 'Trump-Intel deal designed to block sale of chipmaking unit, CFO says', 'id': 136563640, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Trump administration’s investment in Intel was structured to deter the chipmaker from selling its manufacturing unit, its chief financial...', 'url': 'https://finnhub.io/api/news?id=f0e37125d1ccd2adc8afe9ffb145ccfa0dd2001cbd1d23eaf1c96270c33ab33f'}, {'category': 'company', 'datetime': 1756403740, 'headline': \"Apple–TSMC Chip Pact Builds Firewall Against Trump's Tariffs\", 'id': 136563655, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc (NASDAQ:AAPL) isn\\'t just building the iPhone 18—it\\'s creating a moat. By reportedly securing nearly half of Taiwan Semiconductor Manufacturing Co Ltd\\'s (NYSE:TSM) initial 2nm chip production capacity, Apple has locked in supply for its flagship device while also erecting a \"firewall\" against President Donald Trump\\'s proposed 100% tariffs on imported semiconductors. Track AAPL stock here. The move highlights how Apple\\'s scale, foresight, and U.S. investments could shield it from the pol', 'url': 'https://finnhub.io/api/news?id=080fa7ce38b3b44861946e6973f447bb280a79ea485c2b2f1ae11a938bbccd90'}, {'category': 'company', 'datetime': 1756401279, 'headline': \"What's Going On With Marvell Technology Stock Thursday?\", 'id': 136563649, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Marvell Technology (NASDAQ:MRVL) shares surged Thursday as investors bet on the company to deliver strong second-quarter results, scheduled for after the closing bell. Optimism has been fueled by accelerating demand for artificial intelligence infrastructure and expectations that Marvell will capture a growing share of hyperscale spending. The rally followed industry peer Nvidia’s (NASDAQ:NVDA) blockbuster results, which reinforced expectations of sustained demand from the artificial intelligenc', 'url': 'https://finnhub.io/api/news?id=4cf8c5984bf7ff829223fe47ee62f42082ee29a59dfa95d4b539bfe0fd0a423e'}, {'category': 'company', 'datetime': 1756400124, 'headline': 'Most of the Other Mag 7 Stocks Are Rising After Nvidia Earnings', 'id': 136563657, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'A group of Magnificent Seven stocks buoyed the S&P 500 after Nvidia earnings, but the chip titan wasn’t among them. The Dow was up 50 points, or 0.1%, while the Nasdaq Composite was up 0.5%. Nvidia shares were down 1% after moving up and down at the open.', 'url': 'https://finnhub.io/api/news?id=e89114f6041717edcc3ed7d65565eac2750bc512978233bdc8c6a18dae1bd6e0'}, {'category': 'company', 'datetime': 1756398112, 'headline': 'Stock Market Today: Nasdaq Up As Pure Storage Triggers Breakaway Buy; Nvidia Cuts Losses, Hormel Dives (Live Coverage)', 'id': 136560744, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Dow Jones index slips in mixed trade Thursday following surprise GDP numbers and jobless claims. Nvidia stock drops after earnings.', 'url': 'https://finnhub.io/api/news?id=58cb2ef567614c88ee8f9a823109d024b43d6de6c4d18baa9bd184de26c931bc'}, {'category': 'company', 'datetime': 1756397760, 'headline': \"A Small Cap In A Big Cap's Clothing\", 'id': 136563776, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1705316992/image_1705316992.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'AAPL is no longer the largest company in the world and now trails both Nvidia and Microsoft in terms of market cap. Click to read.', 'url': 'https://finnhub.io/api/news?id=e809d05668bd6be09e9fc420bf30d52521f1e6e4e7551f49911804ecf2247f3e'}, {'category': 'company', 'datetime': 1756397421, 'headline': 'Trump tariffs are increasingly forcing countries to pick sides between the US and China', 'id': 136560766, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'President Trump’s trade wars are increasingly forcing countries to choose between the US and its main adversaries.', 'url': 'https://finnhub.io/api/news?id=8177e96bbae4398135d97186f74049bba0d0eec4e76863edf5957488c9f737ff'}, {'category': 'company', 'datetime': 1756392896, 'headline': 'Evercore ISI Reiterates Outperform on Apple (AAPL) With $250 PT', 'id': 136560767, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc. (NASDAQ:AAPL) is one of the AI Stocks Analysts Say You Shouldn’t Ignore. On August 22, Evercore ISI reiterated the stock as “Outperform” stating that it likes Apple’s price hikes on Apple TV+. “We think the Apple TV+ price increases could help modestly on services growth, but the real intent is to minimize churn. Services […]', 'url': 'https://finnhub.io/api/news?id=fb1b0e9cc0f40efd15e9b2dfc73b8684dcae4a89f5ba687b678e90e707d05cfb'}, {'category': 'company', 'datetime': 1756391075, 'headline': 'MP Materials: The Defense Establishment Comes A-Calling', 'id': 136562702, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1428654585/image_1428654585.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'MP Materials is strategically positioned as a leading rare earth supplier amid rising US-China tensions and government focus on resource independence. Read the latest stock analysis here.', 'url': 'https://finnhub.io/api/news?id=1727d118f012c8bf42398a37c74b2b2ad9638666dd7efdf80539a5edee7fc302'}, {'category': 'company', 'datetime': 1756390634, 'headline': 'How Trump and Melania meme coins are performing half a year on', 'id': 136557610, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Both tokens launched before the US president's 20 January inauguration and quickly caught fire across crypto forums and political media.\", 'url': 'https://finnhub.io/api/news?id=80aa0488039ed175c0218e44a05e2ea529aed8fb9531d6015adb959f60044895'}, {'category': 'company', 'datetime': 1756389524, 'headline': 'Stock Market Today: Dow Slips, Nasdaq Rises After Surprise GDP, Jobless Claims; Nvidia Drops On Earnings (Live Coverage)', 'id': 136557573, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Dow Jones index slips in mixed trade Thursday following surprise GDP numbers and jobless claims. Nvidia stock drops after earnings.', 'url': 'https://finnhub.io/api/news?id=aecd19ed894e08a95a5c74ed51c36088b293dda61667fd30342cab56ee8a9c0a'}, {'category': 'company', 'datetime': 1756388700, 'headline': '2 Growth Stocks That Could Be Worth $1 Trillion in 5 Years', 'id': 136557612, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'These two longtime market leaders should continue to perform well.', 'url': 'https://finnhub.io/api/news?id=940ed0a9a05b5d73504f52a9a1da73f837f81ad32f7414fc2ea5ed355f0140fe'}, {'category': 'company', 'datetime': 1756387449, 'headline': \"This Overlooked Stock Market Sector is Getting Hot Ahead of the Fed's Expected September Rate Cut\", 'id': 136560763, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'How to track sector rotation in the market, and why old-school utilities are catching a tailwind after Powell’s speech.', 'url': 'https://finnhub.io/api/news?id=f0053dc1668970117d9f9fb0b6ef53faff354c6079b706205c54497955c19026'}, {'category': 'company', 'datetime': 1756386540, 'headline': \"If You'd Invested $1,000 in Apple Stock 5 Years Ago, Here's How Much You'd Have Today\", 'id': 136557613, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'You might be surprised to see how much your investment would be today.', 'url': 'https://finnhub.io/api/news?id=8c9acc794cd8b231a9233116a3dc9e994a56c1c3a82189d074108e98ab54d68b'}, {'category': 'company', 'datetime': 1756386000, 'headline': 'Avalon GloboCare to Launch Online Sales of KetoAir Breathalyzer in the United Kingdom', 'id': 136557614, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'FREEHOLD, N.J., Aug. 28, 2025 (GLOBE NEWSWIRE) -- Avalon GloboCare Corp. (“Avalon” or the “Company”) (NASDAQ: ALBT), a developer of precision diagnostic consumer products, today announced that it will launch the sales of KetoAir™ breathalyzer device and related accessories in the United Kingdom (“UK”). The products will be available for purchase starting September 1, 2025, at www.KetoAir.uk. KetoAir™ is a handheld breathalyzer designed for ketogenic health management (U.S. Food and Drug Administ', 'url': 'https://finnhub.io/api/news?id=e559b96b92a52447e682c0f47c53fa6a508e7398d5b3e5de911491454985d36e'}, {'category': 'company', 'datetime': 1756385063, 'headline': 'Market Chatter: Apple Warns UK Strategic Market Status Could Harm Users, Developers', 'id': 136557615, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple (AAPL) believes that Britain's plans to increase competition in the mobile operating system ma\", 'url': 'https://finnhub.io/api/news?id=16193e567e9dc751ddfab0787f451b0f6978ff34d2d52737bb037964cb3088cc'}, {'category': 'company', 'datetime': 1756383230, 'headline': 'The Swatch Group: Running Out Of Time', 'id': 136559852, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1791242549/image_1791242549.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Swatch Group struggles with smartwatch disruption, falling EPS, and weak demand. Learn about its challenges, risks, and potential value opportunities.', 'url': 'https://finnhub.io/api/news?id=ca5970ea6e8ed42a4e3691dca273ba9e121de29acb56336c9560a79eabb40437'}, {'category': 'company', 'datetime': 1756382877, 'headline': 'When will iPhone 17 be released? What features to expect? What to know in Tennessee', 'id': 136557616, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The newest iPhone is expected to be announced during a Sept. 9 event, meaning it could hit the market in the coming weeks.', 'url': 'https://finnhub.io/api/news?id=93b0e7100da77cd91b5a784d1f044e99eccd00657935413602ac3754d95e9341'}, {'category': 'company', 'datetime': 1756382470, 'headline': 'As Trump And Intel Make News, This Nvidia, AMD Partner Chips Away At A Breakout', 'id': 136557617, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'With the semiconductor industry in focus as Nvidia reports, the Trump administration takes a stake in Intel and TSMC stock etches a buy point.', 'url': 'https://finnhub.io/api/news?id=0639e7b2512036ffaa5f122e7bccb0a595e35b5f4a85fef22a1f742133d79902'}, {'category': 'company', 'datetime': 1756382400, 'headline': 'Get ready, EV owners: Here come the dongles', 'id': 136557728, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The transition from CCS to NACS will unlock thousands more fast chargers for many EV drivers, but they'll need to know their adapters to get the most out of it.\", 'url': 'https://finnhub.io/api/news?id=791f3b535a827c891140497cf89f87e37078b485a1c9d281692e6e62701cbbb6'}, {'category': 'company', 'datetime': 1756382400, 'headline': 'Could Buying MP Materials Today Set You Up for Life?', 'id': 136557618, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'MP Materials stock has surged over 300% in 2025. Can it keep that up?', 'url': 'https://finnhub.io/api/news?id=cde8cb7b7e803b646fd2e21292c3e4b0908454b34eabfb4a04c9a2ad56b8a879'}, {'category': 'company', 'datetime': 1756382143, 'headline': 'Morgan Stanley Maintains Equalweight on Skyworks (SWKS), Cuts Price Target Amid Broadcom Content Loss', 'id': 136557619, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Skyworks Solutions, Inc. (NASDAQ:SWKS) ranks among the best 5G stocks to buy now. Morgan Stanley retained its Equalweight rating on Skyworks Solutions, Inc. (NASDAQ:SWKS) and reduced its price target from $68 to $65 on August 6. Based in part on Apple’s previous remarks, the research firm noticed that the supply chain for smartphones has outperformed […]', 'url': 'https://finnhub.io/api/news?id=dd93604c17d502c50685fcce411f0ad5afa787886bc30b3edeebde6530455293'}, {'category': 'company', 'datetime': 1756380630, 'headline': 'Apple says UK mobile market shake-up could harm users and developers', 'id': 136557620, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"LONDON -Apple said on Thursday Britain's plans to increase competition in the mobile operating system market could harm users and developers, and potentially force the company to share its technology with foreign competitors for free. Last month, Britain's competition regulator told Apple and Android-owner Google to be fairer in how they distribute apps on their mobile platforms, setting out possible interventions as it plans to designate the U.S. tech companies with strategic market status over their duopoly.\", 'url': 'https://finnhub.io/api/news?id=4586d9fb5c2a41f4c8105a80667c11835661ad496368946acf15b94c6272ad1d'}, {'category': 'company', 'datetime': 1756378650, 'headline': \"Tesla sales drop 40% across Europe in July as China's BYD sees jump\", 'id': 136557621, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Sales of Tesla cars have continued to decline across Europe, falling 40% in July, as Chinese rival BYD saw a surge in registrations in the region last month.', 'url': 'https://finnhub.io/api/news?id=46d0e09bc4cfda7fd65bf1f247e15ce13082d242766a227b93cc70e92bcf6bf2'}, {'category': 'company', 'datetime': 1756377360, 'headline': 'AGs attack deepfake porn payments', 'id': 136560769, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple, Visa and others must be “more aggressive” in banning payment authorization for nonconsensual deepfake content, state AGs told the companies.', 'url': 'https://finnhub.io/api/news?id=5b99f45abab1c5465df76ca6c27da2afd266ebef62599d480a55d33d7590e981'}, {'category': 'company', 'datetime': 1756376520, 'headline': \"12 Stocks Warren Buffett's Berkshire Hathaway Has Been Loading Up On in 2025\", 'id': 136557622, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Despite a few big stock sales, there have been a lot of additions to Berkshire's portfolio.\", 'url': 'https://finnhub.io/api/news?id=3d261fc0e50b40a48d492134da9a6984c463cd0ba69e573fa387ef3c50489f9f'}, {'category': 'company', 'datetime': 1756376229, 'headline': 'Apple (AAPL): Examining Valuation as AI Concerns and Product Launches Dominate Attention', 'id': 136557623, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple (AAPL) has always had a knack for capturing headlines, but lately, it’s been the company’s moves—or lack of moves—in artificial intelligence that are drawing outsized attention from investors. As Apple prepares for its upcoming product event with new iPhones and wearables expected, multiple reports suggest the tech giant is under mounting pressure to prove it can catch up in the AI race. Recent partnership talks and news of possible acquisitions only add to the drama, as the market...', 'url': 'https://finnhub.io/api/news?id=9a405abfbd5a198d23b48942eeaf8cd2758d491872dc294d2d477e168c22259c'}, {'category': 'company', 'datetime': 1756375801, 'headline': 'How Twilio’s (TWLO) Global RCS Launch Could Shape Its Messaging Platform and Customer Trust', 'id': 136557624, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Twilio recently announced the global general availability of Rich Communication Services (RCS) messaging, enabling more than 349,000 active customers to send branded, verified, and interactive messages across Android and iOS devices through its Programmable Messaging and Verify APIs. This launch, following Apple’s rollout of RCS support and expanding Twilio's reach across 20+ countries, positions the company to address rising messaging fraud by bolstering customer trust and enabling richer,...\", 'url': 'https://finnhub.io/api/news?id=ca2307c8e7be2ecfaff7e462350f223f2840e596cd366e3fe1573e6bd327b14b'}, {'category': 'company', 'datetime': 1756372500, 'headline': 'Prediction: 1 Artificial Intelligence (AI) Stock Will Be Worth More Than Palantir Technologies and Amazon Combined by 2030', 'id': 136557607, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Palantir is one of the most valuable software businesses in the world, while Amazon remains a trillion-dollar giant.', 'url': 'https://finnhub.io/api/news?id=fc96e4f9665522a0c22481cd146e66d9b5ce8ce2934077c86c504f0697260d9a'}, {'category': 'company', 'datetime': 1756370411, 'headline': 'Bitcoin price recovers as Nvidia earnings fuel risk appetite', 'id': 136557626, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'It came as the S&P 500 notched a record high and Nvidia delivered stronger-than-expected quarterly results, reinforcing investor appetite for risk assets.', 'url': 'https://finnhub.io/api/news?id=8c3119a8a72d87a448ff861e8e4d4b8619a0635371e0e3713c949308eb32f044'}, {'category': 'company', 'datetime': 1756368912, 'headline': 'LIVE: Wall Street and European stocks mixed as US GDP revised higher and weekly jobless claims fall', 'id': 136557627, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"US GDP grew at a 3.3% annualised pace last quarter, according to the government's second estimate.\", 'url': 'https://finnhub.io/api/news?id=94bd66317beaa9f8b873ea175cd746f9091c5c1fd8938424b2ca4e20259b5df2'}, {'category': 'company', 'datetime': 1756364760, 'headline': 'Zacks Investment Ideas feature highlights: Apple, Meta Platforms and DoorDash', 'id': 136557628, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple, Meta and DoorDash all smashed Q2 expectations with record-breaking growth, strong margins and bullish post-earnings momentum.', 'url': 'https://finnhub.io/api/news?id=753d4c569e19112422028eb00f371cfd015fbeeca321005775f91b9d77d6b158'}, {'category': 'company', 'datetime': 1756364400, 'headline': 'Apple accuses Britain of ‘EU-style’ crackdown', 'id': 136557629, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple has accused Britain’s competition watchdog of stifling growth with an “EU-style” crackdown on the iPhone maker.', 'url': 'https://finnhub.io/api/news?id=88bb9408c819df29b22469513d47540a5d54f0585fc8caf47ac8288a93fd41b8'}, {'category': 'company', 'datetime': 1756326420, 'headline': 'Apple Teases iPhone 17 Launch With Sept. 9 Showcase', 'id': 136541162, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Event to spotlight slimmer phone, new watches, AirPods and AI', 'url': 'https://finnhub.io/api/news?id=57f533b5c833e80c1d77f63268da8555521d3d5583d5684b46ac7036d8b0d570'}, {'category': 'company', 'datetime': 1756323780, 'headline': \"Warren Buffett's Berkshire Hathaway Trims Apple Stake, Again. What's the Deal?\", 'id': 136541163, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The massive conglomerate now has a cash hoard of $344 billion.', 'url': 'https://finnhub.io/api/news?id=7dc81e41b6376258c7eb512fa47525b93dbc56d436b9acee7318023adae6a69f'}, {'category': 'company', 'datetime': 1756320350, 'headline': 'Apple (AAPL) Buy Rating Maintained Ahead of Potential September Event', 'id': 136541164, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc. (NASDAQ:AAPL) is one of the AI Stocks Analysts Are Tracking Closely. On August 25, Bank of America reiterated the stock as “Buy” and acknowledged that even though there are reports that there is no official iPhone event yet scheduled on September 9 for Apple, investors should tone down their expectations for the next cycle […]', 'url': 'https://finnhub.io/api/news?id=36ef4b48e9a75c5faaad802d9779733bd8eb0d2ed1aff058090ccf2ffbf76544'}, {'category': 'company', 'datetime': 1756317830, 'headline': 'Chipolo, an AirTag rival, debuts rechargeable trackers with a six-month battery life', 'id': 136541165, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Chipolo debuts a lineup of rechargeable trackers to compete with AirTag and others.', 'url': 'https://finnhub.io/api/news?id=058e82cd659bfbb73fd85321d63d0825a8cd02ec4774a2cb53eda240bbffd98d'}, {'category': 'company', 'datetime': 1756315800, 'headline': '[Latest] Global Motion Graphics Market Size/Share Worth USD 280 Billion by 2034 at a 12.2% CAGR: Custom Market Insights (Analysis, Outlook, Leaders, Report, Trends, Forecast, Segmentation, Growth Rate, Value, SWOT Analysis)', 'id': 136539413, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': '[220+ Pages Latest Report] According to a market research study published by Custom Market Insights, the demand analysis of Global Motion Graphics Market size & share revenue was valued at approximately USD 85.5 Billion in 2024 and is expected to reach USD 98.3 Billion in 2025 and is expected to reach around USD 280 Billion by 2034, at a CAGR of 12.2% between 2025 and 2034. The key market players listed in the report with their sales, revenues and strategies are Adobe Inc., Autodesk Inc., Maxon', 'url': 'https://finnhub.io/api/news?id=e6f397e64732b302a0646b559119b00c38feacf9f0c5daffee527ec2fb030208'}, {'category': 'company', 'datetime': 1756315645, 'headline': 'Pfizer: Finally Some Fortune, Plus Twenty High-Quality Dividend Growth Valuations', 'id': 136542130, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2203006359/image_2203006359.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"Discover high-quality dividend-growth stocks near 52-week lows. Explore Pfizer's strong dividend and valuations, plus other top picks like Merck and Qualcomm.\", 'url': 'https://finnhub.io/api/news?id=ec425284e980cf083d7d06feec4294590bc48a5d33b2fdd798c828b58de26570'}, {'category': 'company', 'datetime': 1756312967, 'headline': \"Cracker Barrel logo debacle isn't CEO Julie Masino's only challenge: Opening Bid top takeaway\", 'id': 136538441, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Cracker Barrel has a host of issues.', 'url': 'https://finnhub.io/api/news?id=5d954f41f3cbb1bd20135e12731d5043295f6c7a22381c604c77986feb3e3dd7'}, {'category': 'company', 'datetime': 1756310381, 'headline': 'The Gap Between Nvidia and the Next Largest Company Is Now $700 Billion', 'id': 136539403, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Nvidia's market capitalization stood at about $4.4 trillion this week, about $700 billion ahead of the next most valuable company, Microsoft. The gap between the AI chip giant and the next largest public company has never been wider, according to Dow Jones Market Data.\", 'url': 'https://finnhub.io/api/news?id=f9ce19a19e80e96971dc5bb4e5998b4f73764cfdb89fda81e2cd7672edc77884'}, {'category': 'company', 'datetime': 1756308600, 'headline': 'Q2 Earnings: These 3 Tech Stocks Shattered Expectations', 'id': 136539416, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The 2025 Q2 earnings cycle is nearing its end, with these three companies' results stealing the spotlight. Can they repeat their stellar performances in the Q3 season?\", 'url': 'https://finnhub.io/api/news?id=c8908ad4d0110207fd887b4cbe53973de66b66981914f3ae3f421964cfd4e39d'}, {'category': 'company', 'datetime': 1756305529, 'headline': 'How Apple investors should weigh India tariffs & ongoing AI lag', 'id': 136539417, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple (AAPL) is ramping up production at five factories in India ahead of its iPhone 17 launch, all while facing new 50% tariffs from the US on Indian goods. Yahoo Finance Senior Reporter Ines Ferré and Slatestone Wealth chief market strategist Kenny Polcari, who is also the host of Yahoo Finance's Trader Talk podcast, join Opening Bid host Brian Sozzi to weigh in on the headline risk to Apple. To watch more expert insights and analysis on the latest market action, check out more\\xa0Opening Bid.\", 'url': 'https://finnhub.io/api/news?id=f985e17b57b8661a44209cdab0364c36ab40feed82fbacbada76d466df119581'}, {'category': 'company', 'datetime': 1756303740, 'headline': 'Apple Music Taps TuneIn to Expand Global Access to Its Live Radio Stations', 'id': 136539418, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Beginning today, listeners around the world can stream all six commercial-free Apple Music live radio stations on TuneIn SAN FRANCISCO, Aug. 27, 2025 (GLOBE NEWSWIRE) -- TuneIn, the world’s leader in live audio, today announced a new partnership with Apple to expand access to Apple Music’s commercial-free live radio stations to listeners around the world. This marks the first time Apple’s 24/7 global radio stations are available outside of its own native platform. Starting today, all six free Ap', 'url': 'https://finnhub.io/api/news?id=e0413ec85f8c3aca11dd19d3b50b0f1680a6191a99c9e1760725d09871ab2e5f'}, {'category': 'company', 'datetime': 1756302300, 'headline': 'My 3 Favorite Stocks to Buy Right Now', 'id': 136536616, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Contrary to a common assumption at this time, not every stock is priced too richly or poses too much risk. Several underappreciated and undervalued names are just waiting to be found.', 'url': 'https://finnhub.io/api/news?id=5c9c5ad47420d627cfdffdc181bb0a20b74931b5b9a4ee6e4b598a7fe15ffe94'}, {'category': 'company', 'datetime': 1756300020, 'headline': 'COLLEGE FOR CREATIVE STUDIES LAUNCHES APPLE FOUNDATION PROGRAM, FREE CODING COURSES FOR DETROITERS', 'id': 136536132, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Apple Foundation Program at CCS will welcome its first cohort in October 2025, offering a free introductory app development course with access to laptops and additional devices. CCS Apple Foundation Lab Courtesy of College for Creative Studies CCS Apple Foundation Lab Courtesy of College for Creative Studies Detroit, MI, Aug. 27, 2025 (GLOBE NEWSWIRE) -- The College for Creative Studies (CCS) is excited to launch the Apple Foundation Program, a free app development program coming to the Coll', 'url': 'https://finnhub.io/api/news?id=c39f266620c5451aea0891907dfe081dc8bad553e13b1175be1a2c1955a20968'}, {'category': 'company', 'datetime': 1756299600, 'headline': 'Apple Makes Music Push in Radio After Losing Ground to Spotify', 'id': 136539420, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The deal with digital radio platform TuneIn marks the first time Apple Music’s six radio stations will be available outside the company’s app.', 'url': 'https://finnhub.io/api/news?id=2b3af74ab5be8c92b9fc60e9ddf9ea2316e2a7b47b4705db59639bc775ff1581'}, {'category': 'company', 'datetime': 1756299600, 'headline': 'ESR to Unveil Game-Changing Tech Innovations at IFA 2025', 'id': 136536133, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'ESR, a global tech brand trusted by over 123 million users, will present its newest innovations at IFA 2025 from September 5–9 at Messe Berlin. Guided by its mission \"Tech Made Easier,\" ESR is set to unveil industry-first accessories that deliver wired-speed magnetic charging, stronger device protection, and more flexible productivity.', 'url': 'https://finnhub.io/api/news?id=ab2ce5abbf3516bc95c82979500217ce98402582a6083375f7b1edb7e0e92ab8'}, {'category': 'company', 'datetime': 1756298700, 'headline': 'Billionaire Bill Ackman Just Bought This Magnificent Artificial Intelligence (AI) Stock, Which Could Join Nvidia, Microsoft, and Apple in the $3 Trillion Club By 2028', 'id': 136536103, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Ackman\\'s hedge fund, Pershing Square, recently added another \"Magnificent Seven\" stock to its portfolio.', 'url': 'https://finnhub.io/api/news?id=0dcbb9593b57a4f988911c73d340dec2c9ee67cf5fe2dc86402a13ec133409be'}, {'category': 'company', 'datetime': 1756298544, 'headline': 'MetaMask Adds Google and Apple Login to Simplify Self-Custodial Wallet Access', 'id': 136536135, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'MetaMask has launched social login functionality, allowing users to create and recover self-custodial wallets using Google or Apple accounts, eliminating the need to manually manage traditional 12-word Secret Recovery Phrases while preserving complete user control over private keys. The feature combines familiar Web2 authentication with advanced cryptographic techniques, including Threshold ...', 'url': 'https://finnhub.io/api/news?id=fefb7a0bd947b9ea884c2ad78bba45b797bbc2fe6e7e419fbc1f41f9bc40b0fe'}, {'category': 'company', 'datetime': 1756297975, 'headline': 'Alphabet At The Crossroads: Legal Minefield Or Money Machine', 'id': 136538321, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/872409924/image_872409924.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Alphabet faces antitrust risk, but a breakup could unlock hidden value.', 'url': 'https://finnhub.io/api/news?id=94344a89f867ac85036a39124e9fd93cc16cff445838394e0d8c309e5273eceb'}, {'category': 'company', 'datetime': 1756295929, 'headline': 'Microsoft vs. Apple: Which Stock Has Performed Better Since Trump Took Office?', 'id': 136536116, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple and Microsoft stocks have surged—but which one performed better? See how these tech giants stack up during Trump’s second term so far.', 'url': 'https://finnhub.io/api/news?id=854230d76b6fd36b2a4ae52e69d5f5bec794619ea75e004e447c9a78ffa760ca'}, {'category': 'company', 'datetime': 1756295100, 'headline': 'As Warren Buffett Continues to Trim Apple Stake, Should Investors Be Worried?', 'id': 136536137, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple now comprises 21% of Berkshire's closely monitored equity portfolio.\", 'url': 'https://finnhub.io/api/news?id=5d982d0ed73fdda2a4280275c09cefba88552b34a1299052e0f5263e263ba3a5'}, {'category': 'company', 'datetime': 1756291928, 'headline': 'What happens to your pension if your relationship ends?', 'id': 136536138, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"If there's an overreliance on one partner’s pension and you end up breaking up you could find yourself close to retirement with little in the way of income.\", 'url': 'https://finnhub.io/api/news?id=c3f07c39e3f7a9bf94894372a3977c0b5aad0f22174af5931a31c0f99e318f63'}, {'category': 'company', 'datetime': 1756291569, 'headline': \"Tesla Stock 'Could Fall 90% Tomorrow,' Fund Manager Still Won't Buy — Here's Where He's Investing Instead\", 'id': 136536120, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Tesla Inc (NASDAQ:TSLA) stock has fallen 8% year-to-date in 2025 and some investors and analysts believe the stock remains overvalued with more room to fall. One of the top-performing fund managers thinks Tesla stock could have significant downside ...', 'url': 'https://finnhub.io/api/news?id=434f7927d77afa8219186d9fdcb67ead90bbb30935a3a8e8f48580f5bcbf65a1'}, {'category': 'company', 'datetime': 1756291392, 'headline': 'AI Weekly: grouchy Grok and the wizard of bots', 'id': 136536140, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"STORY: From why Elon Musk says Apple is being mean to Grok, to how bots reinvented the Wizard of Oz, this is AI Weekly.:: AI Weekly:: Sphere Entertainment\\xa0Elon Musk’s xAI is suing Apple and OpenAI, claiming they conspired to thwart competition.He says they gave prominence to ChatGPT in Apple’s app store, while limiting the profile of his competing chatbot Grok.OpenAI said the case was just another example of what it called Musk’s “pattern of harassment”.Meta is set to back political candidates who back lighter regulation of AI.The Facebook parent says it will set up a California-focused political action committee to back state-level candidates from either party.It plans to spend tens of millions of dollars on the effort, potentially putting it among the state's top politicial spenders ahead of a 2026 governor race.\\xa0DeepSeek has unveiled an upgraded model that it says is can be optimised to work with Chinese chips.That may signal it’s positioned to work with the country’s own semiconductor makers, as Beijing pushes to reduce its reliance on U.S. tech.Earlier this year, DeepSeek shook the sector when it released an AI model able to compete with the likes of ChatGPT, but developed at much lower cost.:: Sphere EntertainmentAI has reimagined “The Wizard of Oz”.The famous film will be shown in Las Vegas on a towering spherical screen that surrounds viewers.AI tools preserve the original performances, but also add new elements.Ben Grossman is the boss of visual effects firm Magnopus:“We need to drastically increase the resolution and detail of the original movie, we need to complete the missing parts of the people who were cut off and then we need to create the continuity of the scene so that the performances that you know are there are actually there.”And Google focused on AI when unveiling its latest Pixel phones.:: Google\\xa0That includes a “coach” in the camera app that can help users take better pictures.There’s also an AI assistant that can display useful information before it’s even asked, such as showing a flight confirmation email when the user calls an airline.\", 'url': 'https://finnhub.io/api/news?id=2b6a4d8f83a26751f9c767abe00e26abbabfb1071fff7f699c0518d49891f5ce'}, {'category': 'company', 'datetime': 1756290780, 'headline': 'It’s Trump’s Market Now. How to Navigate Fed Threats, State Stock Buying, Economic Curveballs.', 'id': 136536141, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Trump escalates Fed fight, Apple teases product event next week, Cracker Barrel drops new logo, and more news to start your day.', 'url': 'https://finnhub.io/api/news?id=67a5e0f03199596b736b0f4d450d0b0f50f5413e3f39010b9f387d60351fe739'}, {'category': 'company', 'datetime': 1756288800, 'headline': 'The Best \"Magnificent Seven\" Stock to Buy Right Now, According to Wall Street (Hint: Not Nvidia)', 'id': 136536125, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Almost every analyst agrees this AI giant is a buy with plenty of upside left.', 'url': 'https://finnhub.io/api/news?id=d6cefbf6bd2b81a2d3edda7b925845062de2a510ca2d395594240036c0b0c4dc'}, {'category': 'company', 'datetime': 1756285332, 'headline': 'EU to Propose Removing US Tariffs This Week to Meet Trump Demand', 'id': 136539421, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The European Commission, which handles trade matters for the EU, will also give preferential tariff rates on certain seafood and agricultural goods, according to people familiar with the matter. The EU has conceded that the trade arrangement struck with Trump favors the US but that the accord is necessary to give businesses stability and certainty.', 'url': 'https://finnhub.io/api/news?id=612cccf472079a1f84ac02fea985ed07785463e11fce1542fde2df16313aa3ce'}, {'category': 'company', 'datetime': 1756285263, 'headline': 'Crypto Industry Unites Against Senate Bill Over Protections for Software Devs', 'id': 136536143, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Top crypto and tech groups said they would not support the Senate’s market structure bill without new language shielding developers from criminal liability.', 'url': 'https://finnhub.io/api/news?id=c1422933d13544e8a6ea15de880fcc0b45d85931f54e313abb4d5f1d9dc447c4'}, {'category': 'company', 'datetime': 1756285020, 'headline': 'Prediction: This Unstoppable Vanguard ETF Will Keep Beating the S&P 500 Over the Long Term', 'id': 136536127, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The S&P 500 typically delivers strong long-term returns, but this Vanguard ETF has consistently outperformed it.', 'url': 'https://finnhub.io/api/news?id=de010cb83b6d643dc3697d4fcd9dee466c036b714ed688738a4d10e9b0ab9387'}, {'category': 'company', 'datetime': 1756284300, 'headline': 'Ben Graham Misquoted: The Stock Market Is Never A Weighing Machine', 'id': 136535891, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1329937320/image_1329937320.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"The stock market is not a weighing machine in the long run. Check out Graham's insights on why the stock market operates as a voting machine.\", 'url': 'https://finnhub.io/api/news?id=1f8e990b991e9dd7e08e7bbe07edf4020234609d120abc13241f0507716fe9e4'}, {'category': 'company', 'datetime': 1756282320, 'headline': 'The New Conversational Standard: Rich Communication Services Market Forecast Report 2025-2030, with Profiles of Google, Apple, Twilio, Sinch, Infobip, MessageBird, and GSMA', 'id': 136536145, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The RCS market is poised for rapid growth, driven by Apple\\'s RCS integration in iOS 18, unifying global users. Key opportunities lie in leveraging RCS Business Messaging for enhanced brand-consumer interaction, exploring high-growth regions like Asia-Pacific, and integrating RCS into digital strategies for MNOs, enterprises, and CPaaS providers.Dublin, Aug. 27, 2025 (GLOBE NEWSWIRE) -- The \"New Conversational Standard: Rich Communication Services (RCS) Market Analysis, RBM Opportunities, and Glo', 'url': 'https://finnhub.io/api/news?id=cdf9963e9810636d6dd5ad679403d87a7fe343bdfeb4099a71f0413bebce46b6'}, {'category': 'company', 'datetime': 1756281713, 'headline': 'FTSE 100 LIVE: Stocks mixed as UK energy prices set to rise more than expected', 'id': 136536146, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The increase kicks in at start of October, which campaigners say will mean another winter of relatively high energy bills.', 'url': 'https://finnhub.io/api/news?id=c651e4c616007403c5a8acfaffde18b8820eec9726a0ae66c4e971e13aadc1cf'}, {'category': 'company', 'datetime': 1756279166, 'headline': 'IMAX Corporation (IMAX) Signs Expansion Agreement with Apple Cinemas for New IMAX with Laser Systems', 'id': 136536147, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'With strong upside potential and significant hedge fund interest, IMAX Corporation (NYSE:IMAX) secures a spot on our list of the 10 Must-Buy Canadian Stocks to Invest in. A significant expansion agreement for five new IMAX with Laser systems around the United States was announced by IMAX Corporation (NYSE:IMAX) and Apple Cinemas on August 7, 2025, […]', 'url': 'https://finnhub.io/api/news?id=fbfd81ca0494903d8d382c281080e814876acca5f579b9bc868ceec4ef3aec61'}, {'category': 'company', 'datetime': 1756278300, 'headline': 'Parallels Launches Parallels Desktop 26 with Support for macOS Tahoe 26, Compatibility with Windows 11 25H2, and New IT Management Tools', 'id': 136536131, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The latest release introduces more secure VM management, accurate Mac disk visibility in Windows, renewed SOC 2 Type II compliance, and more simplified deployment and device management for enterprise IT teams Parallels Desktop 26 for Mac Parallels Desktop is the only Microsoft-authorized way to run Windows 11 on Macs with Apple silicon. Parallels Desktop for Mac Enterprise Edition Parallels Desktop 26 introduces powerful enterprise features, making it easier for IT teams to manage, monitor, and', 'url': 'https://finnhub.io/api/news?id=a16e2511406c745e43e1cbd4a820454a72f67143b38c49df587d7f919b067ee8'}, {'category': 'company', 'datetime': 1756274568, 'headline': 'Trump Slaps India With 50% Tariffs, Upending Ties With Modi', 'id': 136536149, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The new tariffs, the highest in Asia, took effect at 12:01 a.m. in Washington on Wednesday, doubling the existing 25% duty on Indian exports. The levies will hit more than 55% of goods shipped to the US — India’s biggest market — and hurt labor-intensive industries like textiles and jewelry the most. Key exports like electronics and pharmaceuticals are exempt, sparing Apple Inc.’s massive new factory investments in India for now.', 'url': 'https://finnhub.io/api/news?id=fe4f2d299dc86ea71bb917b7cd3ca3260f0913917841a08a8b2e61130f156555'}, {'category': 'company', 'datetime': 1756267201, 'headline': 'The Chinese gadget maker taking on Tesla and Apple', 'id': 136536150, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'An electric vehicle factory built by China’s largest smartphone maker has become a tourist attraction in Beijing, with visits to the company...', 'url': 'https://finnhub.io/api/news?id=4cd753b8caeb83784586d510ce431255fbfe91882b4713b02fb81661cecef582'}, {'category': 'company', 'datetime': 1756266829, 'headline': 'Can Apple’s (AAPL) AI Partnerships Revive Investor Sentiment?', 'id': 136536151, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc. (NASDAQ:AAPL) is one of the top stocks to buy and hold forever. Apple Inc. (NASDAQ:AAPL) is often seen as a textbook example of how to build and strengthen a moat over time. Its brand strength, device and services ecosystem lock-in, and customer loyalty enable it to generate recurring revenues, maintain strong pricing power, and consistently […]', 'url': 'https://finnhub.io/api/news?id=3ebfed59c2e2e7119d0b4077fd406bb25fd5f0e2ef25dbf50f73bd57e334546f'}, {'category': 'company', 'datetime': 1756263240, 'headline': 'The Most Overvalued Of Mag7: Why Apple Gets My Sell', 'id': 136534658, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1705316992/image_1705316992.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Apple is recognized as a leader, but execution lags. Click here to read more about AAPL stock and why it is rated as a Sell.', 'url': 'https://finnhub.io/api/news?id=1926506c568d5cc3875b9c40c9a3b211652036847eb5d504f84db226cf67ade7'}, {'category': 'company', 'datetime': 1756235481, 'headline': 'Alphabet Lands $10B Meta Cloud Deal--Is A Siri-Gemini Deal Close?', 'id': 136532253, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2210768067/image_2210768067.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"Alphabet Inc.'s Google Cloud lands a $10B Meta deal, challenging AWS and Azure. Click for my updated look at GOOGL stock and why I remain bullish.\", 'url': 'https://finnhub.io/api/news?id=86e5017e035d7aea11fa1ea7fec5b5fb9004d28101950c42bee1a638795926d5'}, {'category': 'company', 'datetime': 1756231255, 'headline': \"Apple Promises 'Awe Dropping' Event Sept. 9\", 'id': 136529950, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple announced Tuesday that it will hold its fall product launch event on Sept. 9, likely headlined by the iPhone 17 series handsets.', 'url': 'https://finnhub.io/api/news?id=eb6ebae095d68639321c7bc616ac6707bbdf8b06f84f539109f00dbba2859e61'}, {'category': 'company', 'datetime': 1756228823, 'headline': 'OMAH: A Berkshire Hathaway Copycat With A 15% Distribution Yield', 'id': 136531630, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1030142522/image_1030142522.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"OMAH ETF seeks 15% annual yield via covered calls on Berkshire's holdings, ideal for income investors. Click here to read my most recent analysis of OMAH.\", 'url': 'https://finnhub.io/api/news?id=58990138d8fe8d477a6838738136d46cb3da707c449f5d2bca585ad94a3798e7'}, {'category': 'company', 'datetime': 1756228320, 'headline': \"Can Strong Content Portfolio Drive Apple's Streaming Prospects?\", 'id': 136529951, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple TV+ hits record Emmy nods and box office success as Services revenues jump double digits despite tough streaming competition.', 'url': 'https://finnhub.io/api/news?id=24b80129567e08f81469955913d3e7c594cf01f50aca4b2796eda55dc206bf7a'}, {'category': 'company', 'datetime': 1756228268, 'headline': \"Elon Musk's xAI sues Apple, OpenAI over AI competition and App Store rankings\", 'id': 136529952, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Elon Musk's xAI filed a lawsuit against Apple and OpenAI in federal court, alleging the companies conspired to prevent competition in the market for artificial intelligence tools.\", 'url': 'https://finnhub.io/api/news?id=13d253c2491e234963d5e88a6cbbdf36bf22ffeebb0b00664a073e991643a738'}, {'category': 'company', 'datetime': 1756228243, 'headline': 'Apple product launch, Meta Super PAC, Trump & Cracker Barrel', 'id': 136529953, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Yahoo Finance's John Hyland tracks Tuesday's top moving stocks and biggest market stories in this Market Minute: Apple's (AAPL) upcoming fall product launch on Sept. 9, Meta (META) reportedly launching a Super PAC focused on artificial intelligence (AI), and President Trump weighing in on the new Cracker Barrel (CBRL) logo. Stay up to date on the latest market action, minute-by-minute, with Yahoo Finance's Market Minute.\", 'url': 'https://finnhub.io/api/news?id=35b93c4400f7b555a2910620d9bca12e0bd6cfaa86ba56d5de59646fba94d752'}, {'category': 'company', 'datetime': 1756226940, 'headline': 'Apple’s Annual Event Will Be Sept 9. What to Expect for the iPhone and AI.', 'id': 136529954, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple will host its annual product event on Sept. 9, the company said Tuesday. Investors and customers alike will be looking for announcements regarding the company’s next iPhone launch and artificial intelligence updates. The Apple event—almost always takes place in September—unveils what new products and updates the company will be launching in the weeks to follow.', 'url': 'https://finnhub.io/api/news?id=b5a5a400b786c4cc164f9ec881a2311d566332bdf548a2fc5818ef858d748573'}, {'category': 'company', 'datetime': 1756226127, 'headline': 'Not so fast: German court says Apple can’t call Watch carbon neutral', 'id': 136529955, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple's carbon neutral claims are undermined by the short-term nature of carbon credits used to support them, the court said.\", 'url': 'https://finnhub.io/api/news?id=83f2575c7a3b3ada4263ced904f915e73685c92c56a4c9b377936566bd926fdc'}, {'category': 'company', 'datetime': 1756225200, 'headline': 'More Volatility Ahead In This AI Bull Market', 'id': 136531096, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1388937775/image_1388937775.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Gary Vaughan from Daily Stock PicksÂ\\xa0on buying the dip, crypto long-term and why bonds might now be a once in a lifetime buy.', 'url': 'https://finnhub.io/api/news?id=02e88f1c840a10605837aa875c0e48f3a5667a8415226907fb48b5338249b884'}, {'category': 'company', 'datetime': 1756224432, 'headline': 'Apple to hold fall event on September 9, new iPhones expected', 'id': 136529956, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The event will be held at the Steve Jobs Theater at Apple's headquarters in Cupertino, California and serve as a showcase of the company's efforts to integrate artificial intelligence into its devices. Media reports have said Apple will also unveil a slimmer version of its latest iPhone, possibly branded as the iPhone Air, echoing its iPad Air and MacBook Air lines. The company is also expected to showcase new entry-level, high-end Apple Watches, upgraded iPad Pros and a faster version of the Vision Pro headset, Bloomberg News has reported recently.\", 'url': 'https://finnhub.io/api/news?id=2f9081e1f78dab4b8fd7ca3a839bced221a1007faee91a43904a3dc0b3927604'}, {'category': 'company', 'datetime': 1756224300, 'headline': 'Apple is holding its iPhone 17 event on September 9', 'id': 136529957, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Along with the iPhones, Apple will likely have updated the Apple Watch Series 11, Ultra 3, and SE 3. The Apple Watch Ultra 3 would be a notable update amid the trio, with a bigger screen and faster charging support.', 'url': 'https://finnhub.io/api/news?id=798c01eeaa99f2a20a2b540332738653ac0ab5e56bb56102f362eb33fba1f0b2'}, {'category': 'company', 'datetime': 1756222621, 'headline': \"GM's $1 billion bet on F1 rolls on with star driver pairing for Cadillac team\", 'id': 136526543, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'GM’s Cadillac F1 team unveiled its driver pairing for the 2026 season, when the Big Three automaker’s big bet on F1 begins.', 'url': 'https://finnhub.io/api/news?id=d5dadf0c2d424b03eb856d6fd5771083fd61b82952d49619bf7ac66d82ee49d5'}, {'category': 'company', 'datetime': 1756221211, 'headline': 'Attorneys general tell AI companies to protect kids', 'id': 136529944, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Attorneys general in a letter highlighted Meta's scandal over its recent AI chatbot policies allowing romantic conversations with minors\", 'url': 'https://finnhub.io/api/news?id=c80eac904cb211ce08b917cdbdb49c14b6e9716c160c11c91f1134b00dd02cf7'}, {'category': 'company', 'datetime': 1756220400, 'headline': '2 High-Conviction Picks For 7.73% Growth And 4.22% Yield Within A Dividend Portfolio', 'id': 136529227, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2188450078/image_2188450078.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"Through DPSTF and META, we increased Dividend Income Accelerator Portfolio's sector diversification and global exposure. Learn more about the portfolio here.\", 'url': 'https://finnhub.io/api/news?id=3452d5cd9b4cf8d4251a0ea48074df10fe22dad78a44764ff71b7843f2de36f2'}, {'category': 'company', 'datetime': 1756219920, 'headline': 'Apple has an AI problem — and a Google partnership could actually make things worse', 'id': 136541516, 'image': '', 'related': 'AAPL', 'source': 'MarketWatch', 'summary': 'Apple has an AI problem — and a Google partnership could actually make things worse', 'url': 'https://finnhub.io/api/news?id=872986dd4f00566feaa310ee2fa0ab6a465476060222213ade9a930c4715aea1'}, {'category': 'company', 'datetime': 1756219440, 'headline': 'The Zacks Analyst Blog Highlights Alphabet, Apple and Garmin', 'id': 136529960, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Alphabet expands its Pixel lineup with new smartphones, watches, and earbuds, but faces fierce competition from Apple's AI push and Garmin's health-focused wearables.\", 'url': 'https://finnhub.io/api/news?id=93db37c7152895bb7d2a2f3d8de26eb915baea8ac2eea26dc76b571b118beb92'}, {'category': 'company', 'datetime': 1756218652, 'headline': 'Trump vs. Lisa Cook and what it really means for the stock market: Opening Bid top takeaway', 'id': 136525458, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The battle is well underway.', 'url': 'https://finnhub.io/api/news?id=6db1fb4523672e793b334b0953a0e3e17809d60f1522dc0a42d6ec9943d2cf40'}, {'category': 'company', 'datetime': 1756218587, 'headline': \"'Sexualized' AI Chatbots Pose Threat to Kids, Warn Attorneys General in Letter\", 'id': 136529961, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'A coalition of 44 state attorneys general have written to 13 AI firms demanding they protect children from sexually suggestive chatbot content.', 'url': 'https://finnhub.io/api/news?id=beae4eff89cbbac582eebe5b2a564df1ab0402115fab0f6ec44b4adcd3948cb6'}, {'category': 'company', 'datetime': 1756217611, 'headline': 'Apple internally discussed buying Mistral, Perplexity, the Information reports', 'id': 136529962, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple has trailed rivals such as Alphabet's Google and Samsung in terms of roll-out of AI features in its devices. CEO Tim Cook signaled last month that Apple was open to larger AI-related acquisitions to accelerate its roadmap, a shift from its historically conservative M&A posture. Perplexity, which is backed by Nvidia and Amazon founder Jeff Bezos, said it is unaware of any merger conversations including the company, aside from its own acquisitions.\", 'url': 'https://finnhub.io/api/news?id=9238d3913f4ea061860ef4435dc0e5662ad535c650c489b04e155b56238db7e5'}, {'category': 'company', 'datetime': 1756217332, 'headline': \"Apple To Invest $2.5 Billion For This Company's Glass, Making Its Shares Jump\", 'id': 136525500, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'This fiber-optics stock is in a buy zone after a positive earnings report. Shares are up 40% so far this year.', 'url': 'https://finnhub.io/api/news?id=ff60a2ae2dd68824095f1deab9962e8de096976d954b3edb4561105d00e430c6'}, {'category': 'company', 'datetime': 1756216626, 'headline': 'Only 19 Companies Have More Money Than Elon Musk — Which Are Worth Investing In?', 'id': 136525463, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'These 19 companies top Elon Musk in wealth. See which ones could be solid picks for your investment portfolio.', 'url': 'https://finnhub.io/api/news?id=4905c4e94e17d8585183949d95e9c37c7ddbc86c60581365e44ab2c72bd56384'}, {'category': 'company', 'datetime': 1756216248, 'headline': 'Trump vows retaliation against countries with digital rules targeting US tech', 'id': 136525502, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Trump administration has long held the EU’s tech regulations in contempt.', 'url': 'https://finnhub.io/api/news?id=486e26a45bbbc11a274fd4612cdc325097aa3e314abca130893d90e6cf31b151'}, {'category': 'company', 'datetime': 1756206060, 'headline': 'Apple’s August Stock Revival Gives Hope to Concerned Investors', 'id': 136524134, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Shares of the tech giant entered August down 17% for the year due in part to concerns about the impact of President Donald Trump’s sweeping levies, which cost the company $800 million in its fiscal third quarter alone. The US president has long criticized Apple for its reliance on overseas production partners, at one point even threatening to punish the company with tariffs if it didn’t make its iPhones in the US. Then, at an event in the Oval Office on Aug. 6, Apple Chief Executive Officer Tim Cook committed to spending an additional $100 billion on manufacturing in the US.', 'url': 'https://finnhub.io/api/news?id=d4af929538b268228162d9bd3115adb945972a5278888c20ddcf0732ece89dc8'}, {'category': 'company', 'datetime': 1756215276, 'headline': \"Is the tide turning on the AI boom's myth of destiny?\", 'id': 136525465, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'For over a year, AI was gospel. Now, Wall Street, Silicon Valley, and regulators are asking the same question: What if it’s not?', 'url': 'https://finnhub.io/api/news?id=c93c2e83ece71b1b0d6f6ea8daae7246a98738e2c7aad1a53853d61b079ea23b'}, {'category': 'company', 'datetime': 1756215114, 'headline': 'Apple: Breakdown Of $600B Investment Commitment (Rating Downgrade)', 'id': 136527045, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1705316992/image_1705316992.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"Apple's $600B US investment bolsters supply chain resilience, AI growth, and govt ties, minimizing risks.\", 'url': 'https://finnhub.io/api/news?id=001db74a945b3e627a70dce9199b32d4b815fdf4e9e58c7354aa60e4eb00f8ef'}, {'category': 'company', 'datetime': 1752586675, 'headline': 'S&P 500 stocks: List of additions and removals in 2025', 'id': 135946875, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'These stocks have been added or removed from the S&P 500 this year.', 'url': 'https://finnhub.io/api/news?id=c82b8aa916b7627eff6a48b9619bcb02464992951170719c78e81c3c1e3cd758'}, {'category': 'company', 'datetime': 1756214040, 'headline': 'Trump Takes Aim at Digital Taxes. What It Means for Tech Stocks.', 'id': 136525506, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Digital taxes largely hit U.S. firms such as Google-parent Alphabet, retailer Amazon, and Facebook-parent Meta.', 'url': 'https://finnhub.io/api/news?id=75278f14b5dfe4ab92541fb57c79de69ac9768b17c951ff637fe0d3865c3e459'}, {'category': 'company', 'datetime': 1756213680, 'headline': 'Atomic Data Expands Leadership Team', 'id': 136525507, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Additions Will Accelerate Growth Across Three Operating CompaniesMINNEAPOLIS, Aug. 26, 2025 (GLOBE NEWSWIRE) -- Atomic Data, a leading IT services provider and technology teammate, has announced two key leadership appointments that reinforce its long-term strategic vision and strengthen its shared services operating model. Jay Bozicevich, a three-decade veteran of the financial services industry, will step into the dual roles of President of Atomic Data and Chief Operating Officer of Shared', 'url': 'https://finnhub.io/api/news?id=cf6f397f00502ab95b260e3bef757f58fa106e5105c39e77df9b8e0bd803d1ee'}, {'category': 'company', 'datetime': 1756213200, 'headline': 'Level Launches Level Lock Pro: The Ultimate Blend of Design, Performance, and Security', 'id': 136525508, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'REDWOOD CITY, Calif., August 26, 2025--Level, the company that redefined smart home today introduces Level Lock Pro, the ultimate in smart home performance, security and design. Level Lock Pro provides enhanced performance, security, and features such as door status detection to show when a door is left open, all while retaining the same award-winning invisible design Level is known for. There has never before been a smart lock that packs so much technology in the footprint of a traditional dead', 'url': 'https://finnhub.io/api/news?id=ba6aaa945fdf72d7b0ff6ec45454b30944831abf27e68bd11de8db5b8c1fa58e'}, {'category': 'company', 'datetime': 1756212744, 'headline': 'Apple Loses German Case On Green Marketing Pledge', 'id': 136525509, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple Watch can't be advertised as CO?-neutral, court rules\", 'url': 'https://finnhub.io/api/news?id=2ce75c880408058d8a276d83753fe01903ac146b8c6b12ab0e798d1b2418f5b2'}, {'category': 'company', 'datetime': 1756212272, 'headline': 'EU Defends Digital Taxes After Trump Calls Them Unfair on US', 'id': 136525510, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': '“It’s the sovereign right of the EU and its member states to regulate our economic activities on our territory that are consistent with our democratic values,” European Commission Spokeswoman Paula Pinho told reporters Tuesday in Brussels. Without specifying any government, Trump threatened export restrictions on US advanced technology and semiconductors and higher tariffs in retaliation for nations’ digital services taxes that hit American companies.', 'url': 'https://finnhub.io/api/news?id=7de834c2295cd83ee6630cf06bc371f15816a768702ce246a190d1133a4baa23'}, {'category': 'company', 'datetime': 1756212208, 'headline': 'Latest News In Cloud AI - Aurasell Transforms CRM Landscape With AI-Native Platform Launch', 'id': 136525493, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Aurasell has launched as the world's first AI-native CRM platform, introducing a significant shift in the landscape of cloud-based business software. The platform integrates a comprehensive suite of tools into a single system, aiming to eliminate the inefficiencies and high costs associated with traditional, fragmented CRM and go-to-market (GTM) systems. By leveraging AI, Aurasell provides enhanced automation and data unification, which can streamline operations from prospecting to contract...\", 'url': 'https://finnhub.io/api/news?id=207ea8323e1b58d3848a4374d82364443f6b0455e6408f0507c116e10ddbf39c'}, {'category': 'company', 'datetime': 1756211520, 'headline': 'AI Powers AR: Spotselfie Debuts Real-World Ad Marketplace for Brands & Creators', 'id': 136525512, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Spotselfie®, the self-funded AR real-world social metaverse with 16 issued patents, is rolling out its next-generation platform. This AI-powered creator marketplace lets brands and independent creators place GPS-anchored brand experiences in the real world. Built for mobile AR and the next wave of XR smart glasses, it opens new income streams for creators and delivers brands unmatched local targeting.', 'url': 'https://finnhub.io/api/news?id=90be422c09d26a51591bdec839617db7929d82f81f97ba77a05df28e656398a3'}, {'category': 'company', 'datetime': 1756210560, 'headline': 'Boring Is Better Than Amazon, Apple, and Alphabet. These 3 Stocks Prove It.', 'id': 136525495, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Torsten Sløk, the chief economist at Apollo Global Management, says some big tech stocks are being outdone by what might be considered ho-hum names.', 'url': 'https://finnhub.io/api/news?id=91abe67ba7809fa434c3ca366e8a93ff76cea29a866a1272fd1007da924b21f8'}, {'category': 'company', 'datetime': 1756206900, 'headline': 'Tech, Media & Telecom Roundup: Market Talk', 'id': 136525514, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Find insight on Samsung SDI, Cambricon Technologies, Nvidia and more in the latest Market Talks covering technology, media and telecom.', 'url': 'https://finnhub.io/api/news?id=6f3c57dee3ef235b9c03327c1368efb31c146d3c0770094cd015d9072c9ee71b'}, {'category': 'company', 'datetime': 1756204680, 'headline': 'Exploring Trends Across Asset Classes, Mega-Caps, And Banks', 'id': 136525746, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1308271745/image_1308271745.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"Equities have stalled out in the last half of August as a buyer's strike ahead of the seasonally weak month of September takes hold. Click to read.\", 'url': 'https://finnhub.io/api/news?id=e261ed2b3678ac77557c1b354cdc074ed03a8137a6ce9fe9d83108f769ba1221'}, {'category': 'company', 'datetime': 1756204200, 'headline': 'Trump Fires Another Shot at the Fed. The Economy Could Be Collateral Damage.', 'id': 136525515, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Trade deals are still in flux, Musk sues Apple, OpenAI, Intel’s deal with U.S. comes with a catch, and more news to start your day.', 'url': 'https://finnhub.io/api/news?id=feea0a87baf07a24584e4e8b8248a325a74996a515c6f040e4bcbf11919f7830'}, {'category': 'company', 'datetime': 1756202400, 'headline': 'Apple-Google Likely Tie-Up for Siri Revamp Puts These ETFs in Focus', 'id': 136523788, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple and Google's AI talks lift both stocks, putting ETFs like IYW, FTEC, FCOM and VOX, with heavy exposure to the tech giants, in focus.\", 'url': 'https://finnhub.io/api/news?id=94c168d3e743b209b245da5b32ecc7207d844937d4d278cf72a515e5a0057625'}, {'category': 'company', 'datetime': 1756202400, 'headline': 'Circular Economy Market to Soar from $149.86 Billion in 2024 to $355.44 Billion by 2032, Driven by ESG Adoption and Recycling Innovation | Report by DataM Intelligence', 'id': 136523787, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'According to research report published by DataM Intelligence, \"The Circular Economy Market Size valued US$149.86 billion in 2024, is projected to reach US$355.44 billion by 2032, expanding at a robust CAGR of 11.40% from 2025 to 2032.\" Global concerns over waste management and resource scarcity are significantly driving the circular economy market, as nations and industries face the dual challenge of rising waste volumes and depleting raw materials.', 'url': 'https://finnhub.io/api/news?id=7ae834401cec373cbbebc6770403f421198ff3a98febd8a0a916ffaf4027c8bb'}, {'category': 'company', 'datetime': 1756202329, 'headline': \"Apple Watch not a 'CO2-neutral product,' German court finds\", 'id': 136523789, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'BERLIN (Reuters) -Apple can no longer advertise its Apple Watch as a \"CO2-neutral product\" in Germany, following a court ruling on Tuesday that upheld a complaint from environmentalists, finding that the U.S. tech company had misled consumers. Apple had promoted the device online as \"our first CO2-neutral product,\" a claim found by a panel of judges to be unfounded and in violation of German competition law, according to a statement from a regional court in Frankfurt. An Apple spokesperson said the court ruling \"broadly upheld our rigorous approach to carbon neutrality\" and declined to comment on whether the company would appeal Tuesday\\'s ruling.', 'url': 'https://finnhub.io/api/news?id=6bba43b58fbaa3325141222ddf982d019366b4f7af671d3278bcea9d588d4ec3'}, {'category': 'company', 'datetime': 1756199205, 'headline': 'Elon Musk’s xAI files lawsuit against Apple and OpenAI', 'id': 136523790, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The lawsuit alleges Apple's ChatGPT integration sidelines rival apps such as xAI's Grok in App Store rankings.\", 'url': 'https://finnhub.io/api/news?id=d4ee4300cb2fbdea35e2495786189edac83b6f9f477ab491f5251d1a371f90e6'}, {'category': 'company', 'datetime': 1756198863, 'headline': \"Elon Musk Sues Apple, OpenAI Over iPhone AI 'Monopoly'\", 'id': 136523791, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The lawsuit claims Apple and OpenAI's exclusive iPhone AI deal locks out rivals from 80% of the chatbot market.\", 'url': 'https://finnhub.io/api/news?id=eb6c93280471945b15f63b8433082dc950ee64a93ed4fedc248ad5d566b1c58b'}, {'category': 'company', 'datetime': 1756198800, 'headline': 'Labour accused of abandoning UK tech in AI push', 'id': 136523771, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Labour has been accused of abandoning British tech firms despite Sir Keir Starmer’s pledge to transform the country into an artificial intelligence (AI) powerhouse.', 'url': 'https://finnhub.io/api/news?id=afa0535831fcd97266559a9d37f57a658c3075f6d66955f03b2c79cb1ff64bb0'}, {'category': 'company', 'datetime': 1756198015, 'headline': 'Trump threatens tariffs on nations imposing digital taxes on US tech', 'id': 136523778, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The president said the taxes against US firms “give a complete pass to China’s largest tech companies”.View on euronews', 'url': 'https://finnhub.io/api/news?id=b776efdb64af47c5fe1e927b709c73cbe5c9c0d14ced2ac5e16a21f1476bbb8e'}, {'category': 'company', 'datetime': 1756197600, 'headline': \"Prediction: 2 Stocks That'll Be Worth More Than Berkshire Hathaway 5 Years From Now\", 'id': 136523779, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'These two megacap stocks have Berkshire Hathaway in their sights.', 'url': 'https://finnhub.io/api/news?id=f33417a3a5a437980a5180f2bf5f6287f63409452b581252b1955fcea7108cbc'}, {'category': 'company', 'datetime': 1756195620, 'headline': 'Wall Street Breakfast Podcast: Trump Fires Cook,\\xa0Threatens More Tariffs', 'id': 136524231, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1717444876/image_1717444876.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Trump fires Fed Governor Cook,Â\\xa0threatens more tariffs, andÂ\\xa0Hassett on Fed chair nominee.', 'url': 'https://finnhub.io/api/news?id=dfb538777ae981067d19edc7864c752efabdf58a28713289109d61c75297a09b'}, {'category': 'company', 'datetime': 1756193878, 'headline': 'Heard on the Street Monday Recap: Trump’s New Deal', 'id': 136523795, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'President Trump said he wants to pursue more deals like the government’s equity investment in Intel. The U.S. converted funds previously allocated for manufacturing expansion into a 9.9% stake in the chip maker. The government also obtained a five-year warrant, under which it could receive an additional 5% if Intel spins out or sells off its manufacturing operations.', 'url': 'https://finnhub.io/api/news?id=31535f8995229bc9f0c38c870b6e861a6d0c18dd7d1ea1cab9a0c56060fb920e'}, {'category': 'company', 'datetime': 1756192028, 'headline': \"Elon Musk's xAI sues Apple, OpenAI over competition claims\", 'id': 136523796, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'STORY: Elon Musk’s xAI is suing Apple and OpenAI over claims they conspired to thwart rivals on artificial intelligence.The suit was filed in a Texas court on Monday (August 26).It says the pair “locked up markets to maintain their monopolies” after Apple integrated OpenAI’s ChatGPT into its products.The suit says the partnership led the iPhone maker to promote ChatGPT in its app store, while limiting prominence for Musk’s competing chatbot Grok.In a social media post, Musk said “a million reviews with 4.9 average for Grok and still Apple refuses to mention Grok on any lists”.Apple didn’t respond to a request for comment on the suit.While OpenAI said the case was consistent with what it called Musk’s “ongoing pattern of harassment”.Some legal experts said Apple’s dominant position in the smartphone market could bolster xAI’s allegation that it was suppressing competition.But Ohio State University law professor Amy Schmitz cast doubt on some of Musk’s claims:“The fact remains that Grok is in the app store and it has ranked highly in some months. In fact, one report I looked at had it ranked at, I think, number one on the App Store in February of 2025, which shows that there is competition, right?”Musk cofounded OpenAI with Sam Altman in 2015.Its ChatGPT bot would later become the fastest-growing consumer application in history.But the pair fell out, and Musk went on to found the rival xAI.In a separate case, he’s suing the ChatGPT maker over its plan to convert from a nonprofit to a for-profit entity.', 'url': 'https://finnhub.io/api/news?id=20e1a5980ae6bfeaa51588fb7adf04a8a77455ce6b836af5680092325a6affbf'}, {'category': 'company', 'datetime': 1756191720, 'headline': 'Prediction: This Unstoppable Stock Will Join Nvidia, Microsoft, and Apple in the $3 Trillion Club Before 2028', 'id': 136523782, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Multiple avenues for growth will help this tech stalwart ascend to new heights.', 'url': 'https://finnhub.io/api/news?id=0a902a286165aa31474fa39cd6d738bff751ff0a50ada011825d386ccd1e8ec8'}, {'category': 'company', 'datetime': 1756184435, 'headline': 'How to close the menopause pay gap', 'id': 136523798, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Women experience an average 10% reduction in earnings by the fourth year following a menopause diagnosis.', 'url': 'https://finnhub.io/api/news?id=4a9e22064b284c05ab6ed13378a663bd282d07b3a51b0d5867a7b0d0b20b906d'}, {'category': 'company', 'datetime': 1756181665, 'headline': 'Trump vows retaliation against countries proposing digital taxes or regulation on American tech giants', 'id': 136523799, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The President seeks to curb rules taking aim at U.S. tech conglomerates', 'url': 'https://finnhub.io/api/news?id=ce623059cb32952ee4c09957bbb8fecad99152bf240a69a20402253669f856ee'}, {'category': 'company', 'datetime': 1756180826, 'headline': 'The $5.5bn cup of coffee', 'id': 136523800, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'One thing to start: Elon Musk’s xAI has sued Apple and OpenAI alleging they broke antitrust rules by thwarting competition in artificial intelligence...', 'url': 'https://finnhub.io/api/news?id=b784bf1bbf51f2a7ae66430e9a9fe87f284667b812b7af3558f0ad86558cc92e'}, {'category': 'company', 'datetime': 1756171860, 'headline': 'Phinge®, Home of Netverse® and Netaverse™ With Verified and Safer AI Announces \"Test the Waters\" Campaign for Potential Regulation A+ Offering', 'id': 136523801, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Phinge Corporation today announced its intention to gauge market interest for a potential Regulation A+ offering, referred to as \"testing the waters\" under SEC Rule 255.', 'url': 'https://finnhub.io/api/news?id=23effc0ec59ab92a7532012a0b3ec4f1493fc83f940cb4d7bdc783cc24d844ee'}, {'category': 'company', 'datetime': 1756168269, 'headline': \"Jeff Bezos Said He Would Have 'Felt Icky' Had He Taken Any More Shares Of Amazon: 'I Just Didn't Feel Good...'\", 'id': 136523802, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Jeff Bezos once revealed in an interview that he never needed more stock to stay motivated at Amazon.com and that asking for it would have felt \"icky.\" Jeff Bezos Was ‘Proud’ Of His Compensation Package At Amazon In a 2024 interview at The New York ...', 'url': 'https://finnhub.io/api/news?id=93c751516e3666864e8c2e9ae96f5d91f74e81629b54bd48d507cb0dc4368d85'}, {'category': 'company', 'datetime': 1756154463, 'headline': \"Elon Musk's xAI sues Apple and OpenAI over AI competition\", 'id': 136523803, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Elon Musk\\'s xAI seeks billions in damages from Apple and OpenAI for allegedly “perpetrating their anticompetitive scheme\"', 'url': 'https://finnhub.io/api/news?id=81d1ba51ee5956233684563e8c4b5b066a6bc8955c78796b911b419a6633806f'}, {'category': 'company', 'datetime': 1756153867, 'headline': 'Stock Market Today: Dow Drops, Apple Firm Despite Musk Threat; Cathie Wood Loads Up On This Stock (Live Coverage)', 'id': 136522222, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Dow fell as Nvidia shined on the stock market today. Apple held up despite an Elon Musk AI move. Cathie Wood bought a diving stock.', 'url': 'https://finnhub.io/api/news?id=741cc617526e6af9d4f9f3bc5a38ad75e609a0e15933233540034f15031a65bc'}, {'category': 'company', 'datetime': 1756153307, 'headline': \"Elon Musk's X & xAI sue Apple & Open AI: What happens next?\", 'id': 136522261, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"X (formerly Twitter) and xAI (XAAI.PVT), owned by Tesla (TSLA) CEO Elon Musk, are suing Apple (AAPL) and OpenAI (OPAI.PVT). Musk's companies allege that Apple and OpenAI's partnership is anti-competitive and that the government should intervene due to antitrust laws. Yahoo Finance Senior Legal Reporter Alexis Keenan outlines the details of the suit. To watch more expert insights and analysis on the latest market action, check out more Market Domination.\", 'url': 'https://finnhub.io/api/news?id=7da38784a0869068ff9d0cb848412665a7729714621f73e14ae7b1b5bc3e5f30'}, {'category': 'company', 'datetime': 1756153296, 'headline': 'Why Apple Stock Could Sell Off After iPhone 17 Reveal', 'id': 136522262, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple stock could sell off after the company announces its iPhone 17 series smartphones next month, a Wall Street analyst said Monday.', 'url': 'https://finnhub.io/api/news?id=33011ae688343f7c45f9f05da64def83f3063e2686e7fa2da5d99883b981b78c'}, {'category': 'company', 'datetime': 1756152841, 'headline': \"Apple's Biggest iPhone Overhaul in a Decade Could Redefine the Stock's Next Growth Cycle\", 'id': 136522263, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Three years, three redesigns, foldables, AI-powered Siri, and a $100B services pivot -- Apple's next chapter begins.\", 'url': 'https://finnhub.io/api/news?id=554f3fddfdd67d0566bf7df68d092df224df5b41f44680af01e3a839730d68e8'}, {'category': 'company', 'datetime': 1756151760, 'headline': 'Apple no longer innovates — it waits. And with AI, anyone playing it safe will get left behind.', 'id': 136541521, 'image': '', 'related': 'AAPL', 'source': 'MarketWatch', 'summary': 'Apple no longer innovates — it waits. And with AI, anyone playing it safe will get left behind.', 'url': 'https://finnhub.io/api/news?id=272058be85f6596bdceae844d391faf2a80d7f1e1321f59ab01ab25b65b1400a'}, {'category': 'company', 'datetime': 1756151544, 'headline': 'Sector Update: Tech Stocks Mixed in Late Afternoon Trading', 'id': 136522229, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Tech stocks were mixed late Monday afternoon, with the Technology Select Sector SPDR Fund (XLK) frac', 'url': 'https://finnhub.io/api/news?id=2c0bfc5d0dd6af1cab926d1fd2505d8d19703009bdda35aef17ff2936d1bda65'}, {'category': 'company', 'datetime': 1756151528, 'headline': 'US Equity Indexes Mixed Amid Higher Treasury Yields, Dollar', 'id': 136522230, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'US equity indexes traded mixed heading into the close on Monday amid gains in both government bond y', 'url': 'https://finnhub.io/api/news?id=c702f097666c85b6e3990aac44ae65118eeb133cd08498eefa5f99174f46f849'}, {'category': 'company', 'datetime': 1756150843, 'headline': \"Inside Elon Musk's suit against Apple and OpenAI: 'This is a tale of two monopolists'\", 'id': 136522266, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Elon Musk followed through on Monday with a warning to sue Apple and OpenAI over their agreement to integrate OpenAI’s chatbot into Apple’s operating systems and prioritize the chatbot in its app store.', 'url': 'https://finnhub.io/api/news?id=bbb6426526db4acbd3ad432e567665510f3ece060f0b6d8a4dd0f3a7036d3ace'}, {'category': 'company', 'datetime': 1756147860, 'headline': 'Elon Musk’s xAI Sues Apple and OpenAI, Alleging They Are Monopolists', 'id': 136522267, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Musk said the partnership between the two companies has given the ChatGPT-maker access to “billions of user prompts.”', 'url': 'https://finnhub.io/api/news?id=c10d9f0635e4eb3fe91f2c5c05a1507f6a9aaeaf682671a9f0d6f767c60f9271'}, {'category': 'company', 'datetime': 1756147440, 'headline': 'Musk Sues OpenAI and Apple Over AI Access in App Store', 'id': 136522268, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'xAI filed suit against OpenAI and Apple, alleging anticompetitive behavior, according to a report from CNBC.', 'url': 'https://finnhub.io/api/news?id=3e8876dd844b1ac11ecfa0256361a8de7798d4d2629948be49edfbeeced54463'}, {'category': 'company', 'datetime': 1756146753, 'headline': 'Musk sues Apple and ChatGPT maker for ‘conspiring’ against him', 'id': 136522269, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Elon Musk has filed a lawsuit against Apple and ChatGPT maker OpenAI, accusing the companies of conspiring against his AI business.', 'url': 'https://finnhub.io/api/news?id=0dcf5c23d8b030b5e284a4fa60a5aabab4e2943880014f0b573c49c8fd96f2dc'}, {'category': 'company', 'datetime': 1756144729, 'headline': 'Elon Musk accuses Apple and OpenAI of stifling AI competition in antitrust lawsuit', 'id': 136522270, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Elon Musk on Monday targeted Apple and OpenAI in an antitrust lawsuit alleging that the iPhone maker and the ChatGPT maker are teaming up to thwart competition in artificial intelligence. The 61-page complaint filed in Texas federal court follows through on a threat that Musk made two weeks ago when he accused Apple of unfairly favoring OpenAI and ChatGPT in the iPhone's app store rankings for top AI apps. Musk's post insinuated that Apple had rigged the system against ChatGPT competitors such as the Grok chatbot made by his own xAI.\", 'url': 'https://finnhub.io/api/news?id=d53b55c1be0e7744d4bab3e799f1456ecca1191cdbe747fccc03753864f98cb9'}, {'category': 'company', 'datetime': 1756143185, 'headline': 'Sector Update: Tech Stocks Mixed Monday Afternoon', 'id': 136522248, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Tech stocks were mixed Monday afternoon, with the Technology Select Sector SPDR Fund (XLK) adding 0.', 'url': 'https://finnhub.io/api/news?id=4f72b52f62dbadbf3a017217986ed454470b3ce6dff0f140a7d02c16d36e871d'}, {'category': 'company', 'datetime': 1756143125, 'headline': 'US Equity Indexes Mixed as Nvidia Helps Lift Nasdaq Composite', 'id': 136522249, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'US equity indexes traded mixed after midday Monday, with the Nasdaq Composite eking out a gain amid', 'url': 'https://finnhub.io/api/news?id=97583c089a3ab8dbbfc9195508c38b6a74ebc23e472c43727b756eaa05a0dcf2'}, {'category': 'company', 'datetime': 1756143038, 'headline': 'Elon Musk’s xAI sues Apple and OpenAI, alleging anticompetitive collusion', 'id': 136522273, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'According to Musk, Apple and OpenAI are colluding to stifle competition from other AI companies.', 'url': 'https://finnhub.io/api/news?id=516a56dece05e72da77f994ec08b1f901e8a1a28c2f28f9a0c0b9412c42a8d70'}, {'category': 'company', 'datetime': 1756142987, 'headline': 'Elon Musk Sues Apple, OpenAI', 'id': 136522274, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Bloomberg\\'s Mark Gurman details the latest on Apple as Elon Musk files a lawsuit against the tech giant and OpenAI, accusing them of unfairly favoring OpenAI on its smartphones. He joins Caroline Hyde on \"Bloomberg Tech.\"', 'url': 'https://finnhub.io/api/news?id=071349467edabf0c07f743af2407158405cc21bc874e0e86ce02f4acd35995be'}, {'category': 'company', 'datetime': 1756141964, 'headline': \"Elon Musk sues Apple & OpenAI, Roblox rises, Alphabet's new high\", 'id': 136522275, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Yahoo Finance's John Hyland tracks Monday's top moving stocks and biggest market stories in this Market Minute: Tesla (TSLA) CEO and xAI (XAAI.PVT) founder Elon Musk suing Apple (AAPL) and OpenAI (OPAI.PVT), Roblox (RBLX) stock rallying, and Alphabet (GOOG, GOOGL) stock hitting a new record. Stay up to date on the latest market action, minute-by-minute, with Yahoo Finance's Market Minute.\", 'url': 'https://finnhub.io/api/news?id=cd37f083513a4b43ce601efcf627712b2ba7c6ced97d0b6ce53bb151c3b93deb'}, {'category': 'company', 'datetime': 1756141742, 'headline': \"Musk's X, xAI Sue Apple, OpenAI for Alleged 'Anticompetitive Scheme'\", 'id': 136522276, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Elon Musk\\'s companies X and xAI on Monday sued Apple and OpenAI in federal court, alleging they have engaged in an \"anticompetitive scheme\" that prevents competitors like xAI\\'s Grok from competing fairly and ascending the App Store charts.', 'url': 'https://finnhub.io/api/news?id=9e539309f995339b843e01c6ce1eb901aea061bde6652385aacec2c901748116'}, {'category': 'company', 'datetime': 1756140046, 'headline': \"Apple iPhone 17 Launch Could Trigger 'Sell The News' Reaction, Analyst Warns\", 'id': 136522277, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple Inc. (NASDAQ:AAPL) is gearing up for its next iPhone cycle with a September launch expected to spotlight a new ultra-thin iPhone 17 Air, but muted consumer buzz and restrained carrier promotions suggest the release may lack the blockbuster momentum of past product cycles. Bank of America Securities analyst Wamsi Mohan maintained a Buy rating on Apple (NASDAQ:AAPL) with a price forecast of $250. Mohan said expectations for Apple's next iPhone cycle remain modest despite reports suggesting a\", 'url': 'https://finnhub.io/api/news?id=e4ab774ba6dcf3899d4162abc2facb5d717884b38aef2e050ccb0da3ad3ab090'}, {'category': 'company', 'datetime': 1756139126, 'headline': 'American Eagle downgraded, Puma soars, Musk sues Apple & OpenAI', 'id': 136509512, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Market Catalysts host Allie Canal dives into what's driving interest in some of Monday's trending tickers on Yahoo Finance's platform, including American Eagle Outfitters (AEO), Puma (PUM.DE), Apple (AAPL), and OpenAI (OPAI.PVT). To watch more expert insights and analysis on the latest market action, check out more Market Catalysts.\", 'url': 'https://finnhub.io/api/news?id=624249acd2ebf5c12f5827252807b7ecb625e9f3357bbf43d1947fb2b2a2669d'}, {'category': 'company', 'datetime': 1756137739, 'headline': \"Musk's xAI sues Apple, OpenAI alleging antitrust violations\", 'id': 136522279, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Elon Musk's companies xAI and X filed a sweeping US antitrust lawsuit Monday against Apple and OpenAI, alleging the tech giants formed an illegal partnership to stifle competition in artificial intelligence and smartphone markets.The plaintiffs claim Apple holds 65 percent of the US smartphone market, while OpenAI controls at least 80 percent of the generative AI chatbot market through ChatGPT.\\nApple and OpenAI announced their partnership in June 2024, making ChatGPT the exclusive AI assistant a\", 'url': 'https://finnhub.io/api/news?id=4995a61d78bd0b891e214d004f7d3c718694b4b41939294746f2667f1e98297d'}, {'category': 'company', 'datetime': 1756129771, 'headline': 'Stock Market Today: Dow Falls Ahead Of Nvidia Earnings, Inflation Data; Palantir Sells Off (Live Coverage)', 'id': 136507733, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Dow Jones index falls Monday ahead of Nvidia earnings and key inflation data. Palantir stock drops.', 'url': 'https://finnhub.io/api/news?id=683641b210c1124848bd7d6581630691a3455bdce5b964676579ed0e2d8aa9bc'}, {'category': 'company', 'datetime': 1756127340, 'headline': 'Apple Plans Foldable, Curved-Glass iPhones: Report. What It Means for the Stock.', 'id': 136507777, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The shares are in a slump as investors wait to see how the company integrates artificial intelligence with its flagship product.', 'url': 'https://finnhub.io/api/news?id=928c434fc143e6e69f0e54225b9c755fc9080278e8da14fe7586966936d419b5'}, {'category': 'company', 'datetime': 1756121820, 'headline': 'What Is the Highest Apple Stock Has Ever Been?', 'id': 136507778, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple's all-time high was reached in late 2024, and it is well below this level today.\", 'url': 'https://finnhub.io/api/news?id=9a00ef0f43eb87671050f652a9f1dd0f502d8732e636adc1a6e6f870b57c1713'}, {'category': 'company', 'datetime': 1755870060, 'headline': 'Suze Orman reveals her favorite stock right now and the investing mistake that shaped her strategy', 'id': 136487722, 'image': '', 'related': 'AAPL', 'source': 'MarketWatch', 'summary': 'Suze Orman reveals her favorite stock right now and the investing mistake that shaped her strategy', 'url': 'https://finnhub.io/api/news?id=03c9e876a9f29d950a1dfa70089118437b7e02856f9547f278c249c14c0797fb'}, {'category': 'company', 'datetime': 1756116566, 'headline': 'Could Apple’s (AAPL) Airline Move Reveal a New Approach to Audience Growth?', 'id': 136507780, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"In August 2025, United Airlines announced that full seasons of select Apple TV+ original series, including Severance and Ted Lasso, are now available for free on over 130,000 seatback screens and in the United app, significantly expanding the airline's inflight entertainment content. This partnership could boost awareness and trial of Apple TV+ among United travelers, broadening Apple’s services reach beyond traditional streaming audiences. We'll explore how Berkshire Hathaway’s sizable...\", 'url': 'https://finnhub.io/api/news?id=8d1ec568e2355141d78aad1cadc0dc78a7410789f281182fa35436398a4f81cf'}, {'category': 'company', 'datetime': 1756114020, 'headline': \"If You'd Invested $1,000 in SoFi Technologies (SOFI) Stock 3 Years Ago, Here's How Much You'd Have Today. (Spoiler: Wow.)\", 'id': 136507781, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Spoiler: You'd have a lot.\", 'url': 'https://finnhub.io/api/news?id=cc372f93fc694e46f10bb1bfac7534e774ec28014abef59053ca2fdc87cd1e9d'}, {'category': 'company', 'datetime': 1756111500, 'headline': 'IBM: The Retracement An Opportunity As IBM Has Transformed Its Business', 'id': 136507588, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/1445810162/image_1445810162.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"IBM's focus on hybrid cloud, AI, and innovation boosts growth potential. Discover why its undervalued shares offer income & capital appreciation.\", 'url': 'https://finnhub.io/api/news?id=bd07496ca6f4bf66e1a45fb96943d6eda47f5938fe184effb5ca3bd4c30d1ad1'}, {'category': 'company', 'datetime': 1756109296, 'headline': 'BDJ: This Fund Provides Diversification Benefits Along With A High Yield (Rating Downgrade)', 'id': 136507375, 'image': '', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': '', 'url': 'https://finnhub.io/api/news?id=638320c4013e8c18f47c802a7de2f3e0726a7af7dac1e8eae884dee0a4d4eeb2'}, {'category': 'company', 'datetime': 1756102306, 'headline': \"Apple: The Future Is Bright, But That Doesn't Mean To Buy\", 'id': 136507010, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2203575435/image_2203575435.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Apple shows robust growth and strong margins, driven by its services segment, but a high valuation tempers buy potential.', 'url': 'https://finnhub.io/api/news?id=31f874ee1dcdd39caf82979740b96b0578f9ab14109c20d15d7c1274b63c0b12'}, {'category': 'company', 'datetime': 1756088516, 'headline': 'ETV: Decent Price Right Now, But Not As Diversified As I Would Like', 'id': 136506262, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2153687482/image_2153687482.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': \"ETV's strategy relies on writing index options, but its heavy technology weighting reduces diversification. Read why ETV CEF is a Hold.\", 'url': 'https://finnhub.io/api/news?id=e609d8759451296d6349d17fdd99438fa94156eeb9a23a86f2d0e912ae4441a0'}, {'category': 'company', 'datetime': 1756083600, 'headline': 'Tech Rally Shows Signs of Losing Steam', 'id': 136507772, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Nvidia and other stocks in the Magnificent Seven have been buffeted recently by growing doubts about their valuations and the potential of artificial intelligence.', 'url': 'https://finnhub.io/api/news?id=0f8fa3e29ac4bd95c89354949c4161a2d35db2381f83831109a9b2f473e5024f'}, {'category': 'company', 'datetime': 1756077120, 'headline': 'Prediction: All \"Ten Titans\" Stocks Will Surpass $1 Trillion in Market Cap by 2030', 'id': 136507773, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Ten Titans already make up 38% of the S&P 500, but their share could grow if companies keep delivering on investor expectations.', 'url': 'https://finnhub.io/api/news?id=21506a32bd26bd2e8cb299d0693e1834738da72b97c33b4ccc8a045bbd406e21'}, {'category': 'company', 'datetime': 1756072815, 'headline': 'If you bought Bitcoin instead of every new iPhone, you’d have $250M', 'id': 136507784, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Bitcoin or iPhone, which investment would have paid more?', 'url': 'https://finnhub.io/api/news?id=2219010c26b8b851571c82f93c92505738ad14bc5c10403441a6544a640d2cd3'}, {'category': 'company', 'datetime': 1756066081, 'headline': 'Tracking Renaissance Technologies (RenTec) 13F Portfolio - Q2 2025 Update', 'id': 136504690, 'image': '', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': '', 'url': 'https://finnhub.io/api/news?id=5af03a9d2830ba72b2e198c9657b545ae8d7d8941028d9d6e3cde20a2dffefca'}, {'category': 'company', 'datetime': 1756065569, 'headline': 'Netflix’s ‘KPop Demon Hunters’ is probably the biggest movie in theaters', 'id': 136507785, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"This is Netflix's first time winning the domestic box office.\", 'url': 'https://finnhub.io/api/news?id=390d947eadec7e91d89abc8db8b332bcd287771bd8582c26f09c9b33d5e1ad3a'}, {'category': 'company', 'datetime': 1756058400, 'headline': \"Prediction: These 2 Trillion-Dollar Artificial Intelligence (AI) Stocks Could Strike a Megadeal That Wall Street Isn't Ready For\", 'id': 136502572, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Most of the \"Magnificent Seven\" companies have built and scaled legitimate artificial intelligence (AI) platforms, but two outliers in big tech remain.', 'url': 'https://finnhub.io/api/news?id=4aa61de7969df2e537fcbf75911a5d0975ee96cf94d45ea916556d38a6a8a54d'}, {'category': 'company', 'datetime': 1756051200, 'headline': 'Chinese backer of UK tech takeover accused of military ties', 'id': 136502573, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'A Chinese tech giant funding the takeover of a British semiconductor company has been accused of links to the country’s military.', 'url': 'https://finnhub.io/api/news?id=3b55f1aa895d7b89e582f60248f0424a158bb4d34316de66b42018335c7ae2bc'}, {'category': 'company', 'datetime': 1756047600, 'headline': 'The \"Ten Titans\" Stocks Now Make Up 38% of the S&P 500. Here\\'s What It Means for Your Investment Portfolio', 'id': 136502531, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Massive growth stocks are driving the performance of the S&P 500, for better or for worse.', 'url': 'https://finnhub.io/api/news?id=0beed2ea303bafdbcdee6489b172454ab0df5c2c868733b172d80693a4b795d7'}, {'category': 'company', 'datetime': 1756041990, 'headline': 'The Best Ways To Use the Apple Stocks App To Build Your Best Portfolio', 'id': 136502575, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Discover how Apple’s built-in Stocks app can help investing beginners track funds, set alerts and grow their investing skills.', 'url': 'https://finnhub.io/api/news?id=5ca7e4d33ae50bc068d77ba9e3f590dcd3ec53763ff7a803fc9da8abb40fc20c'}, {'category': 'company', 'datetime': 1756034640, 'headline': \"Here's How Many Shares of Apple Stock You'd Need for $10,000 in Yearly Dividends\", 'id': 136502576, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'This powerful consumer brand has found remarkable success because of its ongoing focus on innovation.', 'url': 'https://finnhub.io/api/news?id=b8be2c8adfc45a2581f853334d822802bab801a5392766dc7210bc22fd02c7a9'}, {'category': 'company', 'datetime': 1756033110, 'headline': 'Nvidia will deliver key earnings report this week', 'id': 136502538, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Check out the stocks that propelled last week's huge Dow rally.\", 'url': 'https://finnhub.io/api/news?id=7b86059d86ff84352acd6fae86a8258b87a44dd3f1d25102d65586b83cc7a8d5'}, {'category': 'company', 'datetime': 1756032600, 'headline': 'Why Is Warren Buffett Dumping Apple Stock Right Now?', 'id': 136502578, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Berkshire Hathaway has been rapidly reducing its Apple stock holdings. What's going on?\", 'url': 'https://finnhub.io/api/news?id=73ff48685f460de5f73fe6ecf015179bc929e73c78a4bed4aefadbf48985bb15'}, {'category': 'company', 'datetime': 1756028040, 'headline': 'Best Stock to Buy Right Now: Apple vs. Microsoft', 'id': 136502563, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Which of these roughly half-century-old companies presents a better investment opportunity?', 'url': 'https://finnhub.io/api/news?id=8a5e42a9d73e09b83190dc51513b368fd5f813da7aada8001706e41188f20fa0'}, {'category': 'company', 'datetime': 1756027390, 'headline': \"Ethereum's next upgrade: What you need to know\", 'id': 136502580, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Ethereum is gearing up for another major upgrade with the Fusaka hard fork, set for November 5', 'url': 'https://finnhub.io/api/news?id=b8308a5310cab511f1c7f66260442bcb62a56effedfb06262eb84d6b01983bd5'}, {'category': 'company', 'datetime': 1756022520, 'headline': '‘It’s almost tragic’: Bubble or not, the AI backlash is validating what one researcher and critic has been saying for years', 'id': 136502566, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Gary Marcus told Fortune that AI valuations remind him of Wile E Coyote. \"We are off the cliff.\"', 'url': 'https://finnhub.io/api/news?id=c02f68e789e6c621e714c92b71596e170bad8e3e5e606e8c3dc0c7c7d5e951be'}, {'category': 'company', 'datetime': 1756012944, 'headline': 'No Base iPhone in 2026 as Apple Bets Big on Foldable Launch', 'id': 136502582, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc. (NASDAQ:AAPL) is among the best stocks to buy now according to AI. According to the report by South Korean outlet ETNews, Apple Inc. (NASDAQ:AAPL) will skip the launch schedule in 2026, breaking from its tradition by not releasing its base model. The reason is simple – it’s saving the spotlight for its first-ever […]', 'url': 'https://finnhub.io/api/news?id=808ae2d0c49ab9b03f5ff9655f9330c6676802665ea8750cf5937e302a0d3582'}, {'category': 'company', 'datetime': 1756012786, 'headline': 'Amazon AI Chip Executive Joins Arm to Build Complete Chips', 'id': 136502583, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Amazon.com, Inc. (NASDAQ:AMZN) is among the best stocks to buy now according to AI. On Monday, it was revealed that Arm Holdings has hired Rami Sinno, artificial intelligence chip director at Amazon.com, Inc. (NASDAQ:AMZN), in an effort to develop its own complete chips. Up to this point, Arm has not developed its own chips; rather, […]', 'url': 'https://finnhub.io/api/news?id=2c4675a4789aea76a1abe4ded69dab761cf657957e5b375d54245308b9a8cda2'}, {'category': 'company', 'datetime': 1756011644, 'headline': \"'We quit our jobs to launch a £2.5m tequila cocktail business'\", 'id': 136502584, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Co-founders Alice Parmiter and Wynter Karo quit their corporate jobs to launch premium tequila cocktail brand Pimentae.', 'url': 'https://finnhub.io/api/news?id=6d5de702003b9d1be6bd2638afa73d0025eaf761609e9f36f47ef9ec5d753072'}, {'category': 'company', 'datetime': 1755988028, 'headline': '3 Reasons You Should Buy Apple Stock Ahead of a Major Product Launch', 'id': 136502585, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'When it comes to the rise and fall of Apple stock, there are a number of catalysts investors look out for, and one of them is product launches. Apple consistently moves the market with their new...', 'url': 'https://finnhub.io/api/news?id=94beb6b43d176186a159a51c9c3deeda2a003e3c97a587160b4d0c7c7b64b3cf'}, {'category': 'company', 'datetime': 1755967620, 'headline': 'Prediction: This Quantum Computing Stock Will Still Be Worth More Than Berkshire Hathaway, Palantir, and Tesla Combined in 2030', 'id': 136495839, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Quantum computing could become the next frontier of the artificial intelligence revolution.', 'url': 'https://finnhub.io/api/news?id=963004d4b5e80bab2c5fff729f22be257f34cf9ebb2bedd4c494b9da856a2d25'}, {'category': 'company', 'datetime': 1755964802, 'headline': 'Should You Buy Nvidia Stock Before August 27?', 'id': 136497749, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'While U.S.-China tensions continue, Nvidia remains the undisputed king of AI hardware.', 'url': 'https://finnhub.io/api/news?id=98f85b2449e45b2ff2677d9b64411d13507b8092f83be42f053ed7cdaabb7cb8'}, {'category': 'company', 'datetime': 1755958200, 'headline': 'Warren Buffett Is Selling Apple and Bank of America and Piling Into This Beaten Down Value Stock Instead', 'id': 136495877, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'This stock looks like a classic \"bear greedy when others are fearful\" investment.', 'url': 'https://finnhub.io/api/news?id=aea4c08e323cb64a8b592182ebcbde4ebf32768cce3245433c496ead6e48207f'}, {'category': 'company', 'datetime': 1755957919, 'headline': 'This week in Trumponomics: A government hedge fund?', 'id': 136495842, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Trump wants to nationalize Intel and make other big companies do his bidding. Everybody fine with that?', 'url': 'https://finnhub.io/api/news?id=7197f4b7e60502eeab5cbd8a0a8f7b4c4e183277572e2ee0635531c7ecf46a26'}, {'category': 'company', 'datetime': 1755950400, 'headline': 'How Tech Is Tackling the New Age-Verification Rules', 'id': 136495879, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Selfies, government IDs and AI are all being used by companies in an effort to adhere to new laws and regulations aimed at protecting children.', 'url': 'https://finnhub.io/api/news?id=2ebcad4799efbcb2a4e34a0eec8c391bf65a92be17fe05d73e0f8b732927209d'}, {'category': 'company', 'datetime': 1755943669, 'headline': 'Foxconn’s Recall of More Chinese Staff Tests Apple’s India Push', 'id': 136495880, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The extraction of Chinese workers from the factory of Yuzhan Technology, a Foxconn component unit, in southern Tamil Nadu state is the second such move in a few months. Foxconn has started flying in Taiwanese engineers to replace staff leaving, people familiar with the matter said, asking not to be named as the information is private. Earlier this year, officials in Beijing verbally encouraged regulatory agencies and local governments to curb technology transfers and equipment exports to India and Southeast Asia in what is a potential attempt to prevent companies from shifting manufacturing elsewhere.', 'url': 'https://finnhub.io/api/news?id=ce0350a1cada1abfc2638e13fd6f5ce5d031693e9c391e8c7d25d188f75d151a'}, {'category': 'company', 'datetime': 1755943531, 'headline': 'Did Trump save Intel? Not really, analysts say.', 'id': 136495849, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'SAN FRANCISCO (Reuters) -U.S. President Donald Trump is injecting nearly $9 billion into Intel in exchange for a 9.9% equity stake. What Intel needs is external customers for its so-called cutting-edge 14A manufacturing process - a tough ask, at least in the short term. CEO Lip Bu Tan, who took the top job in March, warned last month that the company may have to quit the chip contracting business if it does not land any big clients.', 'url': 'https://finnhub.io/api/news?id=f9dc938c9ab927a7ae254533f06a600f1daf54df8050ee606becea6f1ec5df0b'}, {'category': 'company', 'datetime': 1755941400, 'headline': 'Warren Buffett Is Selling Apple Stock Again. Should You Follow His Lead?', 'id': 136495882, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Buffett hadn't sold Apple stock in nearly a year.\", 'url': 'https://finnhub.io/api/news?id=67a819077623f6d8344de845e6097c7d733def259f5a1be9305512e41bc53398'}, {'category': 'company', 'datetime': 1755936600, 'headline': \"Goodbye Growth? Here's What I'm Buying As Value Mounts A Comeback\", 'id': 136493917, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2193071535/image_2193071535.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'Recent underperformance in growth tech stocks reflects doubts about AI, while value-oriented dividend stocks have shown resilience and defensiveness. See more here.', 'url': 'https://finnhub.io/api/news?id=cd45534dafc843f5318537f56c7fad06e00d25a8e4c8fbf6789d1ab654d988d8'}, {'category': 'company', 'datetime': 1755935280, 'headline': 'Is Apple Stock Your Ticket to Becoming a Millionaire?', 'id': 136495883, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Shares of the tech giant have produced a total return of 68,660% in the past three decades.', 'url': 'https://finnhub.io/api/news?id=d2eec603ce17842f284932a4a3e5c03aff9daa6de5e5d86ddb6af845553352f9'}, {'category': 'company', 'datetime': 1755930600, 'headline': 'Brace for a Second China Shock. Advanced Manufacturing Is at Risk.', 'id': 136495884, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The U.S. could face a second version of the “China shock” that hollowed out parts of the U.S. manufacturing sector, according to Dan Wang, a veteran China technology analyst. The first China shock kept prices low for Americans and boosted corporate profitability. It also helped China transform into a more formidable rival, feeding the current frictions in the U.S.-China relationship.', 'url': 'https://finnhub.io/api/news?id=850292052d1c0a7a2f63dfb7d5c37273a14e9bc420558fbc9ca6bd344ab50a71'}, {'category': 'company', 'datetime': 1755925257, 'headline': 'The Guns N’ Roses-inspired company helping to make job search less soul-crushing', 'id': 136495885, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'As a fan of rock band Gun N’ Roses, Jérémy Clédat wanted to start his company with a name that resonated with the global job search market.', 'url': 'https://finnhub.io/api/news?id=01ebf524fba8ec60e739cfab45a16b7d5294a516e1158a9db36238ffab7015cd'}, {'category': 'company', 'datetime': 1755921418, 'headline': 'Apple (AAPL) off the Hook on Britain’s iPhone ‘Backdoor’ Push', 'id': 136495886, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple Inc. (NASDAQ:AAPL) is one of the best stocks to buy according to billionaire Ken Fisher. On August 19, U.S. Director of National Intelligence Tulsi Gabbard, confirmed that Britain has dropped its demand for the company to provide a backdoor to its encrypted devices. British authorities were pushing the iPhone maker to provide a backdoor […]', 'url': 'https://finnhub.io/api/news?id=a98cd2b33fc9c36638974f17b290dc1f9f9a5c17ae1a7662d24e54cd8f5f3662'}, {'category': 'company', 'datetime': 1755913206, 'headline': 'Bernstein Reiterates Market Perform on Alphabet (GOOGL) Amid AI Competition', 'id': 136495887, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Alphabet Inc. (NASDAQ:GOOGL) is one of the Must-Watch AI Stocks for Investors. On August 19, Bernstein SocGen Group analyst Mark Shmulik reiterated a Market Perform rating on the stock with a $185.00 price target. Drawing parallels between the current artificial intelligence landscape and the mobile platform wars of the early 2010s, the firm noted that they […]', 'url': 'https://finnhub.io/api/news?id=52e18599d510ed5d44cc4be72d8bce573a555e0a3d6b252b19a42c7a6cb4f948'}, {'category': 'company', 'datetime': 1755909000, 'headline': 'Prediction: This Unstoppable Stock Will Join Nvidia, Microsoft, and Apple in the $3 Trillion Club Before 2029', 'id': 136495867, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'This tech giant is firing on all cylinders.', 'url': 'https://finnhub.io/api/news?id=06994cc452da8b68a81d3fd95c7879eb25b2ad61afb29c7393e040155999f3e9'}, {'category': 'company', 'datetime': 1755901072, 'headline': 'Apple Explores Using Google Gemini AI to Power Siri', 'id': 136495889, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple is in early talks to use Google\\'s Gemini to power a revamped Siri, a potential step toward outsourcing more AI technology. Bloomberg\\'s Mark Gurman speaks with Vonnie Quinn and Caroline Hyde on \"The Close\" about Apple\\'s next moves.', 'url': 'https://finnhub.io/api/news?id=c363ca48e9308ec13ce2347c2fc1cd4819e52806ed374d2df3427bef570f13d1'}, {'category': 'company', 'datetime': 1755896497, 'headline': \"Dow Hits Record High as Powell's Dovish Tilt Fuels Stock Market Rally\", 'id': 136495871, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Wall Street's equity indexes rallied on Friday, with the Dow Jones Industrial Average hitting a reco\", 'url': 'https://finnhub.io/api/news?id=c45ffc6ab579368ee4943ead165a214976c8fd630c32c9e71cd71bd0eb4b2699'}, {'category': 'company', 'datetime': 1755895238, 'headline': 'Apple-Google Talks Heating Up Over Siri-Gemini IPhone Agreement?', 'id': 136495891, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Google stock rose Friday amid a report Apple and Alphabet are in talks over a Gemini-Siri iPhone deal as well as a Meta cloud computing pact.', 'url': 'https://finnhub.io/api/news?id=7bdfa9590bbf6abc5c8bae96c1af4c0d60442f4a5eec8f6169a0bb11714408eb'}, {'category': 'company', 'datetime': 1755894360, 'headline': 'Apple Looks at Using Gemini for AI, Report Says. Alphabet Stock Jumps.', 'id': 136495892, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Alphabet stock jumped to a record high Friday afternoon after a report said Apple is exploring using Google’s Gemini to run the highly anticipated Siri voice assistant. Bloomberg reported that the iPhone maker has approached Google to look into possibly building a custom artificial-intelligence model that would be the foundation of the long-awaited AI-powered Siri. Shares of Alphabet climbed 3.2% to $206.09.', 'url': 'https://finnhub.io/api/news?id=b7caed03521886a7c082609b0a414963bb97e1a8291cc7d3a2f6509f6ff7e550'}, {'category': 'company', 'datetime': 1755892834, 'headline': 'Apple gets ready for AI in the enterprise with new ChatGPT configuration options', 'id': 136495893, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple will let businesses configure ChatGPT enterprise access in the fall.', 'url': 'https://finnhub.io/api/news?id=ff16d935a7e5e70d4af11beac775853b8403fc5f2ca7ac8ae912094e619e5c7d'}, {'category': 'company', 'datetime': 1755892096, 'headline': 'Apple May Use Google AI to Power Revamped Siri', 'id': 136495894, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple is in early discussions about using Google Gemini to power a revamped version of its Siri voice assistant. The work is part of an effort to catch up in generative AI, a field where the company arrived late and then struggled to gain traction. Bloomberg's Denitsa Tsekova reports.\", 'url': 'https://finnhub.io/api/news?id=10cb0d9b54ab072a06079afacfbaa7e40b93ffdeeb1addc9744763603cd2ff39'}, {'category': 'company', 'datetime': 1755891483, 'headline': 'Ethereum, Gap, Apple: Trending tickers', 'id': 136495895, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Market Domination Host Josh Lipton and Prairie Operating Co. EVP of market strategy Lou Basenese discuss some of the day's top trending tickers, including Etherium (ETH-USD), Gap (GAP), and Apple (AAPL). To watch more expert insights and analysis on the latest market action, check out more Market Domination.\", 'url': 'https://finnhub.io/api/news?id=513c75a2bddffce5c5da870e661aadeafdcfe6e8b9e9f2fbf9f1cfd5ddec103b'}, {'category': 'company', 'datetime': 1755885259, 'headline': 'Apple reportedly wants Google’s Gemini to power new Siri', 'id': 136478817, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Investing.com -- Apple Inc (NASDAQ:AAPL). is said to be exploring the possibility of using Google’s Gemini model to power a revamped version of its Siri voice assistant, potentially outsourcing more of its artificial intelligence technology.', 'url': 'https://finnhub.io/api/news?id=139913ae884d4863c0bbcee60a33d4d4d9f1e1fbc699de4f12026bbdb69cd234'}, {'category': 'company', 'datetime': 1755885159, 'headline': 'MP Materials (MP) Surges 247% Over Last Quarter Amid Market Optimism', 'id': 136478818, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"MP Materials (MP) has showcased significant developments, including improved quarterly sales and a notable partnership with Apple to supply rare earth magnets. However, despite better sales figures, the company's ongoing losses reflect its challenging financial landscape. While the shares of MP surged 247% over the last quarter, the broader market also saw upward momentum, highlighted by optimism from potential interest rate cuts indicated by Fed Chair Powell. The news of strategic buyback...\", 'url': 'https://finnhub.io/api/news?id=c0a05d2b9539b4bcd299176f87094a644b42b9779339447aa52c38680f183729'}, {'category': 'company', 'datetime': 1755883746, 'headline': \"Stock Market Today: Dow Soars 900 Points As Fed's Powell Raises Rate-Cut Hopes; Nvidia Earnings Loom (Live Coverage)\", 'id': 136478797, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Dow Jones soared to an all-time Friday on increased hopes of a rate cut at the September Federal Reserve meeting.', 'url': 'https://finnhub.io/api/news?id=a805579fc4172735f665585fd7d8d2a3aee69a6e9ed896a0dacacba43613f053'}, {'category': 'company', 'datetime': 1755883350, 'headline': \"Apple in talks to use Google's Gemini AI to power revamped Siri, Bloomberg News reports\", 'id': 136478822, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Alphabet's shares were up 3.7% while Apple's stock was up 1.6%, both extending gains in afternoon trading following the report. Apple recently approached Alphabet's Google to develop a custom AI model to power a redesigned Siri next year, the report said. Apple remains weeks from deciding whether to stick with in-house Siri models or switch to an external partner, and it has not yet chosen a partner.\", 'url': 'https://finnhub.io/api/news?id=d3f01a1dc2bd8cd8fa3dca65439ad99cb28cdf8a1b5e063380b30e92c19949a6'}, {'category': 'company', 'datetime': 1755883164, 'headline': \"Apple's latest security update directly hits crypto users\", 'id': 136478824, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple urges users to immediately update their devices. Here is how it impacts crypto users.', 'url': 'https://finnhub.io/api/news?id=43dc0a0ae76e081ac38f1854ea4461d80362a55dfa7f6c726aafc7c5b3c1ef44'}, {'category': 'company', 'datetime': 1755883110, 'headline': 'Apple Explores Using Google Gemini AI to Power Revamped Siri', 'id': 136478826, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The iPhone maker recently approached Alphabet Inc.’s Google to explore building a custom AI model that would serve as the foundation of the new Siri next year, according to people familiar with he matter. Google has started training a model that could run on Apple’s servers, said the people, who asked not to be identified because the discussions are private. Earlier this year, Apple also explored partnerships with Anthropic PBC and OpenAI, weighing whether Claude or ChatGPT could serve as Siri’s new brain.', 'url': 'https://finnhub.io/api/news?id=5e934c677d156a05ca72ffc602338342dc5957ea7a3940b1c7f3c9f7cd140763'}, {'category': 'company', 'datetime': 1755883020, 'headline': 'Dell Technologies vs. Apple: Which PC Maker Stock is a Better Buy?', 'id': 136478827, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'DELL or AAPL, which PC maker is a better pick, given the strong demand for AI-powered devices amid rising tariffs?', 'url': 'https://finnhub.io/api/news?id=985c2070d00aa745e59ca55a11d5cf8f10bccddc7ea2a5b87f42435be096d554'}, {'category': 'company', 'datetime': 1755882000, 'headline': 'Y Combinator says Apple’s App Store has hindered startup growth', 'id': 136478829, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Y Combinator is asking the court to deny Apple’s appeal.', 'url': 'https://finnhub.io/api/news?id=5d2b4f1964b618a05375b8680527bf6bc517f240daa4d5075c2794a020440546'}, {'category': 'company', 'datetime': 1755881142, 'headline': 'Masimo files lawsuit against US border patrol amid Apple patent dispute', 'id': 136478830, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Masimo contests that US border patrol inaction over prohibiting the import of Apple Watch’s determined to include features that infringe on its light-based pulse oximetry technology is unlawful.', 'url': 'https://finnhub.io/api/news?id=a12e0b45d7d58437876740c7036ac6c966f4dc171bb3912cc877fe0001f2811c'}, {'category': 'company', 'datetime': 1755870090, 'headline': 'Stock Market Today: Dow Jones Index Rises Ahead Of Big Powell Speech; Nvidia Falls On AI Chip News (Live Coverage)', 'id': 136476309, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The Dow Jones index rose Friday ahead of Fed Chair Powell's speech. Nvidia stock fell on AI chip news, while Palantir also dropped.\", 'url': 'https://finnhub.io/api/news?id=e0f20dd04abda6bce17068f4b17e56a1a8dcc47f435d132d48fde56d027940e5'}, {'category': 'company', 'datetime': 1755872329, 'headline': 'Apple just indirectly boosted the value of its all-in-one subscription service', 'id': 136478832, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Apple hiked the price of Apple TV+ earlier this week, the third time it’s done so since 2019.', 'url': 'https://finnhub.io/api/news?id=472c9b6e27318765aa4454bee42e36228b952463214fa850d0eb8520c24ea1c0'}, {'category': 'company', 'datetime': 1755872220, 'headline': 'Meta Doubles Down on ‘Superintelligence’ Investment. It’s Good News for AI Stocks.', 'id': 136478814, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Meta Platforms is “investing more and more” into its artificial-intelligence efforts according to chief AI officer Alexandr Wang.', 'url': 'https://finnhub.io/api/news?id=574da7668862eeecb690af573b4e31a3d1517185457513bc7b9f6d0ea9108559'}, {'category': 'company', 'datetime': 1755871202, 'headline': 'How To Make An Iron Condor Fly With Options On Apple Stock', 'id': 136476454, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple has had some up-and-down price action, and it's a good bet it will go sideways. This could make for an iron condor setup.\", 'url': 'https://finnhub.io/api/news?id=7222792f96523088014e91d64f3462b712538e9071a0bb7ac00b2dfdb4c592a0'}, {'category': 'company', 'datetime': 1755871200, 'headline': 'Meet the Unstoppable Vanguard ETF With 55% Invested in \"Ten Titans\" Growth Stocks', 'id': 136476419, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The Vanguard S&P 500 Growth ETF has especially high weightings in select \"Ten Titans\" stocks.', 'url': 'https://finnhub.io/api/news?id=5ca186cfc0502126d6873ca3ceec89c7428c922342b104a6f94ff4b550759b22'}, {'category': 'company', 'datetime': 1755870571, 'headline': 'Meta Hires Another Apple AI Leader Amid Headcount Freeze, Report Says', 'id': 136476456, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Meta Platforms is reportedly hiring another senior AI executive from Apple for its Meta Superintelligence Labs, where it is moving to freeze headcount.', 'url': 'https://finnhub.io/api/news?id=03aa9b139c6a4ad64e005804e63597136c919603c45a2cd4352e19874da2e23e'}, {'category': 'company', 'datetime': 1755868678, 'headline': 'What If You’d Invested $500 in Apple Stock Instead of Buying the First iPhone?', 'id': 136476457, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The very first iPhone customers got plenty of use and enjoyment out of it, but they might have felt even better if they had invested that money in Apple stock.', 'url': 'https://finnhub.io/api/news?id=be031bbd19fc281a4c21acc193a683e5434e5f7d0d0e24e9ca71c8477134e368'}, {'category': 'company', 'datetime': 1755866651, 'headline': 'Latest News In Cloud AI - AI-Powered Security Boosts Cloud Protection in New Partnership', 'id': 136476439, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Radware and EPIC Cloud Company have entered into a Managed Security Service Provider (MSSP) agreement aimed at enhancing cloud application security through AI-powered solutions. This collaboration allows EPIC Cloud to integrate Radware’s advanced security services into their offerings, thereby bolstering protection for cloud-based applications and data. Radware’s service includes a comprehensive security platform featuring web application firewalls, bot management, API protection, and DDoS...', 'url': 'https://finnhub.io/api/news?id=314fd848df66c32f01bc147fc013d5799bff38e4d2c32d3c6a92d1dd11874575'}, {'category': 'company', 'datetime': 1755863178, 'headline': \"Mark Zuckerberg Halts AI Hiring After Million-Dollar Talent Poaching Sparks Investor Backlash Amid Meta's 'Superintelligence Efforts:' Report\", 'id': 136476459, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Meta Platforms Inc. (NASDAQ:META) has implemented a hiring freeze in its artificial intelligence division following months of aggressive recruitment that included nine-figure compensation packages. Hiring Moratorium Follows Talent War Spending The ...', 'url': 'https://finnhub.io/api/news?id=8392d7b0547d3be92c922c19b5b9bd2c19f89bd4d75b0cad5df90a38cb53c227'}, {'category': 'company', 'datetime': 1755863100, 'headline': 'Could Uber Become a Trillion-Dollar Company One Day?', 'id': 136476443, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Uber is quietly becoming one of the most powerful transport infrastructure companies.', 'url': 'https://finnhub.io/api/news?id=1a88598da212691416aa7304d8d80ba3f4a1799f409e0516ddd06f76997742b7'}, {'category': 'company', 'datetime': 1755861140, 'headline': 'Russia mandates pre-installation of MAX app', 'id': 136476461, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'The app is designed to integrate with various government services.', 'url': 'https://finnhub.io/api/news?id=ab881b4b983e5a4c86ee13cbc6b2dbcd43f3e5ebe97eabdce44243da948f2b89'}, {'category': 'company', 'datetime': 1755858809, 'headline': \"Broadcom's AI Push Gains Speed With Microsoft, Meta, And Apple Pouring Billions Into Data Infrastructure\", 'id': 136476321, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Broadcom Inc. (NASDAQ:AVGO) is riding the artificial intelligence boom as soaring Big Tech investments in data infrastructure fuel demand for its custom chips and networking solutions, propelling the stock to strong year-to-date gains even as the company faces regulatory challenges in Europe. The custom chipmaker has surged 25% year-to-date, outpacing the NASDAQ Composite’s 9% gain, as booming demand for its networking and Application-Specific Integrated Circuit (ASIC) businesses positions the c', 'url': 'https://finnhub.io/api/news?id=b4fc561e1ea668faf67baf1d647f0ee877585164271fb7c5eaa8eda827e5caa6'}, {'category': 'company', 'datetime': 1755857452, 'headline': 'Investors zero in on Nvidia results as US tech stocks waver', 'id': 136476450, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"NEW YORK (Reuters) -A wobble in U.S. technology shares has raised the stakes for Nvidia Corp's quarterly results on Wednesday, with earnings from the semiconductor giant posing a crucial test for the scorching AI trade. The benchmark S&P 500 has pulled back this week from record levels, dragged lower by a roughly 3% drop so far this week in the heavyweight tech sector after a huge run for the group. Fueled by its dominant artificial intelligence (AI) products, Nvidia's massive share price gains have buoyed both the tech sector and the overall market in recent years.\", 'url': 'https://finnhub.io/api/news?id=8e0bae9104c2d5c3445963999e6df31717d9966102ad20374b5d1646d468c1d4'}, {'category': 'company', 'datetime': 1755856544, 'headline': '6 Stocks That Turned $1,000 Initial Investments Into Millions by Mid-2025', 'id': 136476464, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'These 6 stocks turned modest $1K investments into millions by mid-2025. See which companies delivered massive returns.', 'url': 'https://finnhub.io/api/news?id=066447d8e4c79d6dc79a1f3d956f70e2f43f3a8d059cc46665f961522bf3648d'}, {'category': 'company', 'datetime': 1755853743, 'headline': 'Should CEO pay be capped? Readers have their say', 'id': 136476465, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Pay for CEOs at FTSE 100 firms has hit a record high for the third year in a row, raising questions about equity and fairness.', 'url': 'https://finnhub.io/api/news?id=171ce63d87c11410ef52b55c53490aeee7a4389be2ea324c1cfbfa50c06fc116'}, {'category': 'company', 'datetime': 1755852300, 'headline': 'Do Extreme Concentration And Bad Breadth Signify A Bubble?', 'id': 136475952, 'image': '', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': '', 'url': 'https://finnhub.io/api/news?id=7157f6bce8ab4cae4100f74e195d5e82876e640cbc5f8436d773bb24af2eee88'}, {'category': 'company', 'datetime': 1755850500, 'headline': 'BNY Mellon Equity Income Fund Q2 2025 Commentary', 'id': 136475862, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2158808037/image_2158808037.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'BNY Mellon Equity Income Fund returned -3.31% during the first quarter of 2025. Click here to read more.', 'url': 'https://finnhub.io/api/news?id=49d43786806274bdfd92a192f7ae853e14fd9144cdadf9898889b5496ea6be41'}, {'category': 'company', 'datetime': 1755850413, 'headline': 'FTSE 100 LIVE: Stocks eke out gains as traders await key Jackson Hole speech from Federal Reserve chair', 'id': 136476324, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'Traders look for comments that could help confirm expectations that a US interest rate cut is on the cards.', 'url': 'https://finnhub.io/api/news?id=86dfe633de7c66a75f0be7a6a3f1d3edf5360d215952aa1d0201f141758d78a4'}, {'category': 'company', 'datetime': 1755849060, 'headline': \"Billionaire Warren Buffett Sold 69% of Berkshire's Stake in Apple and Has Loaded Up on This Industry-Leading Stock for 4 Straight Quarters\", 'id': 136476467, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"The Oracle of Omaha is paring down his No. 1 holding, yet again, in favor of a company that's delivered a nearly 48,000% total return since it went public.\", 'url': 'https://finnhub.io/api/news?id=e8e188c0ad3059e6099a6e54429a1a0668c28439de8808827a8dced673eb4c33'}, {'category': 'company', 'datetime': 1755838802, 'headline': 'IBM head of research on how quantum computing will change businesses', 'id': 136476468, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"IBM's Alessandro Curioni says companies must act now to gain an edge from quantum computing.\", 'url': 'https://finnhub.io/api/news?id=2bc8ddfcbb9c7ee49ef066106ef1d70077e630f55f9e2c01828995feadef7955'}, {'category': 'company', 'datetime': 1755837281, 'headline': 'Apple makes move sure to frustrate loyal customers', 'id': 136476469, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Apple's services division is a huge moneymaker and the company is milking it for all it's worth.\", 'url': 'https://finnhub.io/api/news?id=9099051383c0d494301133812162f480bc17fa1987c0999552108ee8c98e5f96'}, {'category': 'company', 'datetime': 1755830400, 'headline': \"The Visible Alpha AI Monitor Update: What's Next For AI?\", 'id': 136474705, 'image': 'https://static.seekingalpha.com/cdn/s3/uploads/getty_images/2151904577/image_2151904577.jpg?io=getty-c-w1536', 'related': 'AAPL', 'source': 'SeekingAlpha', 'summary': 'The Visible Alpha AI Monitor aggregates publicly traded US technology companies, providing a comprehensive measure of the current state and projected growth of the core AI industry.', 'url': 'https://finnhub.io/api/news?id=6fefae13e9d9825b6cf0023b8e57db778fe619013fbe6242efa6e859633469e7'}, {'category': 'company', 'datetime': 1755826084, 'headline': 'Meta makes huge cloud computing deal with Google: source', 'id': 136476470, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': \"Meta has made a cloud computing deal with Google worth more than $10 billion over the course of six years, a source close to the transaction told AFP Thursday.Google parent Alphabet's cloud computing business was on pace to bring in $50 billion over the course of the year, the company said in a recent earnings report.\", 'url': 'https://finnhub.io/api/news?id=c16a5b49617a847ebffe2155701fc8c66b73d16b6238a4e45affc5c246c2d67f'}, {'category': 'company', 'datetime': 1755820705, 'headline': 'Trump administration is not eyeing equity in TSMC, Micron, official says', 'id': 136476471, 'image': 'https://s.yimg.com/rz/stage/p/yahoo_finance_en-US_h_p_finance_2.png', 'related': 'AAPL', 'source': 'Yahoo', 'summary': 'WASHINGTON (Reuters) -The Trump administration is considering taking equity stakes in companies getting funds from the 2022 CHIPS Act but has no similar plans for bigger firms boosting U.S. investments, such as TSMC and Micron, a White House official told Reuters. The official confirmed a Wall Street Journal report that the administration does not intend to seek equity stakes in semiconductor companies, such as Micron and TSMC, that plan to step up investment.', 'url': 'https://finnhub.io/api/news?id=d551c06b88c15bfad192c4d46a69b45d12c9af5300867d14d6d4d269e122b1e9'}]\n", - "2025-08-29 02:30:06,375 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-29 02:30:39,933 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-29 02:30:39,939 [INFO] Executing tool: get_market_news with args: {'category': 'forex'}\n", - "2025-08-29 02:30:39,941 [INFO] Tool get_market_news called for category 'forex'\n", - "2025-08-29 02:30:40,166 [INFO] Tool get_market_news [{'category': 'forex', 'datetime': 1756412432, 'headline': \"Trump official announces 'transitory' taxes for the next six months\", 'id': 7510362, 'image': 'https://images.investinglive.com/images/Tariff%20Trump_id_6a2dc517-dc8d-4e19-84db-f22c99095372_size975.jpg', 'related': '', 'source': 'Forexlive', 'summary': \"

Senior Trump administration official:

  • Package shipments to U.S. to face flat duties of $80–$200 for six months before shifting to specific duty rates

This is in relation to Trump's removal of the 'de minimis' exemption on buying low value products from overseas. US consumers will now be taxed a minimum of $80, and up to $200, for ordering such items from offshore now.

More now, senior Trump administration official:

  • CBP has collected over $492 million in additional duties on packages from China and Hong Kong since de minimis exemption was ended for them
  • Engaged with foreign partners to ensure there is minimal disruption to shipments
  • Britain, Canada, Ukraine have said there will be no interruption in mail coming to U.S
  • There will not be any exceptions to the end of the de minimis exemption.
\\n This article was written by Eamonn Sheridan at investinglive.com.\", 'url': 'https://investinglive.com/news/trump-official-announces-transitory-taxes-for-the-next-six-months-20250828/'}]\n", - "2025-08-29 02:30:56,552 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n" + "2025-08-30 15:06:03,572 [INFO] HTTP Request: GET https://api.gradio.app/pkg-version \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:07,415 [INFO] \n", + "Messages:\n", + "{'role': 'user', 'content': 'apple stock earnings?'}\n", + "\n", + "2025-08-30 15:06:07,971 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:07,979 [INFO] Executing tool: get_current_time with args: {}\n", + "2025-08-30 15:06:08,580 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:08,782 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'AAPL', '_from': '2025-07-30', 'to': '2025-08-30'}\n", + "2025-08-30 15:06:08,785 [INFO] Tool get_earnings_calendar called for AAPL from 2025-07-30 to 2025-08-30\n", + "2025-08-30 15:06:10,398 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:16,366 [INFO] \n", + "Messages:\n", + "{'role': 'user', 'metadata': None, 'content': 'apple stock earnings?', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': 'Apple (AAPL) reported its Q3 2025 earnings on July 31, 2025, after market close. \\n- Actual EPS: $1.57 (estimate was $1.46) \\n- Actual Revenue: $94.04 billion (estimate was about $91.3 billion)', 'options': None}\n", + "{'role': 'user', 'content': 'nvidia q1 earnings'}\n", + "\n", + "2025-08-30 15:06:17,205 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:17,221 [INFO] Executing tool: get_current_time with args: {}\n", + "2025-08-30 15:06:17,775 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:18,023 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'NVDA', '_from': '2025-05-01', 'to': '2025-08-30'}\n", + "2025-08-30 15:06:18,026 [INFO] Tool get_earnings_calendar called for NVDA from 2025-05-01 to 2025-08-30\n", + "2025-08-30 15:06:18,842 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:28,656 [INFO] \n", + "Messages:\n", + "{'role': 'user', 'metadata': None, 'content': 'apple stock earnings?', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': 'Apple (AAPL) reported its Q3 2025 earnings on July 31, 2025, after market close. \\n- Actual EPS: $1.57 (estimate was $1.46) \\n- Actual Revenue: $94.04 billion (estimate was about $91.3 billion)', 'options': None}\n", + "{'role': 'user', 'metadata': None, 'content': 'nvidia q1 earnings', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': \"NVIDIA's most recent earnings were for Q2 2026, reported on August 27, 2025: \\n- EPS: $1.05 (estimate was about $1.03) \\n- Revenue: $46.7 billion (estimate was about $46.98 billion) \\n\\nQ1 2026 earnings data is not in the recent range. Would you like details for a different quarter or time frame?\", 'options': None}\n", + "{'role': 'user', 'content': 'q1 2025'}\n", + "\n", + "2025-08-30 15:06:29,790 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:29,805 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'NVDA', '_from': '2025-01-01', 'to': '2025-03-31'}\n", + "2025-08-30 15:06:29,807 [INFO] Tool get_earnings_calendar called for NVDA from 2025-01-01 to 2025-03-31\n", + "2025-08-30 15:06:29,808 [INFO] Executing tool: get_current_time with args: {}\n", + "2025-08-30 15:06:30,404 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:38,997 [INFO] \n", + "Messages:\n", + "{'role': 'user', 'metadata': None, 'content': 'apple stock earnings?', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': 'Apple (AAPL) reported its Q3 2025 earnings on July 31, 2025, after market close. \\n- Actual EPS: $1.57 (estimate was $1.46) \\n- Actual Revenue: $94.04 billion (estimate was about $91.3 billion)', 'options': None}\n", + "{'role': 'user', 'metadata': None, 'content': 'nvidia q1 earnings', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': \"NVIDIA's most recent earnings were for Q2 2026, reported on August 27, 2025: \\n- EPS: $1.05 (estimate was about $1.03) \\n- Revenue: $46.7 billion (estimate was about $46.98 billion) \\n\\nQ1 2026 earnings data is not in the recent range. Would you like details for a different quarter or time frame?\", 'options': None}\n", + "{'role': 'user', 'metadata': None, 'content': 'q1 2025', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': \"I cannot retrieve NVIDIA's Q1 2025 earnings because the data must be from within the last month. I can help with more recent earnings or other stock info if you want.\", 'options': None}\n", + "{'role': 'user', 'content': 'microsoft?'}\n", + "\n", + "2025-08-30 15:06:40,071 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:40,327 [INFO] Executing tool: get_current_time with args: {}\n", + "2025-08-30 15:06:40,328 [INFO] Executing tool: get_company_financials with args: {'symbol': 'MSFT'}\n", + "2025-08-30 15:06:40,330 [INFO] Tool get_company_financials called for MSFT\n", + "2025-08-30 15:06:41,437 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'MSFT', '_from': '2025-08-01', 'to': '2025-08-29'}\n", + "2025-08-30 15:06:41,439 [INFO] Tool get_earnings_calendar called for MSFT from 2025-08-01 to 2025-08-29\n", + "2025-08-30 15:06:42,284 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:47,742 [INFO] \n", + "Messages:\n", + "{'role': 'user', 'metadata': None, 'content': 'apple stock earnings?', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': 'Apple (AAPL) reported its Q3 2025 earnings on July 31, 2025, after market close. \\n- Actual EPS: $1.57 (estimate was $1.46) \\n- Actual Revenue: $94.04 billion (estimate was about $91.3 billion)', 'options': None}\n", + "{'role': 'user', 'metadata': None, 'content': 'nvidia q1 earnings', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': \"NVIDIA's most recent earnings were for Q2 2026, reported on August 27, 2025: \\n- EPS: $1.05 (estimate was about $1.03) \\n- Revenue: $46.7 billion (estimate was about $46.98 billion) \\n\\nQ1 2026 earnings data is not in the recent range. Would you like details for a different quarter or time frame?\", 'options': None}\n", + "{'role': 'user', 'metadata': None, 'content': 'q1 2025', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': \"I cannot retrieve NVIDIA's Q1 2025 earnings because the data must be from within the last month. I can help with more recent earnings or other stock info if you want.\", 'options': None}\n", + "{'role': 'user', 'metadata': None, 'content': 'microsoft?', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': 'Microsoft (MSFT) key financials: \\n- Market Cap: $3.79 trillion \\n- P/E Ratio (TTM): 37.23 \\n- EPS (TTM): $13.64 \\n- Dividend Yield: 0.65% \\n- 52-Week Range: $344.79 – $555.45 \\n\\nNo Q1 2025 or recent earnings releases found within August 2025. Would you like info on a different date or other details?', 'options': None}\n", + "{'role': 'user', 'content': 'latest earnings'}\n", + "\n", + "2025-08-30 15:06:48,343 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:48,368 [INFO] Executing tool: get_current_time with args: {}\n", + "2025-08-30 15:06:48,985 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:49,242 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'MSFT', '_from': '2025-07-30', 'to': '2025-08-30'}\n", + "2025-08-30 15:06:49,243 [INFO] Tool get_earnings_calendar called for MSFT from 2025-07-30 to 2025-08-30\n", + "2025-08-30 15:06:49,956 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:06:59,770 [INFO] \n", + "Messages:\n", + "{'role': 'user', 'metadata': None, 'content': 'apple stock earnings?', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': 'Apple (AAPL) reported its Q3 2025 earnings on July 31, 2025, after market close. \\n- Actual EPS: $1.57 (estimate was $1.46) \\n- Actual Revenue: $94.04 billion (estimate was about $91.3 billion)', 'options': None}\n", + "{'role': 'user', 'metadata': None, 'content': 'nvidia q1 earnings', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': \"NVIDIA's most recent earnings were for Q2 2026, reported on August 27, 2025: \\n- EPS: $1.05 (estimate was about $1.03) \\n- Revenue: $46.7 billion (estimate was about $46.98 billion) \\n\\nQ1 2026 earnings data is not in the recent range. Would you like details for a different quarter or time frame?\", 'options': None}\n", + "{'role': 'user', 'metadata': None, 'content': 'q1 2025', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': \"I cannot retrieve NVIDIA's Q1 2025 earnings because the data must be from within the last month. I can help with more recent earnings or other stock info if you want.\", 'options': None}\n", + "{'role': 'user', 'metadata': None, 'content': 'microsoft?', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': 'Microsoft (MSFT) key financials: \\n- Market Cap: $3.79 trillion \\n- P/E Ratio (TTM): 37.23 \\n- EPS (TTM): $13.64 \\n- Dividend Yield: 0.65% \\n- 52-Week Range: $344.79 – $555.45 \\n\\nNo Q1 2025 or recent earnings releases found within August 2025. Would you like info on a different date or other details?', 'options': None}\n", + "{'role': 'user', 'metadata': None, 'content': 'latest earnings', 'options': None}\n", + "{'role': 'assistant', 'metadata': None, 'content': 'Microsoft has not reported any earnings releases in the last month up to August 30, 2025. Would you like me to check a different date range or provide recent earnings for another company?', 'options': None}\n", + "{'role': 'user', 'content': 'nvidia'}\n", + "\n", + "2025-08-30 15:07:00,871 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:07:00,901 [INFO] Executing tool: get_current_time with args: {}\n", + "2025-08-30 15:07:01,680 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:07:01,944 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'NVDA', '_from': '2025-07-30', 'to': '2025-08-30'}\n", + "2025-08-30 15:07:01,947 [INFO] Tool get_earnings_calendar called for NVDA from 2025-07-30 to 2025-08-30\n", + "2025-08-30 15:07:02,980 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n" ] } ], "source": [ - "gr.ChatInterface(fn=chat, type=\"messages\", title=\"TickerBot\", description=\"Ask about stock prices, company profiles and market news!\").launch(debug=True)" + "gr.ChatInterface(fn=chat, type=\"messages\", title=\"TickerBot\", description=\"Ask about stock prices, company financials and market news!\").launch()" ] }, { "cell_type": "code", "execution_count": null, - "id": "ef238ae3-353f-462f-a7f7-2378cc482edb", + "id": "5c014d6f-820d-4d58-8527-7d703aad3399", "metadata": {}, "outputs": [], "source": [] @@ -810,525 +1102,10 @@ { "cell_type": "code", "execution_count": null, - "id": "09d7f664-7252-4fa0-b817-10dbda83e3f1", + "id": "40c77d61-3e90-4708-b360-fb58b4211e9b", "metadata": {}, "outputs": [], "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6cd3c913-c486-4d33-8f3d-c110e127fe66", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "id": "473e5b39-da8f-4db1-83ae-dbaca2e9531e", - "metadata": {}, - "source": [ - "# Let's go multi-modal!!\n", - "\n", - "We can use DALL-E-3, the image generation model behind GPT-4o, to make us some images\n", - "\n", - "Let's put this in a function called artist.\n", - "\n", - "### Price alert: each time I generate an image it costs about 4 cents - don't go crazy with images!" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2c27c4ba-8ed5-492f-add1-02ce9c81d34c", - "metadata": {}, - "outputs": [], - "source": [ - "# Some imports for handling images\n", - "\n", - "import base64\n", - "from io import BytesIO\n", - "from PIL import Image" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "773a9f11-557e-43c9-ad50-56cbec3a0f8f", - "metadata": {}, - "outputs": [], - "source": [ - "def artist(city):\n", - " image_response = openai.images.generate(\n", - " model=\"dall-e-3\",\n", - " prompt=f\"An image representing a vacation in {city}, showing tourist spots and everything unique about {city}, in a vibrant pop-art style\",\n", - " size=\"1024x1024\",\n", - " n=1,\n", - " response_format=\"b64_json\",\n", - " )\n", - " image_base64 = image_response.data[0].b64_json\n", - " image_data = base64.b64decode(image_base64)\n", - " return Image.open(BytesIO(image_data))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d877c453-e7fb-482a-88aa-1a03f976b9e9", - "metadata": {}, - "outputs": [], - "source": [ - "image = artist(\"New York City\")\n", - "display(image)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "728a12c5-adc3-415d-bb05-82beb73b079b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "id": "f4975b87-19e9-4ade-a232-9b809ec75c9a", - "metadata": {}, - "source": [ - "## Audio (NOTE - Audio is optional for this course - feel free to skip Audio if it causes trouble!)\n", - "\n", - "And let's make a function talker that uses OpenAI's speech model to generate Audio\n", - "\n", - "### Troubleshooting Audio issues\n", - "\n", - "If you have any problems running this code below (like a FileNotFound error, or a warning of a missing package), you may need to install FFmpeg, a very popular audio utility.\n", - "\n", - "**For PC Users**\n", - "\n", - "Detailed instructions are [here](https://chatgpt.com/share/6724efee-6b0c-8012-ac5e-72e2e3885905) and summary instructions:\n", - "\n", - "1. Download FFmpeg from the official website: https://ffmpeg.org/download.html\n", - "\n", - "2. Extract the downloaded files to a location on your computer (e.g., `C:\\ffmpeg`)\n", - "\n", - "3. Add the FFmpeg bin folder to your system PATH:\n", - "- Right-click on 'This PC' or 'My Computer' and select 'Properties'\n", - "- Click on 'Advanced system settings'\n", - "- Click on 'Environment Variables'\n", - "- Under 'System variables', find and edit 'Path'\n", - "- Add a new entry with the path to your FFmpeg bin folder (e.g., `C:\\ffmpeg\\bin`)\n", - "- Restart your command prompt, and within Jupyter Lab do Kernel -> Restart kernel, to pick up the changes\n", - "\n", - "4. Open a new command prompt and run this to make sure it's installed OK\n", - "`ffmpeg -version`\n", - "\n", - "**For Mac Users**\n", - "\n", - "1. Install homebrew if you don't have it already by running this in a Terminal window and following any instructions: \n", - "`/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"`\n", - "\n", - "2. Then install FFmpeg with `brew install ffmpeg`\n", - "\n", - "3. Verify your installation with `ffmpeg -version` and if everything is good, within Jupyter Lab do Kernel -> Restart kernel to pick up the changes\n", - "\n", - "Message me or email me at ed@edwarddonner.com with any problems!" - ] - }, - { - "cell_type": "markdown", - "id": "4cc90e80-c96e-4dd4-b9d6-386fe2b7e797", - "metadata": {}, - "source": [ - "## To check you now have ffmpeg and can access it here\n", - "\n", - "Excecute the next cell to see if you get a version number. (Putting an exclamation mark before something in Jupyter Lab tells it to run it as a terminal command rather than python code).\n", - "\n", - "If this doesn't work, you may need to actually save and close down your Jupyter lab, and start it again from a new Terminal window (Mac) or Anaconda prompt (PC), remembering to activate the llms environment. This ensures you pick up ffmpeg.\n", - "\n", - "And if that doesn't work, please contact me!" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7b3be0fb-1d34-4693-ab6f-dbff190afcd7", - "metadata": {}, - "outputs": [], - "source": [ - "!ffmpeg -version\n", - "!ffprobe -version\n", - "!ffplay -version" - ] - }, - { - "cell_type": "markdown", - "id": "d91d3f8f-e505-4e3c-a87c-9e42ed823db6", - "metadata": {}, - "source": [ - "# For Mac users - and possibly many PC users too\n", - "\n", - "This version should work fine for you. It might work for Windows users too, but you might get a Permissions error writing to a temp file. If so, see the next section!\n", - "\n", - "As always, if you have problems, please contact me! (You could also comment out the audio talker() in the later code if you're less interested in audio generation)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ffbfe93b-5e86-4e68-ba71-b301cd5230db", - "metadata": {}, - "outputs": [], - "source": [ - "from pydub import AudioSegment\n", - "from pydub.playback import play\n", - "\n", - "def talker(message):\n", - " response = openai.audio.speech.create(\n", - " model=\"tts-1\",\n", - " voice=\"onyx\", # Also, try replacing onyx with alloy\n", - " input=message\n", - " )\n", - " \n", - " audio_stream = BytesIO(response.content)\n", - " audio = AudioSegment.from_file(audio_stream, format=\"mp3\")\n", - " play(audio)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b88d775d-d357-4292-a1ad-5dc5ed567281", - "metadata": {}, - "outputs": [], - "source": [ - "talker(\"Well, hi there\")" - ] - }, - { - "cell_type": "markdown", - "id": "ad89a9bd-bb1e-4bbb-a49a-83af5f500c24", - "metadata": {}, - "source": [ - "# For Windows users (or any Mac users with problems above)\n", - "\n", - "## First try the Mac version above, but if you get a permissions error writing to a temp file, then this code should work instead.\n", - "\n", - "A collaboration between students Mark M. and Patrick H. and Claude got this resolved!\n", - "\n", - "Below are 4 variations - hopefully one of them will work on your PC. If not, message me please!\n", - "\n", - "And for Mac people - all 3 of the below work on my Mac too - please try these if the Mac version gave you problems.\n", - "\n", - "## PC Variation 1" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d104b96a-02ca-4159-82fe-88e0452aa479", - "metadata": {}, - "outputs": [], - "source": [ - "import base64\n", - "from io import BytesIO\n", - "from PIL import Image\n", - "from IPython.display import Audio, display\n", - "\n", - "def talker(message):\n", - " response = openai.audio.speech.create(\n", - " model=\"tts-1\",\n", - " voice=\"onyx\",\n", - " input=message)\n", - "\n", - " audio_stream = BytesIO(response.content)\n", - " output_filename = \"output_audio.mp3\"\n", - " with open(output_filename, \"wb\") as f:\n", - " f.write(audio_stream.read())\n", - "\n", - " # Play the generated audio\n", - " display(Audio(output_filename, autoplay=True))\n", - "\n", - "talker(\"Well, hi there\")" - ] - }, - { - "cell_type": "markdown", - "id": "3a5d11f4-bbd3-43a1-904d-f684eb5f3e3a", - "metadata": {}, - "source": [ - "## PC Variation 2" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d59c8ebd-79c5-498a-bdf2-3a1c50d91aa0", - "metadata": {}, - "outputs": [], - "source": [ - "import tempfile\n", - "import subprocess\n", - "from io import BytesIO\n", - "from pydub import AudioSegment\n", - "import time\n", - "\n", - "def play_audio(audio_segment):\n", - " temp_dir = tempfile.gettempdir()\n", - " temp_path = os.path.join(temp_dir, \"temp_audio.wav\")\n", - " try:\n", - " audio_segment.export(temp_path, format=\"wav\")\n", - " time.sleep(3) # Student Dominic found that this was needed. You could also try commenting out to see if not needed on your PC\n", - " subprocess.call([\n", - " \"ffplay\",\n", - " \"-nodisp\",\n", - " \"-autoexit\",\n", - " \"-hide_banner\",\n", - " temp_path\n", - " ], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n", - " finally:\n", - " try:\n", - " os.remove(temp_path)\n", - " except Exception:\n", - " pass\n", - " \n", - "def talker(message):\n", - " response = openai.audio.speech.create(\n", - " model=\"tts-1\",\n", - " voice=\"onyx\", # Also, try replacing onyx with alloy\n", - " input=message\n", - " )\n", - " audio_stream = BytesIO(response.content)\n", - " audio = AudioSegment.from_file(audio_stream, format=\"mp3\")\n", - " play_audio(audio)\n", - "\n", - "talker(\"Well hi there\")" - ] - }, - { - "cell_type": "markdown", - "id": "96f90e35-f71e-468e-afea-07b98f74dbcf", - "metadata": {}, - "source": [ - "## PC Variation 3" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8597c7f8-7b50-44ad-9b31-db12375cd57b", - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "from pydub import AudioSegment\n", - "from pydub.playback import play\n", - "from io import BytesIO\n", - "\n", - "def talker(message):\n", - " # Set a custom directory for temporary files on Windows\n", - " custom_temp_dir = os.path.expanduser(\"~/Documents/temp_audio\")\n", - " os.environ['TEMP'] = custom_temp_dir # You can also use 'TMP' if necessary\n", - " \n", - " # Create the folder if it doesn't exist\n", - " if not os.path.exists(custom_temp_dir):\n", - " os.makedirs(custom_temp_dir)\n", - " \n", - " response = openai.audio.speech.create(\n", - " model=\"tts-1\",\n", - " voice=\"onyx\", # Also, try replacing onyx with alloy\n", - " input=message\n", - " )\n", - " \n", - " audio_stream = BytesIO(response.content)\n", - " audio = AudioSegment.from_file(audio_stream, format=\"mp3\")\n", - "\n", - " play(audio)\n", - "\n", - "talker(\"Well hi there\")" - ] - }, - { - "cell_type": "markdown", - "id": "e821224c-b069-4f9b-9535-c15fdb0e411c", - "metadata": {}, - "source": [ - "## PC Variation 4\n", - "\n", - "### Let's try a completely different sound library\n", - "\n", - "First run the next cell to install a new library, then try the cell below it." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "69d3c0d9-afcc-49e3-b829-9c9869d8b472", - "metadata": {}, - "outputs": [], - "source": [ - "!pip install simpleaudio" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "28f9cc99-36b7-4554-b3f4-f2012f614a13", - "metadata": {}, - "outputs": [], - "source": [ - "from pydub import AudioSegment\n", - "from io import BytesIO\n", - "import tempfile\n", - "import os\n", - "import simpleaudio as sa\n", - "\n", - "def talker(message):\n", - " response = openai.audio.speech.create(\n", - " model=\"tts-1\",\n", - " voice=\"onyx\", # Also, try replacing onyx with alloy\n", - " input=message\n", - " )\n", - " \n", - " audio_stream = BytesIO(response.content)\n", - " audio = AudioSegment.from_file(audio_stream, format=\"mp3\")\n", - "\n", - " # Create a temporary file in a folder where you have write permissions\n", - " with tempfile.NamedTemporaryFile(suffix=\".wav\", delete=False, dir=os.path.expanduser(\"~/Documents\")) as temp_audio_file:\n", - " temp_file_name = temp_audio_file.name\n", - " audio.export(temp_file_name, format=\"wav\")\n", - " \n", - " # Load and play audio using simpleaudio\n", - " wave_obj = sa.WaveObject.from_wave_file(temp_file_name)\n", - " play_obj = wave_obj.play()\n", - " play_obj.wait_done() # Wait for playback to finish\n", - "\n", - " # Clean up the temporary file afterward\n", - " os.remove(temp_file_name)\n", - " \n", - "talker(\"Well hi there\")" - ] - }, - { - "cell_type": "markdown", - "id": "7986176b-cd04-495f-a47f-e057b0e462ed", - "metadata": {}, - "source": [ - "## PC Users - if none of those 4 variations worked!\n", - "\n", - "Please get in touch with me. I'm sorry this is causing problems! We'll figure it out.\n", - "\n", - "Alternatively: playing audio from your PC isn't super-critical for this course, and you can feel free to focus on image generation and skip audio for now, or come back to it later." - ] - }, - { - "cell_type": "markdown", - "id": "1d48876d-c4fa-46a8-a04f-f9fadf61fb0d", - "metadata": {}, - "source": [ - "# Our Agent Framework\n", - "\n", - "The term 'Agentic AI' and Agentization is an umbrella term that refers to a number of techniques, such as:\n", - "\n", - "1. Breaking a complex problem into smaller steps, with multiple LLMs carrying out specialized tasks\n", - "2. The ability for LLMs to use Tools to give them additional capabilities\n", - "3. The 'Agent Environment' which allows Agents to collaborate\n", - "4. An LLM can act as the Planner, dividing bigger tasks into smaller ones for the specialists\n", - "5. The concept of an Agent having autonomy / agency, beyond just responding to a prompt - such as Memory\n", - "\n", - "We're showing 1 and 2 here, and to a lesser extent 3 and 5. In week 8 we will do the lot!" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ba820c95-02f5-499e-8f3c-8727ee0a6c0c", - "metadata": {}, - "outputs": [], - "source": [ - "def chat(history):\n", - " messages = [{\"role\": \"system\", \"content\": system_message}] + history\n", - " response = openai.chat.completions.create(model=MODEL, messages=messages, tools=tools)\n", - " image = None\n", - " \n", - " if response.choices[0].finish_reason==\"tool_calls\":\n", - " message = response.choices[0].message\n", - " response, city = handle_tool_call(message)\n", - " messages.append(message)\n", - " messages.append(response)\n", - " image = artist(city)\n", - " response = openai.chat.completions.create(model=MODEL, messages=messages)\n", - " \n", - " reply = response.choices[0].message.content\n", - " history += [{\"role\":\"assistant\", \"content\":reply}]\n", - "\n", - " # Comment out or delete the next line if you'd rather skip Audio for now..\n", - " talker(reply)\n", - " \n", - " return history, image" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f38d0d27-33bf-4992-a2e5-5dbed973cde7", - "metadata": {}, - "outputs": [], - "source": [ - "# More involved Gradio code as we're not using the preset Chat interface!\n", - "# Passing in inbrowser=True in the last line will cause a Gradio window to pop up immediately.\n", - "\n", - "with gr.Blocks() as ui:\n", - " with gr.Row():\n", - " chatbot = gr.Chatbot(height=500, type=\"messages\")\n", - " image_output = gr.Image(height=500)\n", - " with gr.Row():\n", - " entry = gr.Textbox(label=\"Chat with our AI Assistant:\")\n", - " with gr.Row():\n", - " clear = gr.Button(\"Clear\")\n", - "\n", - " def do_entry(message, history):\n", - " history += [{\"role\":\"user\", \"content\":message}]\n", - " return \"\", history\n", - "\n", - " entry.submit(do_entry, inputs=[entry, chatbot], outputs=[entry, chatbot]).then(\n", - " chat, inputs=chatbot, outputs=[chatbot, image_output]\n", - " )\n", - " clear.click(lambda: None, inputs=None, outputs=chatbot, queue=False)\n", - "\n", - "ui.launch(inbrowser=True)" - ] - }, - { - "cell_type": "markdown", - "id": "226643d2-73e4-4252-935d-86b8019e278a", - "metadata": {}, - "source": [ - "# Exercises and Business Applications\n", - "\n", - "Add in more tools - perhaps to simulate actually booking a flight. A student has done this and provided their example in the community contributions folder.\n", - "\n", - "Next: take this and apply it to your business. Make a multi-modal AI assistant with tools that could carry out an activity for your work. A customer support assistant? New employee onboarding assistant? So many possibilities! Also, see the week2 end of week Exercise in the separate Notebook." - ] - }, - { - "cell_type": "markdown", - "id": "7e795560-1867-42db-a256-a23b844e6fbe", - "metadata": {}, - "source": [ - "\n", - " \n", - " \n", - " \n", - " \n", - "
\n", - " \n", - " \n", - "

I have a special request for you

\n", - " \n", - " My editor tells me that it makes a HUGE difference when students rate this course on Udemy - it's one of the main ways that Udemy decides whether to show it to others. If you're able to take a minute to rate this, I'd be so very grateful! And regardless - always please reach out to me at ed@edwarddonner.com if I can help at any point.\n", - " \n", - "
" - ] } ], "metadata": { From 9c02e92d45b254a8b603ccad68fc451961d1caac Mon Sep 17 00:00:00 2001 From: Kartik Date: Sat, 30 Aug 2025 15:22:04 +0530 Subject: [PATCH 23/25] move to community folder --- .../day5_stock-assistant-with-tools.ipynb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename week2/{stock-api-day5.ipynb => community-contributions/day5_stock-assistant-with-tools.ipynb} (100%) diff --git a/week2/stock-api-day5.ipynb b/week2/community-contributions/day5_stock-assistant-with-tools.ipynb similarity index 100% rename from week2/stock-api-day5.ipynb rename to week2/community-contributions/day5_stock-assistant-with-tools.ipynb From 2fb9f44664a7c4eb848cd07445f726fff53e52fc Mon Sep 17 00:00:00 2001 From: Kartik Date: Sat, 30 Aug 2025 15:45:59 +0530 Subject: [PATCH 24/25] clear outputs --- .../day5_stock-assistant-with-tools.ipynb | 186 ++++++------------ 1 file changed, 64 insertions(+), 122 deletions(-) diff --git a/week2/community-contributions/day5_stock-assistant-with-tools.ipynb b/week2/community-contributions/day5_stock-assistant-with-tools.ipynb index 8848482..f0acfd3 100644 --- a/week2/community-contributions/day5_stock-assistant-with-tools.ipynb +++ b/week2/community-contributions/day5_stock-assistant-with-tools.ipynb @@ -10,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 170, + "execution_count": 1, "id": "b7bd1bd7-19d9-4c4b-bc4b-9bc9cca8bd0f", "metadata": {}, "outputs": [ @@ -33,7 +33,7 @@ }, { "cell_type": "code", - "execution_count": 171, + "execution_count": 2, "id": "8b50bbe2-c0b1-49c3-9a5c-1ba7efa2bcb4", "metadata": {}, "outputs": [], @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 172, + "execution_count": 3, "id": "ba0ddc1a-c775-4ed3-9531-ed0c5799e87f", "metadata": {}, "outputs": [ @@ -60,7 +60,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "2025-08-30 15:05:58,159 [INFO] Logger initialized!\n" + "2025-08-30 15:23:48,810 [INFO] Logger initialized!\n" ] } ], @@ -80,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 173, + "execution_count": 4, "id": "747e8786-9da8-4342-b6c9-f5f69c2e22ae", "metadata": {}, "outputs": [ @@ -88,8 +88,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "2025-08-30 15:05:58,164 [INFO] OpenAI API Key exists and begins sk-proj-\n", - "2025-08-30 15:05:58,164 [INFO] FINNHUB_API_KEY exists!\n" + "2025-08-30 15:23:48,813 [INFO] OpenAI API Key exists and begins sk-proj-\n", + "2025-08-30 15:23:48,814 [INFO] FINNHUB_API_KEY exists!\n" ] } ], @@ -118,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 174, + "execution_count": 5, "id": "ee3aaa9a-5495-42fd-a382-803fbfa92eaf", "metadata": {}, "outputs": [], @@ -204,7 +204,7 @@ }, { "cell_type": "code", - "execution_count": 175, + "execution_count": 6, "id": "fdf1a2b0-07be-47a0-9ce3-14d21b48c8f2", "metadata": {}, "outputs": [], @@ -226,7 +226,7 @@ }, { "cell_type": "code", - "execution_count": 176, + "execution_count": 7, "id": "12d912fc-91fb-469e-9572-2876a099f5aa", "metadata": {}, "outputs": [], @@ -245,7 +245,7 @@ }, { "cell_type": "code", - "execution_count": 177, + "execution_count": 8, "id": "61a2a15d-b559-4844-b377-6bd5cb4949f6", "metadata": {}, "outputs": [], @@ -287,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 178, + "execution_count": 9, "id": "173010e3-dfef-4611-8b68-d11256bd5fba", "metadata": {}, "outputs": [], @@ -314,7 +314,7 @@ }, { "cell_type": "code", - "execution_count": 179, + "execution_count": 10, "id": "448bb4ce-8e86-4ceb-ab52-96bddfd33337", "metadata": {}, "outputs": [], @@ -409,7 +409,7 @@ }, { "cell_type": "code", - "execution_count": 180, + "execution_count": 11, "id": "9df7b74e-fec8-4e75-92a9-31acc75e6e97", "metadata": {}, "outputs": [], @@ -437,7 +437,7 @@ }, { "cell_type": "code", - "execution_count": 181, + "execution_count": 12, "id": "cfeeb200-3f30-4855-82b9-cc8b2a950f80", "metadata": {}, "outputs": [], @@ -483,7 +483,7 @@ }, { "cell_type": "code", - "execution_count": 182, + "execution_count": 13, "id": "3724d92a-4515-4267-af6f-2c1ec2b6ed36", "metadata": {}, "outputs": [], @@ -508,7 +508,7 @@ }, { "cell_type": "code", - "execution_count": 183, + "execution_count": 14, "id": "62f5d477-6626-428f-b8eb-d763e736ef5b", "metadata": {}, "outputs": [], @@ -573,7 +573,7 @@ }, { "cell_type": "code", - "execution_count": 184, + "execution_count": 15, "id": "5150ecb6-e3f1-46dc-94fa-2a9abe5165f6", "metadata": {}, "outputs": [], @@ -610,7 +610,7 @@ }, { "cell_type": "code", - "execution_count": 185, + "execution_count": 16, "id": "26dd7375-626f-4235-b4a2-f1926f62cc5e", "metadata": {}, "outputs": [], @@ -657,7 +657,7 @@ }, { "cell_type": "code", - "execution_count": 186, + "execution_count": 17, "id": "5bd1aa28-119c-4c7a-bdc0-161a582ab1cc", "metadata": {}, "outputs": [], @@ -682,7 +682,7 @@ }, { "cell_type": "code", - "execution_count": 187, + "execution_count": 18, "id": "fbe8ef6c-2d88-43a2-94dc-70b507fe9cd2", "metadata": {}, "outputs": [], @@ -761,7 +761,7 @@ }, { "cell_type": "code", - "execution_count": 188, + "execution_count": 19, "id": "9eaeae75-d68f-4160-a26e-c13e40cf756b", "metadata": {}, "outputs": [], @@ -797,7 +797,7 @@ }, { "cell_type": "code", - "execution_count": 189, + "execution_count": 20, "id": "bdca8679-935f-4e7f-97e6-e71a4d4f228c", "metadata": {}, "outputs": [], @@ -831,7 +831,7 @@ }, { "cell_type": "code", - "execution_count": 190, + "execution_count": 21, "id": "86f76f57-76c4-4dc7-94a8-cfe7816a39f1", "metadata": {}, "outputs": [], @@ -861,7 +861,7 @@ }, { "cell_type": "code", - "execution_count": 191, + "execution_count": 22, "id": "ce9b0744-9c78-408d-b9df-9f6fd9ed78cf", "metadata": {}, "outputs": [], @@ -949,7 +949,7 @@ }, { "cell_type": "code", - "execution_count": 192, + "execution_count": 23, "id": "f4be8a71-b19e-4c2f-80df-f59ff2661f14", "metadata": {}, "outputs": [ @@ -957,22 +957,45 @@ "name": "stderr", "output_type": "stream", "text": [ - "2025-08-30 15:06:02,319 [INFO] HTTP Request: GET http://127.0.0.1:7871/gradio_api/startup-events \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:02,322 [INFO] HTTP Request: HEAD http://127.0.0.1:7871/ \"HTTP/1.1 200 OK\"\n" + "2025-08-30 15:23:51,219 [INFO] HTTP Request: GET http://127.0.0.1:7860/gradio_api/startup-events \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:23:51,226 [INFO] HTTP Request: HEAD http://127.0.0.1:7860/ \"HTTP/1.1 200 OK\"\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "* Running on local URL: http://127.0.0.1:7871\n", - "* To create a public link, set `share=True` in `launch()`.\n" + "* Running on local URL: http://127.0.0.1:7860\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-08-30 15:23:52,534 [INFO] HTTP Request: GET https://api.gradio.app/pkg-version \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:23:52,536 [INFO] HTTP Request: GET https://api.gradio.app/v3/tunnel-request \"HTTP/1.1 200 OK\"\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "* Running on public URL: https://8532ed0b314508005c.gradio.live\n", + "\n", + "This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2025-08-30 15:23:56,230 [INFO] HTTP Request: HEAD https://8532ed0b314508005c.gradio.live \"HTTP/1.1 200 OK\"\n" ] }, { "data": { "text/html": [ - "
" + "
" ], "text/plain": [ "" @@ -985,7 +1008,7 @@ "data": { "text/plain": [] }, - "execution_count": 192, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" }, @@ -993,102 +1016,21 @@ "name": "stderr", "output_type": "stream", "text": [ - "2025-08-30 15:06:03,572 [INFO] HTTP Request: GET https://api.gradio.app/pkg-version \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:07,415 [INFO] \n", + "2025-08-30 15:26:10,184 [INFO] \n", "Messages:\n", - "{'role': 'user', 'content': 'apple stock earnings?'}\n", + "{'role': 'user', 'content': 'Tell me the performance of eli lilly'}\n", "\n", - "2025-08-30 15:06:07,971 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:07,979 [INFO] Executing tool: get_current_time with args: {}\n", - "2025-08-30 15:06:08,580 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:08,782 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'AAPL', '_from': '2025-07-30', 'to': '2025-08-30'}\n", - "2025-08-30 15:06:08,785 [INFO] Tool get_earnings_calendar called for AAPL from 2025-07-30 to 2025-08-30\n", - "2025-08-30 15:06:10,398 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:16,366 [INFO] \n", - "Messages:\n", - "{'role': 'user', 'metadata': None, 'content': 'apple stock earnings?', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': 'Apple (AAPL) reported its Q3 2025 earnings on July 31, 2025, after market close. \\n- Actual EPS: $1.57 (estimate was $1.46) \\n- Actual Revenue: $94.04 billion (estimate was about $91.3 billion)', 'options': None}\n", - "{'role': 'user', 'content': 'nvidia q1 earnings'}\n", - "\n", - "2025-08-30 15:06:17,205 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:17,221 [INFO] Executing tool: get_current_time with args: {}\n", - "2025-08-30 15:06:17,775 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:18,023 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'NVDA', '_from': '2025-05-01', 'to': '2025-08-30'}\n", - "2025-08-30 15:06:18,026 [INFO] Tool get_earnings_calendar called for NVDA from 2025-05-01 to 2025-08-30\n", - "2025-08-30 15:06:18,842 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:28,656 [INFO] \n", - "Messages:\n", - "{'role': 'user', 'metadata': None, 'content': 'apple stock earnings?', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': 'Apple (AAPL) reported its Q3 2025 earnings on July 31, 2025, after market close. \\n- Actual EPS: $1.57 (estimate was $1.46) \\n- Actual Revenue: $94.04 billion (estimate was about $91.3 billion)', 'options': None}\n", - "{'role': 'user', 'metadata': None, 'content': 'nvidia q1 earnings', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': \"NVIDIA's most recent earnings were for Q2 2026, reported on August 27, 2025: \\n- EPS: $1.05 (estimate was about $1.03) \\n- Revenue: $46.7 billion (estimate was about $46.98 billion) \\n\\nQ1 2026 earnings data is not in the recent range. Would you like details for a different quarter or time frame?\", 'options': None}\n", - "{'role': 'user', 'content': 'q1 2025'}\n", - "\n", - "2025-08-30 15:06:29,790 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:29,805 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'NVDA', '_from': '2025-01-01', 'to': '2025-03-31'}\n", - "2025-08-30 15:06:29,807 [INFO] Tool get_earnings_calendar called for NVDA from 2025-01-01 to 2025-03-31\n", - "2025-08-30 15:06:29,808 [INFO] Executing tool: get_current_time with args: {}\n", - "2025-08-30 15:06:30,404 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:38,997 [INFO] \n", - "Messages:\n", - "{'role': 'user', 'metadata': None, 'content': 'apple stock earnings?', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': 'Apple (AAPL) reported its Q3 2025 earnings on July 31, 2025, after market close. \\n- Actual EPS: $1.57 (estimate was $1.46) \\n- Actual Revenue: $94.04 billion (estimate was about $91.3 billion)', 'options': None}\n", - "{'role': 'user', 'metadata': None, 'content': 'nvidia q1 earnings', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': \"NVIDIA's most recent earnings were for Q2 2026, reported on August 27, 2025: \\n- EPS: $1.05 (estimate was about $1.03) \\n- Revenue: $46.7 billion (estimate was about $46.98 billion) \\n\\nQ1 2026 earnings data is not in the recent range. Would you like details for a different quarter or time frame?\", 'options': None}\n", - "{'role': 'user', 'metadata': None, 'content': 'q1 2025', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': \"I cannot retrieve NVIDIA's Q1 2025 earnings because the data must be from within the last month. I can help with more recent earnings or other stock info if you want.\", 'options': None}\n", - "{'role': 'user', 'content': 'microsoft?'}\n", - "\n", - "2025-08-30 15:06:40,071 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:40,327 [INFO] Executing tool: get_current_time with args: {}\n", - "2025-08-30 15:06:40,328 [INFO] Executing tool: get_company_financials with args: {'symbol': 'MSFT'}\n", - "2025-08-30 15:06:40,330 [INFO] Tool get_company_financials called for MSFT\n", - "2025-08-30 15:06:41,437 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'MSFT', '_from': '2025-08-01', 'to': '2025-08-29'}\n", - "2025-08-30 15:06:41,439 [INFO] Tool get_earnings_calendar called for MSFT from 2025-08-01 to 2025-08-29\n", - "2025-08-30 15:06:42,284 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:47,742 [INFO] \n", - "Messages:\n", - "{'role': 'user', 'metadata': None, 'content': 'apple stock earnings?', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': 'Apple (AAPL) reported its Q3 2025 earnings on July 31, 2025, after market close. \\n- Actual EPS: $1.57 (estimate was $1.46) \\n- Actual Revenue: $94.04 billion (estimate was about $91.3 billion)', 'options': None}\n", - "{'role': 'user', 'metadata': None, 'content': 'nvidia q1 earnings', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': \"NVIDIA's most recent earnings were for Q2 2026, reported on August 27, 2025: \\n- EPS: $1.05 (estimate was about $1.03) \\n- Revenue: $46.7 billion (estimate was about $46.98 billion) \\n\\nQ1 2026 earnings data is not in the recent range. Would you like details for a different quarter or time frame?\", 'options': None}\n", - "{'role': 'user', 'metadata': None, 'content': 'q1 2025', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': \"I cannot retrieve NVIDIA's Q1 2025 earnings because the data must be from within the last month. I can help with more recent earnings or other stock info if you want.\", 'options': None}\n", - "{'role': 'user', 'metadata': None, 'content': 'microsoft?', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': 'Microsoft (MSFT) key financials: \\n- Market Cap: $3.79 trillion \\n- P/E Ratio (TTM): 37.23 \\n- EPS (TTM): $13.64 \\n- Dividend Yield: 0.65% \\n- 52-Week Range: $344.79 – $555.45 \\n\\nNo Q1 2025 or recent earnings releases found within August 2025. Would you like info on a different date or other details?', 'options': None}\n", - "{'role': 'user', 'content': 'latest earnings'}\n", - "\n", - "2025-08-30 15:06:48,343 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:48,368 [INFO] Executing tool: get_current_time with args: {}\n", - "2025-08-30 15:06:48,985 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:49,242 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'MSFT', '_from': '2025-07-30', 'to': '2025-08-30'}\n", - "2025-08-30 15:06:49,243 [INFO] Tool get_earnings_calendar called for MSFT from 2025-07-30 to 2025-08-30\n", - "2025-08-30 15:06:49,956 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:06:59,770 [INFO] \n", - "Messages:\n", - "{'role': 'user', 'metadata': None, 'content': 'apple stock earnings?', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': 'Apple (AAPL) reported its Q3 2025 earnings on July 31, 2025, after market close. \\n- Actual EPS: $1.57 (estimate was $1.46) \\n- Actual Revenue: $94.04 billion (estimate was about $91.3 billion)', 'options': None}\n", - "{'role': 'user', 'metadata': None, 'content': 'nvidia q1 earnings', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': \"NVIDIA's most recent earnings were for Q2 2026, reported on August 27, 2025: \\n- EPS: $1.05 (estimate was about $1.03) \\n- Revenue: $46.7 billion (estimate was about $46.98 billion) \\n\\nQ1 2026 earnings data is not in the recent range. Would you like details for a different quarter or time frame?\", 'options': None}\n", - "{'role': 'user', 'metadata': None, 'content': 'q1 2025', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': \"I cannot retrieve NVIDIA's Q1 2025 earnings because the data must be from within the last month. I can help with more recent earnings or other stock info if you want.\", 'options': None}\n", - "{'role': 'user', 'metadata': None, 'content': 'microsoft?', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': 'Microsoft (MSFT) key financials: \\n- Market Cap: $3.79 trillion \\n- P/E Ratio (TTM): 37.23 \\n- EPS (TTM): $13.64 \\n- Dividend Yield: 0.65% \\n- 52-Week Range: $344.79 – $555.45 \\n\\nNo Q1 2025 or recent earnings releases found within August 2025. Would you like info on a different date or other details?', 'options': None}\n", - "{'role': 'user', 'metadata': None, 'content': 'latest earnings', 'options': None}\n", - "{'role': 'assistant', 'metadata': None, 'content': 'Microsoft has not reported any earnings releases in the last month up to August 30, 2025. Would you like me to check a different date range or provide recent earnings for another company?', 'options': None}\n", - "{'role': 'user', 'content': 'nvidia'}\n", - "\n", - "2025-08-30 15:07:00,871 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:07:00,901 [INFO] Executing tool: get_current_time with args: {}\n", - "2025-08-30 15:07:01,680 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:07:01,944 [INFO] Executing tool: get_earnings_calendar with args: {'symbol': 'NVDA', '_from': '2025-07-30', 'to': '2025-08-30'}\n", - "2025-08-30 15:07:01,947 [INFO] Tool get_earnings_calendar called for NVDA from 2025-07-30 to 2025-08-30\n", - "2025-08-30 15:07:02,980 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n" + "2025-08-30 15:26:11,569 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", + "2025-08-30 15:26:11,592 [INFO] Executing tool: get_stock_quote with args: {'symbol': 'LLY'}\n", + "2025-08-30 15:26:11,594 [INFO] Tool get_stock_quote called for LLY\n", + "2025-08-30 15:26:12,419 [INFO] Executing tool: get_company_financials with args: {'symbol': 'LLY'}\n", + "2025-08-30 15:26:12,420 [INFO] Tool get_company_financials called for LLY\n", + "2025-08-30 15:26:14,097 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n" ] } ], "source": [ - "gr.ChatInterface(fn=chat, type=\"messages\", title=\"TickerBot\", description=\"Ask about stock prices, company financials and market news!\").launch()" + "gr.ChatInterface(fn=chat, type=\"messages\", title=\"TickerBot\", description=\"Ask about stock prices, company financials and market news!\").launch(share=True)" ] }, { From 08e7319b0dabe4f8e96b55fe619b5344d8ec143f Mon Sep 17 00:00:00 2001 From: Kartik Date: Sat, 30 Aug 2025 15:48:43 +0530 Subject: [PATCH 25/25] clear outputs --- .../day5_stock-assistant-with-tools.ipynb | 160 +++--------------- 1 file changed, 27 insertions(+), 133 deletions(-) diff --git a/week2/community-contributions/day5_stock-assistant-with-tools.ipynb b/week2/community-contributions/day5_stock-assistant-with-tools.ipynb index f0acfd3..1e129aa 100644 --- a/week2/community-contributions/day5_stock-assistant-with-tools.ipynb +++ b/week2/community-contributions/day5_stock-assistant-with-tools.ipynb @@ -10,30 +10,17 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "b7bd1bd7-19d9-4c4b-bc4b-9bc9cca8bd0f", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: finnhub-python in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (2.4.24)\n", - "Requirement already satisfied: requests>=2.22.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from finnhub-python) (2.32.3)\n", - "Requirement already satisfied: charset_normalizer<4,>=2 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from requests>=2.22.0->finnhub-python) (3.4.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from requests>=2.22.0->finnhub-python) (3.10)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from requests>=2.22.0->finnhub-python) (2.4.0)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from requests>=2.22.0->finnhub-python) (2025.4.26)\n" - ] - } - ], + "outputs": [], "source": [ "!pip install finnhub-python" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "8b50bbe2-c0b1-49c3-9a5c-1ba7efa2bcb4", "metadata": {}, "outputs": [], @@ -52,18 +39,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "ba0ddc1a-c775-4ed3-9531-ed0c5799e87f", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2025-08-30 15:23:48,810 [INFO] Logger initialized!\n" - ] - } - ], + "outputs": [], "source": [ "import logging\n", "\n", @@ -80,19 +59,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "747e8786-9da8-4342-b6c9-f5f69c2e22ae", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2025-08-30 15:23:48,813 [INFO] OpenAI API Key exists and begins sk-proj-\n", - "2025-08-30 15:23:48,814 [INFO] FINNHUB_API_KEY exists!\n" - ] - } - ], + "outputs": [], "source": [ "# Initialization\n", "\n", @@ -118,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ee3aaa9a-5495-42fd-a382-803fbfa92eaf", "metadata": {}, "outputs": [], @@ -204,7 +174,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "fdf1a2b0-07be-47a0-9ce3-14d21b48c8f2", "metadata": {}, "outputs": [], @@ -226,7 +196,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "12d912fc-91fb-469e-9572-2876a099f5aa", "metadata": {}, "outputs": [], @@ -245,7 +215,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "61a2a15d-b559-4844-b377-6bd5cb4949f6", "metadata": {}, "outputs": [], @@ -287,7 +257,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "173010e3-dfef-4611-8b68-d11256bd5fba", "metadata": {}, "outputs": [], @@ -314,7 +284,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "448bb4ce-8e86-4ceb-ab52-96bddfd33337", "metadata": {}, "outputs": [], @@ -409,7 +379,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "9df7b74e-fec8-4e75-92a9-31acc75e6e97", "metadata": {}, "outputs": [], @@ -437,7 +407,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "cfeeb200-3f30-4855-82b9-cc8b2a950f80", "metadata": {}, "outputs": [], @@ -483,7 +453,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "3724d92a-4515-4267-af6f-2c1ec2b6ed36", "metadata": {}, "outputs": [], @@ -508,7 +478,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "62f5d477-6626-428f-b8eb-d763e736ef5b", "metadata": {}, "outputs": [], @@ -573,7 +543,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "5150ecb6-e3f1-46dc-94fa-2a9abe5165f6", "metadata": {}, "outputs": [], @@ -610,7 +580,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "26dd7375-626f-4235-b4a2-f1926f62cc5e", "metadata": {}, "outputs": [], @@ -657,7 +627,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "5bd1aa28-119c-4c7a-bdc0-161a582ab1cc", "metadata": {}, "outputs": [], @@ -682,7 +652,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "fbe8ef6c-2d88-43a2-94dc-70b507fe9cd2", "metadata": {}, "outputs": [], @@ -761,7 +731,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "9eaeae75-d68f-4160-a26e-c13e40cf756b", "metadata": {}, "outputs": [], @@ -797,7 +767,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "bdca8679-935f-4e7f-97e6-e71a4d4f228c", "metadata": {}, "outputs": [], @@ -831,7 +801,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "86f76f57-76c4-4dc7-94a8-cfe7816a39f1", "metadata": {}, "outputs": [], @@ -861,7 +831,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "ce9b0744-9c78-408d-b9df-9f6fd9ed78cf", "metadata": {}, "outputs": [], @@ -949,86 +919,10 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "f4be8a71-b19e-4c2f-80df-f59ff2661f14", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2025-08-30 15:23:51,219 [INFO] HTTP Request: GET http://127.0.0.1:7860/gradio_api/startup-events \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:23:51,226 [INFO] HTTP Request: HEAD http://127.0.0.1:7860/ \"HTTP/1.1 200 OK\"\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "* Running on local URL: http://127.0.0.1:7860\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2025-08-30 15:23:52,534 [INFO] HTTP Request: GET https://api.gradio.app/pkg-version \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:23:52,536 [INFO] HTTP Request: GET https://api.gradio.app/v3/tunnel-request \"HTTP/1.1 200 OK\"\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "* Running on public URL: https://8532ed0b314508005c.gradio.live\n", - "\n", - "This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2025-08-30 15:23:56,230 [INFO] HTTP Request: HEAD https://8532ed0b314508005c.gradio.live \"HTTP/1.1 200 OK\"\n" - ] - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2025-08-30 15:26:10,184 [INFO] \n", - "Messages:\n", - "{'role': 'user', 'content': 'Tell me the performance of eli lilly'}\n", - "\n", - "2025-08-30 15:26:11,569 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n", - "2025-08-30 15:26:11,592 [INFO] Executing tool: get_stock_quote with args: {'symbol': 'LLY'}\n", - "2025-08-30 15:26:11,594 [INFO] Tool get_stock_quote called for LLY\n", - "2025-08-30 15:26:12,419 [INFO] Executing tool: get_company_financials with args: {'symbol': 'LLY'}\n", - "2025-08-30 15:26:12,420 [INFO] Tool get_company_financials called for LLY\n", - "2025-08-30 15:26:14,097 [INFO] HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n" - ] - } - ], + "outputs": [], "source": [ "gr.ChatInterface(fn=chat, type=\"messages\", title=\"TickerBot\", description=\"Ask about stock prices, company financials and market news!\").launch(share=True)" ]