Spaces:
Runtime error
Runtime error
Caleb Fahlgren
commited on
Commit
·
4ec985f
1
Parent(s):
fb10a3d
move model inside generate query
Browse files
app.py
CHANGED
|
@@ -19,20 +19,6 @@ view_name = "dataset_view"
|
|
| 19 |
hf_api = HfApi()
|
| 20 |
conn = duckdb.connect()
|
| 21 |
|
| 22 |
-
llama = llama_cpp.Llama(
|
| 23 |
-
model_path="Hermes-2-Pro-Llama-3-8B-Q8_0.gguf",
|
| 24 |
-
n_gpu_layers=50,
|
| 25 |
-
chat_format="chatml",
|
| 26 |
-
n_ctx=2048,
|
| 27 |
-
verbose=False,
|
| 28 |
-
temperature=0.1,
|
| 29 |
-
)
|
| 30 |
-
|
| 31 |
-
create = instructor.patch(
|
| 32 |
-
create=llama.create_chat_completion_openai_v1,
|
| 33 |
-
mode=instructor.Mode.JSON_SCHEMA,
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
|
| 37 |
class OutputTypes(str, enum.Enum):
|
| 38 |
TABLE = "table"
|
|
@@ -87,6 +73,20 @@ CREATE TABLE {} (
|
|
| 87 |
|
| 88 |
@spaces.GPU
|
| 89 |
def generate_query(dataset_id: str, query: str) -> dict:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
ddl = get_dataset_ddl(dataset_id)
|
| 91 |
|
| 92 |
system_prompt = f"""
|
|
|
|
| 19 |
hf_api = HfApi()
|
| 20 |
conn = duckdb.connect()
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
class OutputTypes(str, enum.Enum):
|
| 24 |
TABLE = "table"
|
|
|
|
| 73 |
|
| 74 |
@spaces.GPU
|
| 75 |
def generate_query(dataset_id: str, query: str) -> dict:
|
| 76 |
+
llama = llama_cpp.Llama(
|
| 77 |
+
model_path="Hermes-2-Pro-Llama-3-8B-Q8_0.gguf",
|
| 78 |
+
n_gpu_layers=50,
|
| 79 |
+
chat_format="chatml",
|
| 80 |
+
n_ctx=2048,
|
| 81 |
+
verbose=False,
|
| 82 |
+
temperature=0.1,
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
create = instructor.patch(
|
| 86 |
+
create=llama.create_chat_completion_openai_v1,
|
| 87 |
+
mode=instructor.Mode.JSON_SCHEMA,
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
ddl = get_dataset_ddl(dataset_id)
|
| 91 |
|
| 92 |
system_prompt = f"""
|