Close Menu
    Trending
    • 3D Printer Breaks Kickstarter Record, Raises Over $46M
    • People are using AI to ‘sit’ with them while they trip on psychedelics
    • Reinforcement Learning in the Age of Modern AI | by @pramodchandrayan | Jul, 2025
    • How This Man Grew His Beverage Side Hustle From $1k a Month to 7 Figures
    • Finding the right tool for the job: Visual Search for 1 Million+ Products | by Elliot Ford | Kingfisher-Technology | Jul, 2025
    • How Smart Entrepreneurs Turn Mid-Year Tax Reviews Into Long-Term Financial Wins
    • Become a Better Data Scientist with These Prompt Engineering Tips and Tricks
    • Meanwhile in Europe: How We Learned to Stop Worrying and Love the AI Angst | by Andreas Maier | Jul, 2025
    AIBS News
    • Home
    • Artificial Intelligence
    • Machine Learning
    • AI Technology
    • Data Science
    • More
      • Technology
      • Business
    AIBS News
    Home»Machine Learning»From SQL Agent to Reasoning SQL Agent: A Leap in Intelligent Data Interaction | by Angelina Garnica | May, 2025
    Machine Learning

    From SQL Agent to Reasoning SQL Agent: A Leap in Intelligent Data Interaction | by Angelina Garnica | May, 2025

    Team_AIBS NewsBy Team_AIBS NewsMay 19, 2025No Comments6 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Picture by the creator

    Hey everybody! I’m excited to share some important updates to my SQL agent. For these excited about diving into the complete implementation, you will discover the whole undertaking on my GitHub repository right here: https://github.com/AngelinaGarnica/Alora.

    Following up on my earlier submit (you will discover the preliminary model and the motivation behind its creation here ), one of many key enhancements I envisioned was enabling the agent to make the most of its instruments extra intelligently, discerning when to execute them and when it’s extra acceptable to conclude the dialog or provide the person an information visualization.

    On this weblog submit, I’ll delve into how I achieved these enhancements. My strategy concerned refining the usage of LangGraph by incorporating a devoted reasoning node, a human validation step, and a extra clever charting software. This new charting software immediately leverages the ability of the LLM to generate visualization code, leading to graphs which might be extra related to the information, extra versatile of their design, and aesthetically extra pleasing.

    Agent Structure

    The up to date structure of my agent is structured as follows:

    Agent Structure Graph
    • Reasoning Node: Analyzes the question and determines the subsequent finest motion (e.g., execute a software, ask for clarification, or reply immediately).
    • Human Approval Node: A step to get specific person affirmation earlier than continuing with doubtlessly important actions or utilizing generated knowledge.
    • Graph Device Node: A step to supply the person an choice to visualise the outcomes, usually after knowledge has been retrieved and accredited. When the person confirms the plot, this node interacts with the LLM to generate code for making a related and well-designed chart.

    Rationalization of Enhancements

    Let’s break down the important thing enhancements:

    • Enhanced LangGraph Utilization: By introducing a devoted reasoning node, the agent can now make extra knowledgeable choices about when to have interaction its instruments. This node analyzes the person’s request, considers the obtainable instruments and their capabilities, and determines the best plan of action. This prevents pointless software executions and results in a extra environment friendly and centered interplay.
    • Reasoning Node with Iterative Management: This significant addition permits the agent to assume step-by-step earlier than performing. Moreover, I’ve applied controls to handle the iterative reasoning course of. This consists of mechanisms to forestall infinite loops in reasoning, set most reasoning steps, and introduce standards for the agent to conclude its inside deliberation and proceed with an motion. This ensures a extra steady and predictable conduct.
    • Human Approval Node: Implementing an non-obligatory human validation step provides a layer of management and transparency. Earlier than executing a doubtlessly advanced motion or presenting outcomes, the agent can search the person’s affirmation. That is notably helpful in eventualities the place the person may wish to evaluate or modify the proposed motion.
    • Smarter Charting Device: The brand new charting software represents a major leap ahead. As an alternative of counting on pre-defined templates or much less versatile strategies, it immediately communicates with the LLM. This permits the era of visualization code that’s:
    • Knowledge-Pushed: The LLM understands the underlying knowledge and creates charts that successfully signify its key insights.
    • Extremely Customizable: The generated code might be tailor-made to particular person preferences and knowledge traits, permitting for a wider vary of chart varieties and aesthetic choices.
    • Higher Designed: The LLM can incorporate ideas of information visualization finest practices, leading to clearer and extra impactful charts.
    • Enhanced Logging for Key Levels: To facilitate debugging, monitoring, and a deeper understanding of the agent’s workflow, I’ve applied extra complete logging at important levels.

    Agent in Motion

    As an example the enhancements within the SQL agent’s capabilities, let’s take a look at some instance queries and the way the up to date agent handles them, together with when it intelligently decides wat form of chart is important for the kind of knowledge:

    1. “What’s the common of the whole within the invoices desk?”
    python run.py "What's the common of the whole within the invoices desk?" 
    • Agent’s Reasoning: The consequence might be a numerical worth.
    INFO - [src.tools] [Tool: db_query_tool] Executing question: SELECT AVG(Whole) FROM Bill
    INFO - [src.config] [Node: Reasoning] LLM Response: The common of the whole within the invoices desk is 5.65.
    AI: The common of the whole within the invoices desk is 5.65.
    Outcomes: The common of the whole within the invoices desk is 5.65.
    Is the information appropriate? (y/n): y
    Would you wish to generate a graph? (y/n): y
    import plotly.graph_objects as go

    fig = go.Determine(go.Indicator(
    mode = "quantity+gauge",
    worth = 5.65,
    title = {'textual content': "Common Bill Whole"},
    gauge = {'axis': {'vary': [None, 10]},
    'threshold' : {'line': {'coloration': "crimson",
    'width': 4},
    'thickness': 0.75,
    'worth': 7}}))
    fig.present()

    Execution accomplished.
    Ultimate consequence: The common of the whole within the invoices desk is 5.65.

    2. “What number of invoices are within the desk with a complete quantity higher than 15?”

    python run.py "What number of invoices are within the desk with a complete quantity higher than 15?" 
    Uncooked question: What number of invoices are within the desk invoices with a complete quantity higher than 15?
    INFO - [src.tools] [Tool: db_query_tool] Executing question: SELECT COUNT(*) FROM Bill WHERE Whole > 15
    AI: There are 11 invoices with a complete quantity higher than 15.
    Outcomes: There are 11 invoices with a complete quantity higher than 15.
    Is the information appropriate? (y/n): y
    Would you wish to generate a graph? (y/n): y
    import plotly.graph_objects as go

    fig = go.Determine(go.Indicator(
    mode = "quantity",
    worth = 11,
    title = {"textual content": "Invoices with Whole Quantity > 15"},
    ))

    fig.present()

    Execution accomplished.
    Ultimate consequence: There are 11 invoices with a complete quantity higher than 15.

    3. “That are the three billing international locations with the very best bill whole?”

    python run.py "That are the three billing international locations with the very best bill whole?"
    INFO - [src.tools] [Tool: db_query_tool] Executing question: SELECT BillingCountry, SUM(Whole) AS TotalInvoiceValue FROM Bill GROUP BY BillingCountry ORDER BY TotalInvoiceValue DESC LIMIT 3;
    AI: The three billing international locations with the very best bill totals are:

    1. USA: $523.06
    2. Canada: $303.96
    3. France: $195.10
    Is the information appropriate? (y/n): y
    Would you wish to generate a graph? (y/n): y

    import plotly.specific as px
    import pandas as pd

    knowledge = {'Nation': ['USA', 'Canada', 'France'],
    'Bill Whole': [523.06, 303.96, 195.10]}
    df = pd.DataFrame(knowledge)
    fig = px.bar(df, x='Nation', y='Bill Whole',
    title='Prime 3 Billing Nations by Bill Whole',
    labels={'Bill Whole': 'Bill Whole ($)'},
    text_auto=True)
    fig.present()

    Conclusion

    I’m happy with the developments on this reasoning SQL agent, and I consider there’s important potential for additional improvement. Your suggestions and options for brand new options are welcome — please be happy to share your ideas. To remain up to date on the progress of this undertaking and future explorations in clever knowledge interplay, make sure you observe my upcoming weblog posts.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleUK driverless cars unlikely until 2027
    Next Article Housing market shift explained—and where it’s happening the fastest
    Team_AIBS News
    • Website

    Related Posts

    Machine Learning

    Reinforcement Learning in the Age of Modern AI | by @pramodchandrayan | Jul, 2025

    July 1, 2025
    Machine Learning

    Finding the right tool for the job: Visual Search for 1 Million+ Products | by Elliot Ford | Kingfisher-Technology | Jul, 2025

    July 1, 2025
    Machine Learning

    Meanwhile in Europe: How We Learned to Stop Worrying and Love the AI Angst | by Andreas Maier | Jul, 2025

    July 1, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    3D Printer Breaks Kickstarter Record, Raises Over $46M

    July 1, 2025

    I Tried Buying a Car Through Amazon: Here Are the Pros, Cons

    December 10, 2024

    Amazon and eBay to pay ‘fair share’ for e-waste recycling

    December 10, 2024

    Artificial Intelligence Concerns & Predictions For 2025

    December 10, 2024

    Barbara Corcoran: Entrepreneurs Must ‘Embrace Change’

    December 10, 2024
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    Most Popular

    M&S cyber attack chaos leaves more questions than answers

    April 30, 2025

    How Golden Visas and Second Passports Are Transforming Wealth Strategies

    March 18, 2025

    Focused Ultrasound Stimulation: a New Way to Fight Inflammation

    June 9, 2025
    Our Picks

    3D Printer Breaks Kickstarter Record, Raises Over $46M

    July 1, 2025

    People are using AI to ‘sit’ with them while they trip on psychedelics

    July 1, 2025

    Reinforcement Learning in the Age of Modern AI | by @pramodchandrayan | Jul, 2025

    July 1, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2024 Aibsnews.comAll Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.