ThanoSQL vs. AI Agents: Analyzing Complex Business Queries with Efficiency and Accuracy

Can AI Agents Solve or Analyze Complex Problems?

Recently, the term "AI Agent" has become as prevalent as "LLM" (Large Language Model). In August, more than ten companies at home and abroad unveiled products they claim to be AI agents.

Today, let us explore what AI agents are and whether they can solve or analyze complex problems arising in real-world business scenarios.

1. About AI Agents

From the perspective of LLMs, an agent is a system that uses an LLM as a fundamental component to formulate plans through appropriate reasoning and solve problems using available tools and resources. It is like how humans contemplate strategies and utilize necessary tools when faced with a problem. In an agent, the LLM functions much like the human brain. The ideal way to solve a problem is to divide it into one or more smaller tasks that can be performed sequentially or independently. Agents perform this same function.

Typically, the LLM plans how to solve the problem, and the agent uses one or more tools. In addition to tools, agents have other components like prompts or memory to perform intended functions properly. The diagram below illustrates the configuration of a single-agent system.

A single-agent system consists of a specific AI agent capable of using multiple tools to solve a problem. Such systems are designed to autonomously handle tasks by leveraging the combined capabilities of tools and LLMs' reasoning abilities. 

Due to memory constraints and processing limitations of single-agent systems, multi-agent systems are needed when broader tasks or more complex problems must be addressed. A multi-agent system comprises multiple single agents, each capable of performing tasks autonomously but designed to collaborate toward a common goal.

The diagram above shows the configuration of a multi-agent system. Even though multi-agent systems may seem all-powerful, they still have limitations. (Refer to our previous post on Limitations of LLMs and Langchain, Problems of Agents, and TAG)

2. Methods for Solving Users' Complex Natural Language Queries

When a user poses a lengthy and complex question in natural language, there are three ways to solve the problem, as shown in the diagram below:

Handling Complex Natural Language Queries Using LLMs

LLMs 1) Convert the user's input into agent language and process it using the agent approach. 2) Use Text-to-SQL to transform it into SQL and handle it with TAG. 3) Process it using ThanoSQL.

Before we proceed, let us briefly touch on what Text-to-SQL is.

Returning to the main topic, although agent systems are currently mainstream, they have clear limitations for enterprise use due to slow speed and low accuracy. While TAG (TableAugmented Generation), a paper published last month, is expected to alleviate some of the problems of agents, it is still in the research stage and not ready for immediate enterprise adoption.

SmartMind's ThanoSQL is a solution that implements the concept of TAG, expanding it not only to LLMs but also to RAG, external APIs, and all other actions.

3. ThanoSQL: Commercial Implementation and Expansion of TAG

When a user poses a lengthy and complex question in natural language, there are three ways to solve the problem, as shown in the diagram below:

ThanoSQL as an LLM-based Analytical Tool

ThanoSQL is an LLM-based analysis tool designed for non-IT personnel, accessing those non-IT personnel to analyze complicated data quickly. Traditionally, various such as SQL, RAG, AI/ML, and external APIs have been required to analyze data. An integrated solution is essential to connect these tools effectively; technologies like LangChain make this possible. LangChain helps connect multiple tools in a chain format using programming languages like Python or JavaScript.

However, connecting these tools and appropriately utilizing them for specific problems is not simple. You must rely on AI to select tools and determine their usage sequence. Since there is no guarantee that the AI's answers are always correct, incorrect results can occur. Users find it difficult to verify whether the final output is generated correctly, leading to inefficient situations where they have to explain the required modifications again in natural language.

SQL was developed for precise communication with databases, allowing the execution of a single task and easy modification when necessary. Using nested SQL minimizes the risk of repeated or incorrect tool application orders.

ThanoSQL was designed to solve these issues. While it shares the same goals as LangChain, it primarily targets non-IT personnel. It takes a different approach to solving complex problems. Instead of the agent-based sequential approach, ThanoSQL solves complex problems using nested SQL. In the current market, various products offer individual functionalities; however, an all-in-one solution like ThanoSQL that can solve complex queries simultaneously does not exist.

4. Case Studies of Analyzing Complex Queries

Let us look at how ThanoSQL processes the following two questions:

Question 1) "Extract reviews with ratings of 2 or below within the last three days, summarize the content related to side effects, create a summary, and find similar posts on the web."

First, we create the necessary functions: ① Summarize the review content. ② Search reviews where the content is about 'side effects.' ③ Perform a web search (using external APIs).

Next, we generate and execute SQL queries one by one through Text-to-SQL in order. Select reviews with ratings of 2 or below within the last three days -> Summarize those reviews -> Select reviews related to side effects -> Output the selected results -> Output web search results

The SQL statements processed in ThanoSQL are shown in the diagram below.

Now, let us move on to the second question.

Question 2) "Analyze changes in average sales over the past week, identify changes in customer review keywords, extract reviews written with those keywords, compare them with recent trending search terms, and propose a new marketing strategy based on this."

As in the previous case, we create the necessary functions and generate and execute SQL queries.

The actual SQL statements processed in ThanoSQL are shown in the diagram below.

ThanoSQL automatically generates nested SQL statements that utilize SQL, RAG, AI/ML, and external APIs to handle complex questions like the ones above. This approach ensures consistent answers by sequentially executing each tool.

You can review the automatically generated queries in ThanoSQL to verify whether the transformations occurred as intended and, if necessary, immediately modify or supplement them through queries. Additionally, you can ask further questions based on the answers and verify whether those answers are correct.

Such 'process verification' and 'result verification' are impossible with agent-based methods relying on LangChain; they are only possible with ThanoSQL.

5. Conclusion

As seen in the cases above, when you compose a result table by writing the user's complex natural language queries into nested SQL queries and then make natural language queries based on that table, you can not only overcome the problems and limitations of the agent approach but also gain the following advantages:

■ You can ask further questions and perform analyses based on the table created.
■ The SQL generated in this way can be used repeatedly, stored, shared, and utilized. This improves efficiency in repetitive tasks by reusing frequently used or recently used SQL to extract insights.
■ Improving analysis results is very straightforward because it is based on SQL, letting users swiftly identify and solve issues.
■ Well-refined SQL generated from natural language queries can be used as standalone applications.
■ Combining several such SQL statements allows you to create more advanced applications easily and quickly.

We look forward to your continued interest in ThanoSQL.

ThanoSQL Implementation Inquiry

en_USEN
Scroll to Top