fetchgraph 0.0.3__tar.gz → 0.1.2__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.
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/PKG-INFO +81 -4
- fetchgraph-0.0.3/src/fetchgraph.egg-info/PKG-INFO → fetchgraph-0.1.2/README.md +72 -18
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/pyproject.toml +13 -4
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/__init__.py +8 -3
- fetchgraph-0.1.2/src/fetchgraph/core.py +802 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/prompts/plan_generic.md +9 -1
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/prompts/synth_generic.md +3 -0
- fetchgraph-0.1.2/src/fetchgraph/relational_base.py +307 -0
- fetchgraph-0.1.2/src/fetchgraph/relational_composite.py +1081 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/relational_models.py +9 -1
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/relational_pandas.py +237 -30
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/relational_provider.py +3 -8
- fetchgraph-0.1.2/src/fetchgraph/relational_schema.py +381 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/relational_sql.py +268 -114
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/semantic_backend.py +181 -51
- fetchgraph-0.0.3/README.md → fetchgraph-0.1.2/src/fetchgraph.egg-info/PKG-INFO +96 -3
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph.egg-info/SOURCES.txt +5 -1
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph.egg-info/requires.txt +3 -0
- fetchgraph-0.1.2/src/fetchgraph.egg-info/top_level.txt +2 -0
- fetchgraph-0.1.2/tests/test_relational_base.py +18 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/tests/test_relational_composite.py +65 -0
- fetchgraph-0.1.2/tests/test_relational_composite_cross_provider.py +394 -0
- fetchgraph-0.0.3/tests/test_relational_sql.py → fetchgraph-0.1.2/tests/test_relational_pandas.py +98 -91
- fetchgraph-0.1.2/tests/test_relational_sql.py +697 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/tests/test_semantic_backend_csv.py +107 -1
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/tests/test_semantic_backend_pgvector.py +83 -0
- fetchgraph-0.1.2/tests/test_streaming_cross_joins.py +442 -0
- fetchgraph-0.0.3/src/fetchgraph/core.py +0 -354
- fetchgraph-0.0.3/src/fetchgraph/relational_base.py +0 -140
- fetchgraph-0.0.3/src/fetchgraph/relational_composite.py +0 -101
- fetchgraph-0.0.3/src/fetchgraph.egg-info/top_level.txt +0 -1
- fetchgraph-0.0.3/tests/test_relational_pandas.py +0 -172
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/LICENSE +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/setup.cfg +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/json_types.py +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/models.py +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/parsing/__init__.py +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/parsing/exceptions.py +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/parsing/extract_json.py +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/parsing/json_parser.py +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/parsing/plan_parser.py +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/protocols.py +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph/utils.py +0 -0
- {fetchgraph-0.0.3 → fetchgraph-0.1.2}/src/fetchgraph.egg-info/dependency_links.txt +0 -0
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fetchgraph
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Graph-like planning → context fetching → synthesis agent (library-style).
|
|
5
5
|
Author: Alexander Onischenko
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/AlexanderOnischenko/fetchgraph
|
|
8
|
+
Project-URL: Repository, https://github.com/AlexanderOnischenko/fetchgraph
|
|
9
|
+
Project-URL: Documentation, https://github.com/AlexanderOnischenko/fetchgraph#readme
|
|
10
|
+
Project-URL: Issues, https://github.com/AlexanderOnischenko/fetchgraph/issues
|
|
7
11
|
Keywords: agents,context,langgraph,planning,llm
|
|
8
12
|
Requires-Python: >=3.10
|
|
9
13
|
Description-Content-Type: text/markdown
|
|
@@ -12,6 +16,9 @@ Requires-Dist: pydantic>=2.6
|
|
|
12
16
|
Requires-Dist: pandas>=2.0
|
|
13
17
|
Provides-Extra: dev
|
|
14
18
|
Requires-Dist: pytest>=9.0; extra == "dev"
|
|
19
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
20
|
+
Requires-Dist: build; extra == "dev"
|
|
21
|
+
Requires-Dist: twine; extra == "dev"
|
|
15
22
|
Dynamic: license-file
|
|
16
23
|
|
|
17
24
|
# fetchgraph
|
|
@@ -20,9 +27,31 @@ Universal, library-style agent that plans what to fetch, fetches context from pl
|
|
|
20
27
|
|
|
21
28
|
**Pipeline:** PLAN → FETCH → (ASSESS/REFETCH)* → SYNTH → VERIFY → (REFINE)* → SAVE
|
|
22
29
|
|
|
23
|
-
##
|
|
30
|
+
## Why fetchgraph?
|
|
31
|
+
|
|
32
|
+
`fetchgraph` is a *library-style* LLM agent orchestrator.
|
|
33
|
+
You bring:
|
|
34
|
+
- your LLM (OpenAI, local, whatever),
|
|
35
|
+
- your data providers (DBs, APIs, files),
|
|
36
|
+
|
|
37
|
+
and `fetchgraph` handles:
|
|
38
|
+
- planning what context to fetch,
|
|
39
|
+
- calling providers with JSON selectors,
|
|
40
|
+
- packing context into the prompt,
|
|
41
|
+
- verifying / refining the result.
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
- JSON-only selectors with JSON Schema hints for planners
|
|
46
|
+
- Pluggable context providers (APIs, relational sources, etc.)
|
|
47
|
+
- Relational providers with semantic clauses
|
|
48
|
+
- CSV semantic backend (TF-IDF) for pandas providers
|
|
49
|
+
- pgvector / LangChain vector store integration
|
|
50
|
+
- Library-style API: no framework lock-in
|
|
51
|
+
|
|
52
|
+
## Install
|
|
24
53
|
```bash
|
|
25
|
-
pip install
|
|
54
|
+
pip install fetchgraph
|
|
26
55
|
```
|
|
27
56
|
|
|
28
57
|
# Quick Start
|
|
@@ -146,6 +175,7 @@ Example setup:
|
|
|
146
175
|
```python
|
|
147
176
|
from pathlib import Path
|
|
148
177
|
from fetchgraph.semantic_backend import (
|
|
178
|
+
EmbeddingModel,
|
|
149
179
|
CsvEmbeddingBuilder,
|
|
150
180
|
CsvSemanticBackend,
|
|
151
181
|
CsvSemanticSource,
|
|
@@ -181,6 +211,53 @@ provider = PandasRelationalDataProvider(
|
|
|
181
211
|
)
|
|
182
212
|
```
|
|
183
213
|
|
|
214
|
+
You can plug in an embedding model (for example, an OpenAI client) to build and
|
|
215
|
+
query dense embeddings instead of the default TF-IDF vectors:
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
from fetchgraph.semantic_backend import (
|
|
219
|
+
EmbeddingModel,
|
|
220
|
+
CsvSemanticSource,
|
|
221
|
+
CsvEmbeddingBuilder,
|
|
222
|
+
CsvSemanticBackend,
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class OpenAIEmbeddingModel:
|
|
227
|
+
def __init__(self, client):
|
|
228
|
+
self.client = client
|
|
229
|
+
|
|
230
|
+
def embed_documents(self, texts):
|
|
231
|
+
# replace with client.embeddings(...)
|
|
232
|
+
return [[1.0, 0.0] for _ in texts]
|
|
233
|
+
|
|
234
|
+
def embed_query(self, text):
|
|
235
|
+
return self.embed_documents([text])[0]
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
embedding = OpenAIEmbeddingModel(client)
|
|
239
|
+
|
|
240
|
+
CsvEmbeddingBuilder(
|
|
241
|
+
csv_path="fbs.csv",
|
|
242
|
+
entity="fbs",
|
|
243
|
+
id_column="id",
|
|
244
|
+
text_fields=["name", "description"],
|
|
245
|
+
output_path="fbs_embeddings.json",
|
|
246
|
+
embedding_model=embedding,
|
|
247
|
+
).build()
|
|
248
|
+
|
|
249
|
+
csv_backend = CsvSemanticBackend(
|
|
250
|
+
{
|
|
251
|
+
"fbs": CsvSemanticSource(
|
|
252
|
+
entity="fbs",
|
|
253
|
+
csv_path=Path("fbs.csv"),
|
|
254
|
+
embedding_path=Path("fbs_embeddings.json"),
|
|
255
|
+
)
|
|
256
|
+
},
|
|
257
|
+
embedding_model=embedding,
|
|
258
|
+
)
|
|
259
|
+
```
|
|
260
|
+
|
|
184
261
|
At query time, `SemanticClause` filters sent to the relational provider will
|
|
185
262
|
call `semantic_backend.search(...)` with the requested entity, fields, and
|
|
186
263
|
query text. Fields must be a subset of the indexed CSV columns (not including
|
|
@@ -1,28 +1,34 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: fetchgraph
|
|
3
|
-
Version: 0.0.3
|
|
4
|
-
Summary: Graph-like planning → context fetching → synthesis agent (library-style).
|
|
5
|
-
Author: Alexander Onischenko
|
|
6
|
-
License: MIT
|
|
7
|
-
Keywords: agents,context,langgraph,planning,llm
|
|
8
|
-
Requires-Python: >=3.10
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Requires-Dist: pydantic>=2.6
|
|
12
|
-
Requires-Dist: pandas>=2.0
|
|
13
|
-
Provides-Extra: dev
|
|
14
|
-
Requires-Dist: pytest>=9.0; extra == "dev"
|
|
15
|
-
Dynamic: license-file
|
|
16
|
-
|
|
17
1
|
# fetchgraph
|
|
18
2
|
|
|
19
3
|
Universal, library-style agent that plans what to fetch, fetches context from pluggable providers, and synthesizes an output.
|
|
20
4
|
|
|
21
5
|
**Pipeline:** PLAN → FETCH → (ASSESS/REFETCH)* → SYNTH → VERIFY → (REFINE)* → SAVE
|
|
22
6
|
|
|
23
|
-
##
|
|
7
|
+
## Why fetchgraph?
|
|
8
|
+
|
|
9
|
+
`fetchgraph` is a *library-style* LLM agent orchestrator.
|
|
10
|
+
You bring:
|
|
11
|
+
- your LLM (OpenAI, local, whatever),
|
|
12
|
+
- your data providers (DBs, APIs, files),
|
|
13
|
+
|
|
14
|
+
and `fetchgraph` handles:
|
|
15
|
+
- planning what context to fetch,
|
|
16
|
+
- calling providers with JSON selectors,
|
|
17
|
+
- packing context into the prompt,
|
|
18
|
+
- verifying / refining the result.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- JSON-only selectors with JSON Schema hints for planners
|
|
23
|
+
- Pluggable context providers (APIs, relational sources, etc.)
|
|
24
|
+
- Relational providers with semantic clauses
|
|
25
|
+
- CSV semantic backend (TF-IDF) for pandas providers
|
|
26
|
+
- pgvector / LangChain vector store integration
|
|
27
|
+
- Library-style API: no framework lock-in
|
|
28
|
+
|
|
29
|
+
## Install
|
|
24
30
|
```bash
|
|
25
|
-
pip install
|
|
31
|
+
pip install fetchgraph
|
|
26
32
|
```
|
|
27
33
|
|
|
28
34
|
# Quick Start
|
|
@@ -146,6 +152,7 @@ Example setup:
|
|
|
146
152
|
```python
|
|
147
153
|
from pathlib import Path
|
|
148
154
|
from fetchgraph.semantic_backend import (
|
|
155
|
+
EmbeddingModel,
|
|
149
156
|
CsvEmbeddingBuilder,
|
|
150
157
|
CsvSemanticBackend,
|
|
151
158
|
CsvSemanticSource,
|
|
@@ -181,6 +188,53 @@ provider = PandasRelationalDataProvider(
|
|
|
181
188
|
)
|
|
182
189
|
```
|
|
183
190
|
|
|
191
|
+
You can plug in an embedding model (for example, an OpenAI client) to build and
|
|
192
|
+
query dense embeddings instead of the default TF-IDF vectors:
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
from fetchgraph.semantic_backend import (
|
|
196
|
+
EmbeddingModel,
|
|
197
|
+
CsvSemanticSource,
|
|
198
|
+
CsvEmbeddingBuilder,
|
|
199
|
+
CsvSemanticBackend,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class OpenAIEmbeddingModel:
|
|
204
|
+
def __init__(self, client):
|
|
205
|
+
self.client = client
|
|
206
|
+
|
|
207
|
+
def embed_documents(self, texts):
|
|
208
|
+
# replace with client.embeddings(...)
|
|
209
|
+
return [[1.0, 0.0] for _ in texts]
|
|
210
|
+
|
|
211
|
+
def embed_query(self, text):
|
|
212
|
+
return self.embed_documents([text])[0]
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
embedding = OpenAIEmbeddingModel(client)
|
|
216
|
+
|
|
217
|
+
CsvEmbeddingBuilder(
|
|
218
|
+
csv_path="fbs.csv",
|
|
219
|
+
entity="fbs",
|
|
220
|
+
id_column="id",
|
|
221
|
+
text_fields=["name", "description"],
|
|
222
|
+
output_path="fbs_embeddings.json",
|
|
223
|
+
embedding_model=embedding,
|
|
224
|
+
).build()
|
|
225
|
+
|
|
226
|
+
csv_backend = CsvSemanticBackend(
|
|
227
|
+
{
|
|
228
|
+
"fbs": CsvSemanticSource(
|
|
229
|
+
entity="fbs",
|
|
230
|
+
csv_path=Path("fbs.csv"),
|
|
231
|
+
embedding_path=Path("fbs_embeddings.json"),
|
|
232
|
+
)
|
|
233
|
+
},
|
|
234
|
+
embedding_model=embedding,
|
|
235
|
+
)
|
|
236
|
+
```
|
|
237
|
+
|
|
184
238
|
At query time, `SemanticClause` filters sent to the relational provider will
|
|
185
239
|
call `semantic_backend.search(...)` with the requested entity, fields, and
|
|
186
240
|
query text. Fields must be a subset of the indexed CSV columns (not including
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "fetchgraph"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.1.2"
|
|
4
4
|
description = "Graph-like planning → context fetching → synthesis agent (library-style)."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
|
-
license =
|
|
7
|
+
license = "MIT"
|
|
8
8
|
authors = [{name = "Alexander Onischenko"}]
|
|
9
9
|
keywords = ["agents", "context", "langgraph", "planning", "llm"]
|
|
10
10
|
dependencies = [
|
|
@@ -22,10 +22,19 @@ package-dir = {"" = "src"}
|
|
|
22
22
|
where = ["src"]
|
|
23
23
|
|
|
24
24
|
[build-system]
|
|
25
|
-
requires = ["setuptools>=
|
|
25
|
+
requires = ["setuptools>=77.0.3", "wheel"]
|
|
26
26
|
build-backend = "setuptools.build_meta"
|
|
27
27
|
|
|
28
28
|
[project.optional-dependencies]
|
|
29
29
|
dev = [
|
|
30
30
|
"pytest>=9.0",
|
|
31
|
-
|
|
31
|
+
"pre-commit",
|
|
32
|
+
"build",
|
|
33
|
+
"twine"
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/AlexanderOnischenko/fetchgraph"
|
|
38
|
+
Repository = "https://github.com/AlexanderOnischenko/fetchgraph"
|
|
39
|
+
Documentation = "https://github.com/AlexanderOnischenko/fetchgraph#readme"
|
|
40
|
+
Issues = "https://github.com/AlexanderOnischenko/fetchgraph/issues"
|
|
@@ -7,9 +7,15 @@ if not _pydantic_version.startswith("2"):
|
|
|
7
7
|
"fetchgraph requires pydantic>=2.0; detected version %s" % _pydantic_version
|
|
8
8
|
)
|
|
9
9
|
|
|
10
|
+
import logging
|
|
11
|
+
|
|
12
|
+
logger = logging.getLogger(__name__)
|
|
13
|
+
logger.addHandler(logging.NullHandler())
|
|
14
|
+
|
|
10
15
|
from .core import (
|
|
11
16
|
ContextPacker,
|
|
12
17
|
BaseGraphAgent,
|
|
18
|
+
create_generic_agent,
|
|
13
19
|
make_llm_plan_generic,
|
|
14
20
|
make_llm_synth_generic,
|
|
15
21
|
)
|
|
@@ -84,6 +90,7 @@ __all__ = [
|
|
|
84
90
|
"LLMInvoke",
|
|
85
91
|
"ContextPacker",
|
|
86
92
|
"BaseGraphAgent",
|
|
93
|
+
"create_generic_agent",
|
|
87
94
|
"make_llm_plan_generic",
|
|
88
95
|
"make_llm_synth_generic",
|
|
89
96
|
"AggregationResult",
|
|
@@ -116,7 +123,5 @@ __all__ = [
|
|
|
116
123
|
"PgVectorSemanticBackend",
|
|
117
124
|
"PgVectorSemanticSource",
|
|
118
125
|
"VectorStoreLike",
|
|
126
|
+
"PandasRelationalDataProvider",
|
|
119
127
|
]
|
|
120
|
-
|
|
121
|
-
if PandasRelationalDataProvider is not None:
|
|
122
|
-
__all__.append("PandasRelationalDataProvider")
|