graphsight-langgraph 0.1.4__tar.gz → 0.2.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.
- {graphsight_langgraph-0.1.4/graphsight_langgraph.egg-info → graphsight_langgraph-0.2.0}/PKG-INFO +36 -8
- graphsight_langgraph-0.1.4/PKG-INFO → graphsight_langgraph-0.2.0/README.md +259 -258
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/graphsight_langgraph/__init__.py +7 -3
- graphsight_langgraph-0.2.0/graphsight_langgraph/capture.py +43 -0
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/graphsight_langgraph/mapper.py +22 -3
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/graphsight_langgraph/schema.py +4 -1
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/graphsight_langgraph/tracer.py +28 -0
- graphsight_langgraph-0.1.4/README.md → graphsight_langgraph-0.2.0/graphsight_langgraph.egg-info/PKG-INFO +286 -231
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/graphsight_langgraph.egg-info/SOURCES.txt +1 -0
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/pyproject.toml +1 -1
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/LICENSE +0 -0
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/graphsight_langgraph/github_ingest.py +0 -0
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/graphsight_langgraph.egg-info/dependency_links.txt +0 -0
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/graphsight_langgraph.egg-info/entry_points.txt +0 -0
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/graphsight_langgraph.egg-info/requires.txt +0 -0
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/graphsight_langgraph.egg-info/top_level.txt +0 -0
- {graphsight_langgraph-0.1.4 → graphsight_langgraph-0.2.0}/setup.cfg +0 -0
{graphsight_langgraph-0.1.4/graphsight_langgraph.egg-info → graphsight_langgraph-0.2.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: graphsight-langgraph
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: X-ray for LangGraph retrieval: one callback handler captures every retriever call, score, and relational path — rendered as an interactive graph.
|
|
5
5
|
Author: Arush Karnatak
|
|
6
6
|
License: MIT
|
|
@@ -114,15 +114,38 @@ which this deliberately simple demo does not pretend to do.
|
|
|
114
114
|
The complete integration:
|
|
115
115
|
|
|
116
116
|
```python
|
|
117
|
-
from graphsight_langgraph import LangGraphTracer,
|
|
117
|
+
from graphsight_langgraph import LangGraphTracer, capture
|
|
118
118
|
|
|
119
119
|
tracer = LangGraphTracer()
|
|
120
120
|
result = graph.invoke(inputs, config={"callbacks": [tracer]})
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
capture(tracer, query="why is checkout failing?", answer=result["answer"])
|
|
123
|
+
# -> .graphsight/20260725T071558_why-is-checkout-failing.json
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
+
`capture()` finishes the trace and appends it to a local history directory
|
|
127
|
+
(`./.graphsight/` by default, `$GRAPHSIGHT_DIR` to override) — browse every
|
|
128
|
+
run with `graphsight .graphsight/`. For manual control use
|
|
129
|
+
`tracer.finish()` + `to_tracestate()` / `save_trace()`; `trace.to_dict()`
|
|
130
|
+
gives the framework-neutral `AgentTrace` for your own tooling.
|
|
131
|
+
|
|
132
|
+
### Retrieved vs. used
|
|
133
|
+
|
|
134
|
+
When you pass `answer=`, each retrieved item gets an `answer_overlap`
|
|
135
|
+
score — the lexical overlap between the item's content and the final
|
|
136
|
+
answer. In the viewer, items that surfaced in the answer render
|
|
137
|
+
highlighted; items retrieved but unused render dimmed with the label
|
|
138
|
+
*"retrieved, unused."* That splits the two classic retrieval failures at a
|
|
139
|
+
glance:
|
|
140
|
+
|
|
141
|
+
- **right doc retrieved, ignored by the model** → dimmed node with a high
|
|
142
|
+
retrieval score
|
|
143
|
+
- **wrong doc trusted** → highlighted node that shouldn't be
|
|
144
|
+
|
|
145
|
+
The overlap is a lexical heuristic (labeled as such, threshold 0.2) — it is
|
|
146
|
+
never presented as a model-computed relevance judgment. No `answer=` → no
|
|
147
|
+
usage claims; everything renders plain.
|
|
148
|
+
|
|
126
149
|
### Configuration propagation (read this once)
|
|
127
150
|
|
|
128
151
|
LangChain only propagates callbacks into runnables that receive the run's
|
|
@@ -144,7 +167,9 @@ retrievals.
|
|
|
144
167
|
| Name | Description |
|
|
145
168
|
|---|---|
|
|
146
169
|
| `LangGraphTracer()` | `BaseCallbackHandler` subclass. Pass via `config={"callbacks": [tracer]}` to `invoke` / `stream`. Reusable within a single run; create a fresh instance per run. |
|
|
147
|
-
| `tracer.finish(query=None, answer=None) -> AgentTrace` | Assembles the trace after the run: closes dangling spans, computes total latency
|
|
170
|
+
| `tracer.finish(query=None, answer=None) -> AgentTrace` | Assembles the trace after the run: closes dangling spans, computes total latency and per-item `answer_overlap`. `query` falls back to the first retriever query seen. |
|
|
171
|
+
| `capture(tracer, query=None, answer=None, dir=None) -> Path` | `finish()` + save to the history directory in one call. |
|
|
172
|
+
| `save_trace(trace, dir=None) -> Path` | Writes a finished trace to the history directory (`./.graphsight/` or `$GRAPHSIGHT_DIR`). |
|
|
148
173
|
| `to_tracestate(trace) -> dict` | Maps an `AgentTrace` to the viewer's JSON contract. Serialize with `json.dump`. |
|
|
149
174
|
| `trace.to_dict() -> dict` | The framework-neutral `AgentTrace` (schema v0.1) for your own tooling. |
|
|
150
175
|
| `AgentTrace`, `Span`, `Retrieval`, `RetrievedItem`, `TraceEdge` | Plain dataclasses defining the schema; importable for custom emitters. |
|
|
@@ -160,6 +185,7 @@ retrievals.
|
|
|
160
185
|
| `Document.metadata["edges"]` | relational edges, deduplicated per retrieval |
|
|
161
186
|
| LLM / tool calls | plain spans in the execution timeline |
|
|
162
187
|
| Edges present in a retrieval | `arm = "graph"`, else `"vector"` — detected automatically |
|
|
188
|
+
| The final answer (when passed to `finish`/`capture`) | per-item `answer_overlap` — the retrieved-vs-used signal |
|
|
163
189
|
|
|
164
190
|
### Making your retriever graph-aware
|
|
165
191
|
|
|
@@ -198,14 +224,15 @@ else renders as `Document`).
|
|
|
198
224
|
retriever and were not recomputed — an imported trace never masquerades
|
|
199
225
|
as an engine-computed one.
|
|
200
226
|
|
|
201
|
-
## Schema (v0.
|
|
227
|
+
## Schema (v0.2)
|
|
202
228
|
|
|
203
229
|
`AgentTrace` is the stable contract. Future adapters (LlamaIndex, raw
|
|
204
|
-
OpenTelemetry) emit the same shape and render in the same viewer.
|
|
230
|
+
OpenTelemetry) emit the same shape and render in the same viewer. v0.2 adds
|
|
231
|
+
`RetrievedItem.answer_overlap` (additive — v0.1 traces stay valid).
|
|
205
232
|
|
|
206
233
|
```jsonc
|
|
207
234
|
{
|
|
208
|
-
"schema_version": "0.
|
|
235
|
+
"schema_version": "0.2",
|
|
209
236
|
"framework": "langgraph",
|
|
210
237
|
"query": "…",
|
|
211
238
|
"spans": [
|
|
@@ -219,6 +246,7 @@ OpenTelemetry) emit the same shape and render in the same viewer.
|
|
|
219
246
|
"items": [
|
|
220
247
|
{ "id": "pr_4821", "label": "PR #4821", "kind": "pull_request",
|
|
221
248
|
"score": 0.94, "vector_score": null, "graph_score": null,
|
|
249
|
+
"answer_overlap": 0.41, // null when no answer given
|
|
222
250
|
"content": "…", "source_uri": "https://…", "metadata": {} }
|
|
223
251
|
],
|
|
224
252
|
"edges": [ // optional — the relational view
|