Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the error of show baselines after builing package #190

Merged
merged 4 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions dbgpt_hub/baseline/show_result.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import json
import pkgutil
from typing import Optional, Dict, Any
from prettytable.colortable import ColorTable, Theme

Expand All @@ -27,7 +28,7 @@
"all",
]

baseline_file = "./dbgpt_hub/baseline/baseline.json"
baseline_file = "baseline/baseline.json"
ALPACA = 'I want you to act as a SQL terminal in front of an example database, you need only to return the sql command to me.Below is an instruction that describes a task, Write a response that appropriately completes the request.\\n\\"\\n##Instruction:\\ndepartment_management contains tables such as department, head, management. Table department has columns such as Department_ID, Name, Creation, Ranking, Budget_in_Billions, Num_Employees. Department_ID is the primary key.\\nTable head has columns such as head_ID, name, born_state, age. head_ID is the primary key.\\nTable management has columns such as department_ID, head_ID, temporary_acting. department_ID is the primary key.\\nThe head_ID of management is the foreign key of head_ID of head.\\nThe department_ID of management is the foreign key of Department_ID of department.\\n\\n'
OPENAI = "openai"

Expand Down Expand Up @@ -73,8 +74,11 @@ def init_baseline_json():
json.dump(json_data, file, indent=4)


with open(baseline_file, "r") as file:
baseline_json = json.load(file)
data = pkgutil.get_data("dbgpt_hub", baseline_file)
if data is not None:
baseline_json = json.loads(data.decode("utf-8"))
else:
raise FileNotFoundError("The JSON file was not found in the package.")


def table_add_row(table_scores, acc_data, dataset, model, method, prompt):
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[tool.poetry]
name = "dbgpt_hub"
version = "0.2.1"
version = "0.3.0"
description = "DB-GPT-Hub: Text-to-SQL parsing with LLMs"
authors = ["Your Name <[email protected]>"]
license = "MIT"
readme = "README.md"
include = ["dbgpt_hub/baseline/baseline.json"]

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
Expand Down
Loading