Skip to content

Commit a8b6a7b

Browse files
Copilotjgbradley1
andcommitted
Fix pyright errors by removing WorkflowCallbacks from strategy type signatures
Co-authored-by: jgbradley1 <654554+jgbradley1@users.noreply.github.com>
1 parent a8bda86 commit a8b6a7b

File tree

3 files changed

+30
-39
lines changed

3 files changed

+30
-39
lines changed

graphrag/index/operations/extract_graph/typing.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import networkx as nx
1212

1313
from graphrag.cache.pipeline_cache import PipelineCache
14-
from graphrag.callbacks.workflow_callbacks import WorkflowCallbacks
1514

1615
ExtractedEntity = dict[str, Any]
1716
ExtractedRelationship = dict[str, Any]
@@ -40,7 +39,6 @@ class EntityExtractionResult:
4039
[
4140
list[Document],
4241
EntityTypes,
43-
WorkflowCallbacks,
4442
PipelineCache,
4543
StrategyConfig,
4644
],

graphrag/index/operations/summarize_descriptions/typing.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from typing import Any, NamedTuple
1010

1111
from graphrag.cache.pipeline_cache import PipelineCache
12-
from graphrag.callbacks.workflow_callbacks import WorkflowCallbacks
1312

1413
StrategyConfig = dict[str, Any]
1514

@@ -26,7 +25,6 @@ class SummarizedDescriptionResult:
2625
[
2726
str | tuple[str, str],
2827
list[str],
29-
WorkflowCallbacks,
3028
PipelineCache,
3129
StrategyConfig,
3230
],

tests/unit/indexing/verbs/entities/extraction/strategies/graph_intelligence/test_gi_entity_extraction.py

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@
1414
class TestRunChain(unittest.IsolatedAsyncioTestCase):
1515
async def test_run_extract_graph_single_document_correct_entities_returned(self):
1616
results = await run_extract_graph(
17-
docs=[Document("test_text", "1")],
18-
entity_types=["person"],
19-
callbacks=None,
20-
args={
21-
"max_gleanings": 0,
22-
"summarize_descriptions": False,
23-
},
2417
model=create_mock_llm(
2518
responses=[
2619
"""
@@ -37,6 +30,12 @@ async def test_run_extract_graph_single_document_correct_entities_returned(self)
3730
],
3831
name="test_run_extract_graph_single_document_correct_entities_returned",
3932
),
33+
docs=[Document("test_text", "1")],
34+
entity_types=["person"],
35+
args={
36+
"max_gleanings": 0,
37+
"summarize_descriptions": False,
38+
},
4039
)
4140

4241
# self.assertItemsEqual isn't available yet, or I am just silly
@@ -49,13 +48,6 @@ async def test_run_extract_graph_multiple_documents_correct_entities_returned(
4948
self,
5049
):
5150
results = await run_extract_graph(
52-
docs=[Document("text_1", "1"), Document("text_2", "2")],
53-
entity_types=["person"],
54-
callbacks=None,
55-
args={
56-
"max_gleanings": 0,
57-
"summarize_descriptions": False,
58-
},
5951
model=create_mock_llm(
6052
responses=[
6153
"""
@@ -76,6 +68,12 @@ async def test_run_extract_graph_multiple_documents_correct_entities_returned(
7668
],
7769
name="test_run_extract_graph_multiple_documents_correct_entities_returned",
7870
),
71+
docs=[Document("text_1", "1"), Document("text_2", "2")],
72+
entity_types=["person"],
73+
args={
74+
"max_gleanings": 0,
75+
"summarize_descriptions": False,
76+
},
7977
)
8078

8179
# self.assertItemsEqual isn't available yet, or I am just silly
@@ -86,13 +84,6 @@ async def test_run_extract_graph_multiple_documents_correct_entities_returned(
8684

8785
async def test_run_extract_graph_multiple_documents_correct_edges_returned(self):
8886
results = await run_extract_graph(
89-
docs=[Document("text_1", "1"), Document("text_2", "2")],
90-
entity_types=["person"],
91-
callbacks=None,
92-
args={
93-
"max_gleanings": 0,
94-
"summarize_descriptions": False,
95-
},
9687
model=create_mock_llm(
9788
responses=[
9889
"""
@@ -113,6 +104,12 @@ async def test_run_extract_graph_multiple_documents_correct_edges_returned(self)
113104
],
114105
name="test_run_extract_graph_multiple_documents_correct_edges_returned",
115106
),
107+
docs=[Document("text_1", "1"), Document("text_2", "2")],
108+
entity_types=["person"],
109+
args={
110+
"max_gleanings": 0,
111+
"summarize_descriptions": False,
112+
},
116113
)
117114

118115
# self.assertItemsEqual isn't available yet, or I am just silly
@@ -131,13 +128,6 @@ async def test_run_extract_graph_multiple_documents_correct_entity_source_ids_ma
131128
self,
132129
):
133130
results = await run_extract_graph(
134-
docs=[Document("text_1", "1"), Document("text_2", "2")],
135-
entity_types=["person"],
136-
callbacks=None,
137-
args={
138-
"max_gleanings": 0,
139-
"summarize_descriptions": False,
140-
},
141131
model=create_mock_llm(
142132
responses=[
143133
"""
@@ -158,6 +148,12 @@ async def test_run_extract_graph_multiple_documents_correct_entity_source_ids_ma
158148
],
159149
name="test_run_extract_graph_multiple_documents_correct_entity_source_ids_mapped",
160150
),
151+
docs=[Document("text_1", "1"), Document("text_2", "2")],
152+
entity_types=["person"],
153+
args={
154+
"max_gleanings": 0,
155+
"summarize_descriptions": False,
156+
},
161157
)
162158

163159
graph = results.graph
@@ -181,13 +177,6 @@ async def test_run_extract_graph_multiple_documents_correct_edge_source_ids_mapp
181177
self,
182178
):
183179
results = await run_extract_graph(
184-
docs=[Document("text_1", "1"), Document("text_2", "2")],
185-
entity_types=["person"],
186-
callbacks=None,
187-
args={
188-
"max_gleanings": 0,
189-
"summarize_descriptions": False,
190-
},
191180
model=create_mock_llm(
192181
responses=[
193182
"""
@@ -208,6 +197,12 @@ async def test_run_extract_graph_multiple_documents_correct_edge_source_ids_mapp
208197
],
209198
name="test_run_extract_graph_multiple_documents_correct_edge_source_ids_mapped",
210199
),
200+
docs=[Document("text_1", "1"), Document("text_2", "2")],
201+
entity_types=["person"],
202+
args={
203+
"max_gleanings": 0,
204+
"summarize_descriptions": False,
205+
},
211206
)
212207

213208
graph = results.graph

0 commit comments

Comments
 (0)