Skip to content

Commit

Permalink
优化 gbi cookbook 文档
Browse files Browse the repository at this point in the history
  • Loading branch information
cjopengler committed Jan 2, 2024
1 parent 8931e19 commit 809829c
Showing 1 changed file with 22 additions and 27 deletions.
49 changes: 22 additions & 27 deletions cookbooks/gbi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 18,
"id": "4ccff03b-1567-4e8b-8e1f-9a5032690406",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -60,7 +60,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 3,
"id": "d7d6440c",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -117,7 +117,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 4,
"id": "7fefcae1",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -174,21 +174,20 @@
"metadata": {},
"source": [
"### 问表\n",
"基于上面选出的表,通过获取 shema 进行问表"
"基于上面选出的表,通过获取表的 schema 进行问表"
]
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 6,
"id": "9f45ef5f-6206-4b31-83c4-3c8eb2c86925",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sql: \n",
"SELECT * FROM supper_market_info;\n",
"sql: SELECT * FROM supper_market_info;\n",
"-----------------\n",
"llm result: ```sql\n",
"SELECT * FROM supper_market_info;\n",
Expand All @@ -215,7 +214,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 7,
"id": "a23b8cad-f426-4074-9311-c2c33aaea07b",
"metadata": {},
"outputs": [],
Expand All @@ -234,19 +233,18 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 8,
"id": "2adcb091-fb53-4364-b4d8-20564439ff51",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sql: \n",
"SELECT * FROM supper_market_info WHERE 商品类别 = '水果';\n",
"sql: SELECT * FROM supper_market_info WHERE 商品类别 = '水果'\n",
"-----------------\n",
"llm result: ```sql\n",
"SELECT * FROM supper_market_info WHERE 商品类别 = '水果';\n",
"SELECT * FROM supper_market_info WHERE 商品类别 = '水果'\n",
"```\n"
]
}
Expand All @@ -270,19 +268,18 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 9,
"id": "2a7c7923-019e-4660-9e36-4431e9d2f3a6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sql: \n",
"SELECT * FROM supper_market_info WHERE 商品类别='新鲜水果'\n",
"sql: SELECT * FROM supper_market_info WHERE 商品类别 = '新鲜水果'\n",
"-----------------\n",
"llm result: ```sql\n",
"SELECT * FROM supper_market_info WHERE 商品类别='新鲜水果'\n",
"SELECT * FROM supper_market_info WHERE 商品类别 = '新鲜水果'\n",
"```\n"
]
}
Expand All @@ -294,7 +291,7 @@
"column_constraint = [ColumnItem(ori_value=\"水果\", \n",
" column_name=\"商品类别\", \n",
" column_value=\"新鲜水果\", \n",
" table_name=\"超市营收明细表\", \n",
" table_name=\"supper_market_info\", \n",
" is_like=False)]\n",
"\n",
"nl2sql_result_message2 = gbi_nl2sql(Message({\"query\": \"查看商品类别是水果的所有数据\",\n",
Expand Down Expand Up @@ -326,7 +323,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 10,
"id": "cade4693-29dc-431c-bf84-c6dc09104294",
"metadata": {},
"outputs": [],
Expand All @@ -337,16 +334,15 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 11,
"id": "1dc181e8-47a1-4b82-8bb5-ce3339be53f6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sql: \n",
"SELECT 商品类别, SUM(利润)/SUM(销售额) AS 利润率\n",
"sql: SELECT 商品类别, SUM(利润)/SUM(销售额) AS 利润率\n",
"FROM supper_market_info\n",
"WHERE 商品类别 = '日用品'\n",
"GROUP BY 商品类别\n",
Expand Down Expand Up @@ -390,7 +386,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 12,
"id": "2ae6ffbc-4237-4fb2-8168-480b81bfd873",
"metadata": {},
"outputs": [],
Expand All @@ -411,7 +407,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 13,
"id": "2bbbb375-6659-4ef0-82ff-a4ace9fdd4f0",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -451,7 +447,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 14,
"id": "323fbe75-62ca-44ab-9ca2-9f747939a2b5",
"metadata": {},
"outputs": [],
Expand All @@ -474,16 +470,15 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 15,
"id": "52436f03-e01c-456a-aaa0-5a7f1afcd9d2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sql: \n",
"SELECT * FROM supper_market_info WHERE 商品类别 = '水果'\n",
"sql: SELECT * FROM supper_market_info WHERE 商品类别 = '水果'\n",
"-----------------\n",
"llm result: ```sql\n",
"SELECT * FROM supper_market_info WHERE 商品类别 = '水果'\n",
Expand Down

0 comments on commit 809829c

Please sign in to comment.