0.3 C
New York
Sunday, February 23, 2025

This o3-mini Agent Can Predict Gold Costs!


Gold costs have been capturing up recently, attracting an increasing number of traders on a regular basis. In simply the final 2 weeks, the value of pure gold has gone up 10%, marking a considerable achieve on funding. What if there was an agent that might autonomously replace you on each day gold charges? What if the agent might even predict tomorrow’s gold costs, serving to you make the correct transfer on the proper time? With o3-mini AI integration, we are able to develop clever methods that may analyze monetary traits and generate structured insights. On this article, we are going to construct a worth prediction agent with o3-mini to trace pure gold costs. It might leverage o3-mini operate calling for correct knowledge retrieval and o3-mini’s structured output for clear, actionable predictions.

Why Ought to We Contemplate Utilizing o3-mini?

There are such a lot of totally different instruments and platforms out there at this time for constructing AI brokers. Then why are we utilizing o3-mini? Nicely, listed below are the primary causes for selecting o3-mini for constructing our worth prediction agent:

  • Environment friendly Automation & Actual-Time Efficiency: Allows quick response instances with cheap accuracy, making it best for chatbots, coding assistants, and AI automation instruments.
  • Light-weight & Value-Efficient: Runs easily on consumer-grade {hardware}, lowering cloud prices and vitality consumption.
  • Robust Coding & Reasoning: Excels in debugging, code technology, and problem-solving regardless of its smaller dimension.
  • Developer-Pleasant & Scalable: Helps AI integration into workflows and deploys simply on cell and edge gadgets.
  • Versatile & Ideally suited for Experimentation: Allows fast prototyping for AI-driven functions throughout automation, coding, and conversational AI.

To know simply how good this mannequin is, right here’s a comparability of o3-mini towards different prime fashions on numerous customary benchmarks.

o3-mini benchmarks

Additionally Learn: Is OpenAI’s o3-mini Higher Than DeepSeek-R1?

And right here’s how cost-effective it’s:

o3-mini pricing

Sources:

Setting Up the Atmosphere

Earlier than constructing the agent, we are going to first cowl the mandatory conditions and arrange the surroundings.

Conditions

Accessing the API

We shall be utilizing two APIs right here. One OpenAI API is used to entry the o3-mini mannequin, and the opposite Serper API is used to entry the Google search engine to examine at this time’s gold worth.

OpenAI API access

Additionally Learn: The best way to Run OpenAI’s o3-mini on Google Colab?

Constructing an AI Agent Utilizing o3-mini

On this part, I’ll stroll you thru the method of constructing a gold worth prediction agent utilizing o3-mini. We’ll create an agent that analyzes market traits and offers insights into potential worth actions.

I’ll information you thru making API calls, structuring prompts, and processing the generated predictions effectively. By the top, you’ll have a working gold prediction agent able to providing data-driven gold worth forecasts. So let’s start.

Now that you’ve each APIs, let’s transfer to the code editor and construct our software.

Step 1:  Organising Libraries and Instruments to Information AI Agent

First we shall be importing all the mandatory libraries and instruments that we are going to want right here

import os
import pandas as pd
from datetime import datetime, timedelta
from crewai_tools import ScrapeWebsiteTool, SerperDevTool
from crewai import Agent, Process, Crew, Course of
from langchain_openai import ChatOpenAI
import warnings
warnings.filterwarnings('ignore')

search_tool = SerperDevTool()
scrape_tool = ScrapeWebsiteTool()
  1. search_tool: The SerperDevTool() will assist us to entry the google search engine to retrieve the present data in our case its gold worth.
  2. scrape_tool: The ScrapeWebsiteTool() will assist us to extract the related data from the searched webpage.

Step 2: Calling the API

To make use of the o3-mini and the google search engine first now we have to load the OpenAI and Serper API. So this block will assist us to loading the APIs.

with open("/house/vipin/Desktop/api_key/serper_api") as file:
    get_serper_api_key = file.learn().strip()

with open("/house/vipin/Desktop/api_key/api_key_pro_blog.txt") as file:
    api_key = file.learn().strip()
    
os.environ["OPENAI_API_KEY"] = api_key
os.environ["OPENAI_MODEL_NAME"] = "o3-mini-2025-01-31"
os.environ["SERPER_API_KEY"] = get_serper_api_key

Step 3: Creating Brokers and Duties

First, let’s create the required brokers and outline their duties.

Creating Brokers:

We’ll want 2 brokers:

  1. Gold Value Analyst agent will analyze the present worth of gold available in the market. Extracts structured knowledge on gold costs and identifies macroeconomic components influencing worth actions.
  2. Value Predictor agent will forecast whether or not the gold worth will rise or fall based mostly on historic and macroeconomic knowledge and use previous worth traits, financial indicators, and machine studying insights to make each day predictions.

Gold Value Analyst

The Gold Value Information Analyst Agent gathers real-time gold costs and analyzes financial components akin to inflation, forex fluctuations, and international market traits. It offers structured insights that assist refine market predictions.

gold_price_analyst_agent = Agent(
    function="Gold Value Information Analyst",
    aim="Repeatedly monitor and analyze 24K gold worth in India from {url}.",
    backstory="This agent makes a speciality of commodity worth monitoring, extracting structured knowledge from {url}, and analyzing macroeconomic traits affecting gold costs.",
    verbose=True,
    allow_delegation=True,
    instruments=[scrape_tool, search_tool]
)

Value Predictor

The Gold Value Predictor Agent makes use of machine studying fashions to forecast future gold worth actions each day. It processes historic knowledge and macroeconomic insights from the Analyst Agent to generate correct predictions, constantly refining its mannequin based mostly on precise market traits.

gold_price_predictor_agent = Agent(
    function="Gold Value Predictor",
    aim="Predict whether or not 24K gold worth in India will go up or down tomorrow utilizing previous knowledge and macroeconomic traits.",
    backstory="Utilizing historic knowledge, macroeconomic traits, and machine studying insights, this agent predicts each day gold worth actions and backtests predictions for accuracy.",
    verbose=True,
    allow_delegation=True,
    instruments=[scrape_tool, search_tool]
)

Assigning the Duties:

Now let’s outline the duties.

Process 1: Fetch Right this moment’s Gold Value

The Fetch Right this moment’s Gold Value Process is liable for retrieving real-time gold costs in India from numerous international sources. It offers an in depth report that features historic comparisons, regional worth variations, and present market charges.

# Process for Information Analyst Agent: Analyze Market Information
fetch_todays_gold_price = Process(
    description="Scrape the newest 24K gold worth in India from {url} and analyze macroeconomic traits affecting worth actions.",
    expected_output="Right this moment's gold worth and key macroeconomic traits influencing its motion.",
    agent=gold_price_analyst_agent,
)

Process 2: Gold Value Predictor

The Gold Value Predictor Process leverages historic knowledge, macroeconomic indicators, and machine studying fashions to forecast gold costs for various timeframes—subsequent day, subsequent week, subsequent month, and subsequent yr. The output is an in depth report with future worth predictions, enabling traders and monetary analysts to plan their methods with better confidence.

gold_price_predictor = Process(
    description=(
        "Collect gold worth knowledge for the previous 2 weeks and predict each day actions additionally give the sources from the place you take the info. Point out the date and likewise the supply of knowledge taken"
        "Solely search for final 3 days knowledge whereas making prediction for any date. Validate every day's prediction towards precise values, bettering accuracy iteratively."
        "Do not look on precise worth for every day earlier than making prediction."
    ),
    expected_output="An in depth report on prediction accuracy over the previous 2 weeks and tomorrow's anticipated gold worth motion.",
    agent=gold_price_predictor_agent,
)

Step 4: Creating the Crew

The Gold Value Predictor Crew is a structured AI system that brings collectively all of the brokers. These brokers work collaboratively to trace real-time gold costs, analyze market influences, and predict future traits. Utilizing the o3-mini mannequin with a hierarchical course of, the crew ensures an environment friendly workflow for gathering knowledge, figuring out fluctuations, and producing gold worth forecasts.

gold_price_predictor_crew = Crew(
    brokers=[gold_price_analyst_agent, gold_price_predictor_agent],
    duties=[fetch_todays_gold_price, gold_price_predictor],
    manager_llm=ChatOpenAI(mannequin="o3-mini-2025-01-31", temperature=0.3),
    course of=Course of.sequential,
    verbose=True
)

Step 5: Kickoff the Crew

The Gold Value Predictor Crew is initiated utilizing the kickoff operate with particular inputs. This triggers the collaborative workflow, the place every agent executes its assigned job. The ultimate result’s a well-structured report, offering real-time costs, market insights, and future worth predictions to help traders in making knowledgeable selections.

inputs = {"Question": "What would be the gold worth motion in India for the subsequent day?",
         "url": "https://www.goodreturns.in/gold-rates/"} 
outcome = gold_price_predictor_crew.kickoff(inputs=inputs)

Output

This can assist us current the output in a markdown(.md) format.

from IPython.show import Markdown
markdown_content = outcome.uncooked
show(Markdown(markdown_content))
Price prediction agent with o3-mini
Price prediction agent with o3-mini
Price prediction agent with o3-mini
14-days 24-karat gold price prediction
14-days 24-karat gold price prediction
gold rate output
price prediction
o3-mini iterative improvement
24-karat gold price

Warning!

As you’ll be able to see within the output, the agent makes its predictions based mostly on nearly all of the outcomes of the earlier days. Its much like how we people guess the subsequent day’s worth based mostly on whether or not the value has been going up or down off late. This isn’t actually correct and shouldn’t be thought of a strong worth prediction software. There are different machine studying fashions like ARIMA, LSTM, and so on. that perhaps extra dependable on this case.

Therefore, this evaluation ought to solely be thought of as an illustration to indicate how an agent for this job might work, and extra importantly, to discover ways to construct an agent utilizing o3-mini. Due to this fact, don’t take it as monetary recommendation. Monetary markets are unpredictable, and buying and selling them with out correct due diligence is dangerous. At all times conduct your personal analysis and seek the advice of a monetary skilled earlier than making funding selections.

Conclusion

On this article, we’ve discovered the way to construct a gold prediction agent utilizing o3-mini, a quick and environment friendly AI mannequin. o3-mini is a light-weight but highly effective software for analyzing market traits, making it best for forecasting-related duties. Its affordability and effectivity make it an awesome selection for builders trying to combine AI into their workflows and methods.

As gold and e-gold investments develop in recognition, having an AI-driven prediction agent might help establish worthwhile alternatives, cut back dangers, and enhance decision-making. By analyzing traits, the agent streamlines market analysis and offers well timed insights. Nevertheless, it’s necessary to notice that this basic-level agent shouldn’t be solely relied upon for funding selections. At all times complement AI insights with complete market evaluation {and professional} steerage.

Be taught all about OpenAI’s o3-mini on this complete course by Analytics Vidhya. Discover its core options and strengths and learn how it performs on numerous duties by way of sensible hands-on workout routines.

Continuously Requested Questions

Q1. What’s o3-mini?

A. o3-mini is a compact, environment friendly AI mannequin designed to ship sturdy efficiency whereas requiring fewer computational assets. It’s appropriate for a variety of functions, together with coding, conversational AI, and monetary forecasting, providing a steadiness between pace and accuracy.

Q2. How does o3-mini evaluate to bigger fashions like GPT-4o or DeepSeek-V3?

A. o3-mini provides a extra environment friendly and cost-effective various to bigger fashions. Whereas it could not match their efficiency in sure advanced duties, it excels in pace, effectivity, and affordability, making it best for real-time functions with decrease useful resource necessities.

Q3. Can I customise the o3-mini for my particular use case?

A. Sure, the o3-mini is extremely customizable. You’ll be able to alter its configuration, fine-tune it for particular duties, and combine it with exterior knowledge sources to boost its performance. Whether or not it’s for gold prediction or different monetary duties, o3-mini will be tailor-made to satisfy your wants.

This autumn. How correct are the predictions from o3-mini?

A. o3-mini’s accuracy is dependent upon the complexity of the duty and the standard of the info fed to it. For less complicated duties, it could present moderately correct predictions, however for extra intricate evaluation, bigger fashions could also be wanted for improved precision.

Q5. Is the agent dependable for making funding selections?

A. The gold prediction agent is a useful software, however it shouldn’t be relied upon as the only real decision-making useful resource. At all times mix the insights generated by the agent with your personal analysis {and professional} monetary recommendation earlier than making any funding selections.

Good day! I am Vipin, a passionate knowledge science and machine studying fanatic with a robust basis in knowledge evaluation, machine studying algorithms, and programming. I’ve hands-on expertise in constructing fashions, managing messy knowledge, and fixing real-world issues. My aim is to use data-driven insights to create sensible options that drive outcomes. I am desirous to contribute my abilities in a collaborative surroundings whereas persevering with to be taught and develop within the fields of Information Science, Machine Studying, and NLP.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles