TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How would you go about implementing a NL tool to gather insights?

1 点作者 Antitoxic61853 个月前
I’ve been tasked with building an application that converts high-level natural language queries into meaningful insights from a database. The database consists of multiple tables that can be joined using a transaction ID. My current approach involves using GPT-4o to generate Python code based on the user’s query, which is then executed locally to extract insights (be it records, or graphs related to user query). While the approach is sorta okay, I encountered an issue during a POC demo. One of the example queries resulted in incorrect results—the model used pd.merge but ended up performing a cross join, inflating the record count from 50k to 5 mil. Additionally, when queries are too high-level, the generated code often doesn’t yield the right results unless I explicitly specify which tables to use, which ideally shouldn’t be necessary.<p>To guide the model, I include a summary of the database schema, explaining each table and column, along with the user’s query at the beginning of the prompt. However, this doesn’t always lead to accurate Python translations.<p>Any idea how to better approach the problem? This tool is meant to be used by high level execs who have little to no CS knowledge. Also I&#x27;m restricted to OpenAI models for this.

2 条评论

WantonQuantum3 个月前
There is a way to &quot;make your own GPT&quot; (<a href="https:&#x2F;&#x2F;help.openai.com&#x2F;en&#x2F;articles&#x2F;8554397-creating-a-gpt" rel="nofollow">https:&#x2F;&#x2F;help.openai.com&#x2F;en&#x2F;articles&#x2F;8554397-creating-a-gpt</a>) by feeding ChatGPT with some example questions and answers. If you include situations that ChatGPT is getting wrong, it should help.
评论 #42895936 未加载
remram3 个月前
AI cannot write this kind of code unattended. This can&#x27;t work.
评论 #42895848 未加载