piglets 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- piglets-0.1.0/PKG-INFO +29 -0
- piglets-0.1.0/README.md +19 -0
- piglets-0.1.0/pyproject.toml +34 -0
- piglets-0.1.0/setup.cfg +4 -0
- piglets-0.1.0/src/piglets/__init__.py +7 -0
- piglets-0.1.0/src/piglets/planning/__init__.py +5 -0
- piglets-0.1.0/src/piglets/planning/logical_planning/__init__.py +5 -0
- piglets-0.1.0/src/piglets/planning/logical_planning/logical_planner.py +17 -0
- piglets-0.1.0/src/piglets/types/__init__.py +5 -0
- piglets-0.1.0/src/piglets/types/plans.py +5 -0
- piglets-0.1.0/src/piglets/utils/__init__.py +5 -0
- piglets-0.1.0/src/piglets/utils/mardown_handling.py +4 -0
- piglets-0.1.0/src/piglets.egg-info/PKG-INFO +29 -0
- piglets-0.1.0/src/piglets.egg-info/SOURCES.txt +15 -0
- piglets-0.1.0/src/piglets.egg-info/dependency_links.txt +1 -0
- piglets-0.1.0/src/piglets.egg-info/requires.txt +4 -0
- piglets-0.1.0/src/piglets.egg-info/top_level.txt +1 -0
piglets-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: piglets
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A modular text-to-SQL toolkit.
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: langchain>=1.0
|
|
8
|
+
Provides-Extra: openai
|
|
9
|
+
Requires-Dist: langchain-openai>=1.0; extra == "openai"
|
|
10
|
+
|
|
11
|
+
# 🐷 piglets
|
|
12
|
+
|
|
13
|
+
A modular, pre-1.0 library of text-to-SQL planning tools.
|
|
14
|
+
|
|
15
|
+
## Status
|
|
16
|
+
|
|
17
|
+
`piglets` is currently an **alpha-stage** package. The API is expected to evolve before `1.0`.
|
|
18
|
+
|
|
19
|
+
## Current scope
|
|
20
|
+
|
|
21
|
+
### Planning
|
|
22
|
+
|
|
23
|
+
The first included primitive is a `LogicalPlanner` that turns a natural-language analytics question into an ordered list of abstract logical steps.
|
|
24
|
+
|
|
25
|
+
This keeps planning at the business-logic level before later schema grounding or SQL generation.
|
|
26
|
+
|
|
27
|
+
### Pruning
|
|
28
|
+
|
|
29
|
+
Pruning components are planned but not included yet.
|
piglets-0.1.0/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# 🐷 piglets
|
|
2
|
+
|
|
3
|
+
A modular, pre-1.0 library of text-to-SQL planning tools.
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
`piglets` is currently an **alpha-stage** package. The API is expected to evolve before `1.0`.
|
|
8
|
+
|
|
9
|
+
## Current scope
|
|
10
|
+
|
|
11
|
+
### Planning
|
|
12
|
+
|
|
13
|
+
The first included primitive is a `LogicalPlanner` that turns a natural-language analytics question into an ordered list of abstract logical steps.
|
|
14
|
+
|
|
15
|
+
This keeps planning at the business-logic level before later schema grounding or SQL generation.
|
|
16
|
+
|
|
17
|
+
### Pruning
|
|
18
|
+
|
|
19
|
+
Pruning components are planned but not included yet.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "piglets"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A modular text-to-SQL toolkit."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"langchain>=1.0",
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
[project.optional-dependencies]
|
|
12
|
+
openai = [
|
|
13
|
+
"langchain-openai>=1.0",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[dependency-groups]
|
|
17
|
+
dev = [
|
|
18
|
+
"build>=1.4.3",
|
|
19
|
+
"twine>=6.2.0",
|
|
20
|
+
]
|
|
21
|
+
test = [
|
|
22
|
+
"pytest>=8.0",
|
|
23
|
+
"langchain-openai>=1.0"
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[tool.setuptools]
|
|
27
|
+
package-dir = {"" = "src"}
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.packages.find]
|
|
30
|
+
where = ["src"]
|
|
31
|
+
|
|
32
|
+
[tool.pytest.ini_options]
|
|
33
|
+
testpaths = ["tests"]
|
|
34
|
+
addopts = ["-ra"]
|
piglets-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from langchain.chat_models import init_chat_model
|
|
3
|
+
|
|
4
|
+
from piglets.types import LogicalPlan
|
|
5
|
+
from piglets.utils import read_markdown_file
|
|
6
|
+
|
|
7
|
+
class LogicalPlanner():
|
|
8
|
+
def __init__(self, model_name: str):
|
|
9
|
+
file_path = Path(__file__).with_suffix(".md").resolve()
|
|
10
|
+
self.system_instruction = read_markdown_file(file_path=file_path)
|
|
11
|
+
|
|
12
|
+
llm = init_chat_model(model_name)
|
|
13
|
+
llm = llm.with_structured_output(LogicalPlan)
|
|
14
|
+
self.llm = llm
|
|
15
|
+
|
|
16
|
+
def plan(self, natural_language_query: str) -> LogicalPlan:
|
|
17
|
+
return self.llm.invoke(f"{self.system_instruction} \nUser question: {natural_language_query}")
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: piglets
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A modular text-to-SQL toolkit.
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: langchain>=1.0
|
|
8
|
+
Provides-Extra: openai
|
|
9
|
+
Requires-Dist: langchain-openai>=1.0; extra == "openai"
|
|
10
|
+
|
|
11
|
+
# 🐷 piglets
|
|
12
|
+
|
|
13
|
+
A modular, pre-1.0 library of text-to-SQL planning tools.
|
|
14
|
+
|
|
15
|
+
## Status
|
|
16
|
+
|
|
17
|
+
`piglets` is currently an **alpha-stage** package. The API is expected to evolve before `1.0`.
|
|
18
|
+
|
|
19
|
+
## Current scope
|
|
20
|
+
|
|
21
|
+
### Planning
|
|
22
|
+
|
|
23
|
+
The first included primitive is a `LogicalPlanner` that turns a natural-language analytics question into an ordered list of abstract logical steps.
|
|
24
|
+
|
|
25
|
+
This keeps planning at the business-logic level before later schema grounding or SQL generation.
|
|
26
|
+
|
|
27
|
+
### Pruning
|
|
28
|
+
|
|
29
|
+
Pruning components are planned but not included yet.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/piglets/__init__.py
|
|
4
|
+
src/piglets.egg-info/PKG-INFO
|
|
5
|
+
src/piglets.egg-info/SOURCES.txt
|
|
6
|
+
src/piglets.egg-info/dependency_links.txt
|
|
7
|
+
src/piglets.egg-info/requires.txt
|
|
8
|
+
src/piglets.egg-info/top_level.txt
|
|
9
|
+
src/piglets/planning/__init__.py
|
|
10
|
+
src/piglets/planning/logical_planning/__init__.py
|
|
11
|
+
src/piglets/planning/logical_planning/logical_planner.py
|
|
12
|
+
src/piglets/types/__init__.py
|
|
13
|
+
src/piglets/types/plans.py
|
|
14
|
+
src/piglets/utils/__init__.py
|
|
15
|
+
src/piglets/utils/mardown_handling.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
piglets
|