fetchgraph 0.0.3__tar.gz → 0.1.1__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.
Files changed (43) hide show
  1. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/PKG-INFO +79 -4
  2. fetchgraph-0.0.3/src/fetchgraph.egg-info/PKG-INFO → fetchgraph-0.1.1/README.md +72 -18
  3. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/pyproject.toml +11 -4
  4. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/__init__.py +8 -3
  5. fetchgraph-0.1.1/src/fetchgraph/core.py +802 -0
  6. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/prompts/plan_generic.md +9 -1
  7. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/prompts/synth_generic.md +3 -0
  8. fetchgraph-0.1.1/src/fetchgraph/relational_base.py +307 -0
  9. fetchgraph-0.1.1/src/fetchgraph/relational_composite.py +1081 -0
  10. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/relational_models.py +9 -1
  11. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/relational_pandas.py +237 -30
  12. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/relational_provider.py +3 -8
  13. fetchgraph-0.1.1/src/fetchgraph/relational_schema.py +381 -0
  14. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/relational_sql.py +268 -114
  15. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/semantic_backend.py +181 -51
  16. fetchgraph-0.0.3/README.md → fetchgraph-0.1.1/src/fetchgraph.egg-info/PKG-INFO +94 -3
  17. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph.egg-info/SOURCES.txt +5 -1
  18. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph.egg-info/requires.txt +1 -0
  19. fetchgraph-0.1.1/tests/test_relational_base.py +18 -0
  20. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/tests/test_relational_composite.py +65 -0
  21. fetchgraph-0.1.1/tests/test_relational_composite_cross_provider.py +394 -0
  22. fetchgraph-0.0.3/tests/test_relational_sql.py → fetchgraph-0.1.1/tests/test_relational_pandas.py +98 -91
  23. fetchgraph-0.1.1/tests/test_relational_sql.py +697 -0
  24. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/tests/test_semantic_backend_csv.py +107 -1
  25. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/tests/test_semantic_backend_pgvector.py +83 -0
  26. fetchgraph-0.1.1/tests/test_streaming_cross_joins.py +442 -0
  27. fetchgraph-0.0.3/src/fetchgraph/core.py +0 -354
  28. fetchgraph-0.0.3/src/fetchgraph/relational_base.py +0 -140
  29. fetchgraph-0.0.3/src/fetchgraph/relational_composite.py +0 -101
  30. fetchgraph-0.0.3/tests/test_relational_pandas.py +0 -172
  31. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/LICENSE +0 -0
  32. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/setup.cfg +0 -0
  33. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/json_types.py +0 -0
  34. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/models.py +0 -0
  35. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/parsing/__init__.py +0 -0
  36. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/parsing/exceptions.py +0 -0
  37. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/parsing/extract_json.py +0 -0
  38. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/parsing/json_parser.py +0 -0
  39. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/parsing/plan_parser.py +0 -0
  40. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/protocols.py +0 -0
  41. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph/utils.py +0 -0
  42. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph.egg-info/dependency_links.txt +0 -0
  43. {fetchgraph-0.0.3 → fetchgraph-0.1.1}/src/fetchgraph.egg-info/top_level.txt +0 -0
@@ -1,9 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fetchgraph
3
- Version: 0.0.3
3
+ Version: 0.1.1
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,7 @@ 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"
15
20
  Dynamic: license-file
16
21
 
17
22
  # fetchgraph
@@ -20,9 +25,31 @@ Universal, library-style agent that plans what to fetch, fetches context from pl
20
25
 
21
26
  **Pipeline:** PLAN → FETCH → (ASSESS/REFETCH)* → SYNTH → VERIFY → (REFINE)* → SAVE
22
27
 
23
- ## Install (dev)
28
+ ## Why fetchgraph?
29
+
30
+ `fetchgraph` is a *library-style* LLM agent orchestrator.
31
+ You bring:
32
+ - your LLM (OpenAI, local, whatever),
33
+ - your data providers (DBs, APIs, files),
34
+
35
+ and `fetchgraph` handles:
36
+ - planning what context to fetch,
37
+ - calling providers with JSON selectors,
38
+ - packing context into the prompt,
39
+ - verifying / refining the result.
40
+
41
+ ## Features
42
+
43
+ - JSON-only selectors with JSON Schema hints for planners
44
+ - Pluggable context providers (APIs, relational sources, etc.)
45
+ - Relational providers with semantic clauses
46
+ - CSV semantic backend (TF-IDF) for pandas providers
47
+ - pgvector / LangChain vector store integration
48
+ - Library-style API: no framework lock-in
49
+
50
+ ## Install
24
51
  ```bash
25
- pip install -e .
52
+ pip install fetchgaph
26
53
  ```
27
54
 
28
55
  # Quick Start
@@ -146,6 +173,7 @@ Example setup:
146
173
  ```python
147
174
  from pathlib import Path
148
175
  from fetchgraph.semantic_backend import (
176
+ EmbeddingModel,
149
177
  CsvEmbeddingBuilder,
150
178
  CsvSemanticBackend,
151
179
  CsvSemanticSource,
@@ -181,6 +209,53 @@ provider = PandasRelationalDataProvider(
181
209
  )
182
210
  ```
183
211
 
212
+ You can plug in an embedding model (for example, an OpenAI client) to build and
213
+ query dense embeddings instead of the default TF-IDF vectors:
214
+
215
+ ```python
216
+ from fetchgraph.semantic_backend import (
217
+ EmbeddingModel,
218
+ CsvSemanticSource,
219
+ CsvEmbeddingBuilder,
220
+ CsvSemanticBackend,
221
+ )
222
+
223
+
224
+ class OpenAIEmbeddingModel:
225
+ def __init__(self, client):
226
+ self.client = client
227
+
228
+ def embed_documents(self, texts):
229
+ # replace with client.embeddings(...)
230
+ return [[1.0, 0.0] for _ in texts]
231
+
232
+ def embed_query(self, text):
233
+ return self.embed_documents([text])[0]
234
+
235
+
236
+ embedding = OpenAIEmbeddingModel(client)
237
+
238
+ CsvEmbeddingBuilder(
239
+ csv_path="fbs.csv",
240
+ entity="fbs",
241
+ id_column="id",
242
+ text_fields=["name", "description"],
243
+ output_path="fbs_embeddings.json",
244
+ embedding_model=embedding,
245
+ ).build()
246
+
247
+ csv_backend = CsvSemanticBackend(
248
+ {
249
+ "fbs": CsvSemanticSource(
250
+ entity="fbs",
251
+ csv_path=Path("fbs.csv"),
252
+ embedding_path=Path("fbs_embeddings.json"),
253
+ )
254
+ },
255
+ embedding_model=embedding,
256
+ )
257
+ ```
258
+
184
259
  At query time, `SemanticClause` filters sent to the relational provider will
185
260
  call `semantic_backend.search(...)` with the requested entity, fields, and
186
261
  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
- ## Install (dev)
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 -e .
31
+ pip install fetchgaph
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.0.3"
3
+ version = "0.1.1"
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 = {text = "MIT"}
7
+ license = "MIT"
8
8
  authors = [{name = "Alexander Onischenko"}]
9
9
  keywords = ["agents", "context", "langgraph", "planning", "llm"]
10
10
  dependencies = [
@@ -22,10 +22,17 @@ package-dir = {"" = "src"}
22
22
  where = ["src"]
23
23
 
24
24
  [build-system]
25
- requires = ["setuptools>=67", "wheel"]
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
+ ]
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/AlexanderOnischenko/fetchgraph"
36
+ Repository = "https://github.com/AlexanderOnischenko/fetchgraph"
37
+ Documentation = "https://github.com/AlexanderOnischenko/fetchgraph#readme"
38
+ 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")