Skip to content

Commit

Permalink
Fix the error of show baselines after builing package (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
qidanrui authored Dec 19, 2023
1 parent 2b494be commit 4d48845
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
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

0 comments on commit 4d48845

Please sign in to comment.