Skip to content

Commit

Permalink
Improve db prompt with proper dialect and release v0.0.4 (#18)
Browse files Browse the repository at this point in the history
* Include the db dialect in the prompt to improve syntax

Signed-off-by: Aivin V. Solatorio <avsolatorio@gmail.com>

* Bump version for release v0.0.4

Signed-off-by: Aivin V. Solatorio <avsolatorio@gmail.com>

---------

Signed-off-by: Aivin V. Solatorio <avsolatorio@gmail.com>
  • Loading branch information
avsolatorio authored Jun 19, 2023
1 parent 2e1d3e6 commit f4618fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion llm4data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Do this before importing any other modules.
dotenv.load_dotenv()

__version__ = "0.0.3"
__version__ = "0.0.4"

indicator2name = dict(
wdi=json.load((Path(__file__).parent / "wdi2name.json").open("r"))
Expand Down
7 changes: 5 additions & 2 deletions llm4data/prompts/indicators/wdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from urllib.parse import urlparse
from openai_tools.parser import parse_misparsed
from llm4data.prompts.base import DatedPrompt, APIPrompt
from llm4data import configs


class WDISQLPrompt(DatedPrompt):
Expand All @@ -18,8 +19,10 @@ def __init__(self, input_variables=None, template=None):
"I have a database containing data from the WDI indicators."
" Write an SQL query for the prompt: ```{{{{user_content}}}}```\n\n"
"table: {table}\n"
"fields: {fields}\n\n"
"Only the indicator can parameterized and you must fill the rest."
"fields: {fields}\n"
f"dialect: {configs.WDIDBConfig.engine}\n\n"
"Pay attention to the dialect when writing the query.\n\n"
"Only the indicator can be parameterized and you must fill the rest."
" Use the convention `:indicator` and not `?`."
" Use country_iso3 when querying, use country in the result.\n\n"
"Use the last 10 years if no year is specified."
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "llm4data"
version = "0.0.3"
version = "0.0.4"
description = "LLM4Data is a Python library designed to facilitate the application of large language models (LLMs) and artificial intelligence for development data and knowledge discovery."
authors = ["Aivin V. Solatorio <avsolatorio@gmail.com>"]
readme = "README.md"
Expand Down

0 comments on commit f4618fd

Please sign in to comment.