返回顶部
热门问答 更多热门问答
技术文章 更多技术文章

在WrenAI中提问业务问题并获取跟进洞察

[复制链接]
链载Ai 显示全部楼层 发表于 3 小时前 |阅读模式 打印 上一主题 下一主题

ingFang SC", Cambria, Cochin, Georgia, serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">今天,OpenAI 发布了其最新的 LLM 模型,GPT-4o。人们正在分享基于这一突破性模型构建的各种疯狂应用。通过使用GPT-4o,我们看到了数据检索方面的改进,这可以使用户获得更快的响应并更具成本效益(成本低于 GPT-4 Turbo)。

ingFang SC", Cambria, Cochin, Georgia, serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">

ingFang SC", Cambria, Cochin, Georgia, serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">在 12 小时内,我们在 WrenAI 团队发布了最新版本,以支持使用 GPT-4o LLM 模型查询您自己的数据库。在这篇文章中,我们将指导您如何使用gpt-4o查询您自己的 PostgreSQL 数据库!

ingFang SC", Cambria, Cochin, Georgia, serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">

ingFang SC", Cambria, Cochin, Georgia, serif;font-size: medium;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">

WrenAI 是一个开源的文本到 SQL 解决方案,旨在帮助数据团队通过提问业务问题而不编写 SQL 来更快地获取结果和洞察。

ingFang SC", Cambria, Cochin, Georgia, serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">让我们开始吧!

ingFang SC", Cambria, Cochin, Georgia, serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">

ingFang SC", Cambria, Cochin, Georgia, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">设置您的PostgreSQL数据库

ingFang SC", Cambria, Cochin, Georgia, serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">启动您的PostgreSQL服务器,并使用psql客户端进入您的PostgreSQL数据库。

ingFang SC", Cambria, Cochin, Georgia, serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">

在PostgreSQL中创建一个数据库,这里我们命名为ecom-wrenai

CREATE DATABASE ecom_wrenai;

使用\c <database_name>连接到创建的数据库ecom_wrenai

lijungchi=# \c ecom_wrenai
psql (13.1, server 13.0)
您现在已连接到数据库 "ecom_wrenai" 作为用户 "lijungchi"。
ecom_wrenai=#

现在,您需要创建此数据集的表并导入数据。请查看这里的SQL脚本。

您可以复制脚本到您的psql中,或者通过psql导入SQL。

ecom_wrenai=# \i <path to your file>/import.sql

如果您成功导入数据,将会看到以下信息。

安装 WrenAI

接下来,我们开始安装 WrenAI;在此之前,您需要先安装 Docker。

1. 在本地计算机上安装 Docker Desktop

请确保 Docker Desktop 的版本至少为 >= 4.17。

2. 准备一个 OpenAI API 密钥

请确保您的 Open API 密钥具有完全权限(所有)。

访问 OpenAI 开发者平台。

为 WrenAI 生成一个具有完全权限的新 API 密钥

2. 安装 WrenAI 启动器

如果您使用的是 Mac(Windows 或 Linux 用户请点击这里),请输入以下命令来安装最新版本的 WrenAI 启动器。

curl -L https://github.com/Canner/WrenAI/releases/latest/download/wren-launcher-darwin.tar.gz | tar -xz && ./wren-launcher-darwin

启动器随后会要求您输入 OpenAI API 密钥,如下所示,将您的密钥粘贴到命令中并按回车键。

现在,您可以在 WrenAI 中选择 OpenAI 的生成模型,如gpt-4ogpt-4-turbogpt-3.5-turbo

安装完成后,您会看到我们正在您的计算机上运行docker-compose,工具将自动打开浏览器以访问 WrenAI。

连接您的数据源

终端成功安装后,将启动浏览器

选择 PostgreSQL 数据库连接器

如果您使用的是 Mac 本地 PostgreSQL 数据库,请输入docker.for.mac.localhost以访问数据库。

下一步,定义与语义模型的关系;这有助于 LLMs 更好地理解您的语义数据结构。

现在,一切就绪!

您可以在 WrenAI 界面中查看所有数据模型。

探索 WrenAI

WrenAI UI 语义建模

通过 WrenAI UI,您可以在语义上下文中对数据模型进行建模,例如添加描述、关系、计算等。这种上下文有助于大型语言模型(LLMs)学习您的业务术语和关键绩效指标(KPI)定义,并在连接多个表时减少幻觉现象;LLMs 通过学习表之间的多对一一对多多对多等关系,了解数据结构的层次。

通过 WrenAI 中的计算定义您的业务 KPI 和公式。

在表之间添加语义关系。

在WrenAI中提问业务问题并获取跟进洞察

现在,您可以通过点击WrenAI界面中的新建线程,切换到主页,开始提出任何业务问题。WrenAI会通过向量存储搜索相关语义并提供建议。

WrenAI将为您的业务问题展示最多3个选项;您可以选择最相关的问题来生成最终结果。

选择一个选项后,WrenAI会逐步展示总结内容,包括SQL和数据,让您验证结果是否符合预期。

您可以提出跟进问题,以深入了解结果。


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

链载AI是专业的生成式人工智能教程平台。提供Stable Diffusion、Midjourney AI绘画教程,Suno AI音乐生成指南,以及Runway、Pika等AI视频制作与动画生成实战案例。从提示词编写到参数调整,手把手助您从入门到精通。
  • 官方手机版

  • 微信公众号

  • 商务合作

  • Powered by Discuz! X3.5 | Copyright © 2025-2025. | 链载Ai
  • 桂ICP备2024021734号 | 营业执照 | |广西笔趣文化传媒有限公司|| QQ