Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Dependabot configuration for the GraphRAG uv workspace monorepo.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
# Python dependencies managed by uv. The workspace root (/) holds the shared
# uv.lock and the dev dependency group; each workspace member manifest lives
# under packages/*. The unified-search-app project is intentionally excluded
# (it lives at the repo root, not under packages/, and is maintained separately).
- package-ecosystem: "uv"
directories:
- "/"
- "/packages/*"
Comment thread
dworthen marked this conversation as resolved.
schedule:
interval: "weekly"
open-pull-requests-limit: 10
groups:
# Azure SDKs tend to move together; keep them in a single PR.
azure:
patterns:
- "azure-*"
# Development and release tooling (lint, type-check, test, docs, release).
dev-tooling:
patterns:
- "pytest*"
- "ruff"
- "pyright"
- "ipykernel"
- "jupyter"
- "nbconvert"
- "coverage"
- "deptry"
- "poethepoet"
- "semversioner"
- "pandas-stubs"
- "mkdocs*"
- package-ecosystem: "github-actions"
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.)
# Workflow files stored in the default location of `.github/workflows`.
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
patterns:
- "*"
4 changes: 4 additions & 0 deletions .semversioner/next-release/patch-20260715164826396721.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "Bump dependencies."
}
2 changes: 1 addition & 1 deletion packages/graphrag-common/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ classifiers = [
dependencies = [
"python-dotenv~=1.0",
"pyyaml~=6.0",
"toml",
"toml~=0.10",
]

[project.urls]
Expand Down
5 changes: 2 additions & 3 deletions packages/graphrag-input/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ classifiers = [
]
dependencies = [
"graphrag-common==3.1.0",
"graphrag-storage==3.1.0 ",
"graphrag-storage==3.1.0",
"pydantic~=2.10",
"markitdown~=0.1.0",
"markitdown[pdf]",
"markitdown[pdf]~=0.1.0",
"pyarrow>=14.0.0"
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ async def completion_async(

@property
def metrics_store(self) -> "MetricsStore":
"""Get metrics store."""
"""The metrics store."""
return self._metrics_store

@property
def tokenizer(self) -> "Tokenizer":
"""Get tokenizer."""
"""The tokenizer."""
return self._tokenizer


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ async def completion_async(

@property
def metrics_store(self) -> "MetricsStore":
"""Get metrics store."""
"""The metrics store."""
return self._metrics_store

@property
def tokenizer(self) -> "Tokenizer":
"""Get tokenizer."""
"""The tokenizer."""
return self._tokenizer
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ async def embedding_async(

@property
def metrics_store(self) -> "MetricsStore":
"""Get metrics store."""
"""The metrics store."""
return self._metrics_store

@property
def tokenizer(self) -> "Tokenizer":
"""Get tokenizer."""
"""The tokenizer."""
return self._tokenizer


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ async def embedding_async(

@property
def metrics_store(self) -> "MetricsStore":
"""Get metrics store."""
"""The metrics store."""
return self._metrics_store

@property
def tokenizer(self) -> "Tokenizer":
"""Get tokenizer."""
"""The tokenizer."""
return self._tokenizer
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _on_exit_(self) -> None:

@property
def id(self) -> str:
"""Get the ID of the metrics store."""
"""The ID of the metrics store."""
return self._id

def update_metrics(self, *, metrics: "Metrics") -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
@property
@abstractmethod
def id(self) -> str:
"""Get the ID of the metrics store."""
"""The ID of the metrics store."""
raise NotImplementedError

@abstractmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(

@property
def id(self) -> str:
"""Get the ID of the metrics store."""
"""The ID of the metrics store."""
return ""

def update_metrics(self, *, metrics: Metrics) -> None:
Expand Down
6 changes: 3 additions & 3 deletions packages/graphrag-llm/graphrag_llm/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class LLMCompletionResponse(ChatCompletion, Generic[ResponseFormat]):
@computed_field
@property
def content(self) -> str:
"""Get the content of the first choice message."""
"""The content of the first choice message."""
return self.choices[0].message.content or ""


Expand Down Expand Up @@ -191,13 +191,13 @@ class LLMEmbeddingResponse(CreateEmbeddingResponse):
@computed_field
@property
def embeddings(self) -> list[list[float]]:
"""Get the embeddings as a list of lists of floats."""
"""The embeddings as a list of lists of floats."""
return [data.embedding for data in self.data]

@computed_field
@property
def first_embedding(self) -> list[float]:
"""Get the first embedding."""
"""The first embedding."""
return self.embeddings[0] if self.embeddings else []


Expand Down
6 changes: 3 additions & 3 deletions packages/graphrag-llm/notebooks/05_caching.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "21e0e1e4",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -203,7 +203,7 @@
" messages=\"It is sunny and 52 degrees fahrenheit in Seattle. It is cloudy and 75 degrees fahrenheit in San Francisco.\",\n",
" response_format=WeatherReports,\n",
") # type: ignore\n",
"response: LLMCompletionResponse[WeatherReports] = llm_completion.completion( # type: ignore\n",
"response: LLMCompletionResponse[WeatherReports] = llm_completion.completion( # type: ignore # noqa: F811\n",
" messages=\"It is sunny and 52 degrees fahrenheit in Seattle. It is cloudy and 75 degrees fahrenheit in San Francisco.\",\n",
" response_format=WeatherReports,\n",
") # type: ignore\n",
Expand All @@ -228,7 +228,7 @@
"\n",
"llm_completion.metrics_store.clear_metrics()\n",
"# Same request but different response format. Should not hit cache.\n",
"response: LLMCompletionResponse[WeatherReports2] = llm_completion.completion(\n",
"response: LLMCompletionResponse[WeatherReports2] = llm_completion.completion( # noqa: F811\n",
" messages=\"It is sunny and 52 degrees fahrenheit in Seattle. It is cloudy and 75 degrees fahrenheit in San Francisco.\",\n",
" response_format=WeatherReports2,\n",
") # type: ignore\n",
Expand Down
8 changes: 6 additions & 2 deletions packages/graphrag-llm/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ classifiers = [
]
dependencies = [
"azure-identity~=1.25",
# fastapi is required for litellm tool calling. https://github.com/BerriAI/litellm/issues/32993
"fastapi>=0.136.3,<1.0",
"graphrag-cache==3.1.0",
"graphrag-common==3.1.0",
"jinja2~=3.1",
"litellm==1.86.2",
"litellm==1.92.0",
"nest-asyncio2~=1.7",
# orjson is required for litellm tool calling. https://github.com/BerriAI/litellm/issues/32993
"orjson>=3.11.6,<4.0",
"pydantic~=2.10",
"typing-extensions~=4.12"
"typing-extensions~=4.12",
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ async def _aiter_impl(self) -> AsyncIterator[Any]:
"""Implement async iteration over rows."""
if isinstance(self._storage, FileStorage):
file_path = self._storage.get_path(self._file_key)
with Path.open(file_path, "r", encoding=self._encoding) as f:
f = Path.open(file_path, "r", encoding=self._encoding)
try:
reader = csv.DictReader(f)
for row in reader:
yield _apply_transformer(self._transformer, row)
finally:
f.close()

async def length(self) -> int:
"""Return the number of rows in the table."""
Expand Down
4 changes: 2 additions & 2 deletions packages/graphrag-storage/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ classifiers = [
"Programming Language :: Python :: 3.13",
]
dependencies = [
"aiofiles~=24.1",
"aiofiles~=25.1",
"azure-cosmos~=4.9",
"azure-identity~=1.25",
"azure-storage-blob~=12.24",
"graphrag-common==3.1.0",
"pandas~=2.3",
"pandas~=3.0",
"pydantic~=2.10",
]

Expand Down
6 changes: 3 additions & 3 deletions packages/graphrag-vectors/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ dependencies = [
"azure-core~=1.32",
"azure-cosmos~=4.9",
"azure-identity~=1.25",
"azure-search-documents~=11.6",
"azure-search-documents~=12.0",
"graphrag-common==3.1.0",
"lancedb~=0.24.1",
"lancedb~=0.34.0",
"numpy~=2.1",
"pyarrow~=22.0",
"pyarrow~=25.0",
"pydantic~=2.10",
]

Expand Down
2 changes: 1 addition & 1 deletion packages/graphrag/graphrag/graphs/modularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def _modularity_components(
degree_sums_for[tgt_comm] += weight
total_edge_weight += weight

if total_edge_weight == 0.0:
if total_edge_weight <= 0.0:
return dict.fromkeys(communities, 0.0)

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def finalize_community_reports(
communities.loc[:, ["community", "parent", "children", "size", "period"]],
on="community",
how="left",
copy=False,
)

community_reports["community"] = community_reports["community"].astype(int)
Expand Down
2 changes: 1 addition & 1 deletion packages/graphrag/graphrag/index/run/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __exit__(

@property
def metrics(self) -> WorkflowMetrics:
"""Return collected metrics as a WorkflowMetrics dataclass."""
"""The collected metrics as a WorkflowMetrics dataclass."""
return WorkflowMetrics(
overall=self._elapsed,
peak_memory_bytes=self._peak_memory,
Expand Down
6 changes: 3 additions & 3 deletions packages/graphrag/graphrag/index/update/communities.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _update_and_merge_communities(
# Increment only the non-NaN values in delta_communities["community"]
community_id_mapping = {
v: v + old_max_community_id + 1
for k, v in delta_communities["community"].dropna().astype(int).items()
for v in delta_communities["community"].dropna().astype(int)
}
community_id_mapping.update({-1: -1})

Expand All @@ -69,7 +69,7 @@ def _update_and_merge_communities(

# Merge the final communities
merged_communities = pd.concat(
[old_communities, delta_communities], ignore_index=True, copy=False
[old_communities, delta_communities], ignore_index=True
)

# Rename title
Expand Down Expand Up @@ -136,7 +136,7 @@ def _update_and_merge_community_reports(

# Merge the final community reports
merged_community_reports = pd.concat(
[old_community_reports, delta_community_reports], ignore_index=True, copy=False
[old_community_reports, delta_community_reports], ignore_index=True
)

# Maintain type compat with query
Expand Down
5 changes: 1 addition & 4 deletions packages/graphrag/graphrag/index/update/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def _group_and_resolve_entities(
old_entities_df[["id", "title"]],
on="title",
suffixes=("_B", "_A"),
copy=False,
)
id_mapping = dict(zip(merged["id_B"], merged["id_A"], strict=True))

Expand All @@ -45,9 +44,7 @@ def _group_and_resolve_entities(
initial_id, initial_id + len(delta_entities_df)
)
# Concat A and B
combined = pd.concat(
[old_entities_df, delta_entities_df], ignore_index=True, copy=False
)
combined = pd.concat([old_entities_df, delta_entities_df], ignore_index=True)

# Group by title and resolve conflicts
aggregated = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async def concat_dataframes(
# Merge the final documents
initial_id = old_df["human_readable_id"].max() + 1
delta_df["human_readable_id"] = np.arange(initial_id, initial_id + len(delta_df))
final_df = pd.concat([old_df, delta_df], ignore_index=True, copy=False)
final_df = pd.concat([old_df, delta_df], ignore_index=True)

await output_table_provider.write_dataframe(name, final_df)

Expand Down
2 changes: 1 addition & 1 deletion packages/graphrag/graphrag/index/update/relationships.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _update_and_merge_relationships(

# Merge the DataFrames without copying if possible
merged_relationships = pd.concat(
[old_relationships, delta_relationships], ignore_index=True, copy=False
[old_relationships, delta_relationships], ignore_index=True
)

# Group by title and resolve conflicts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ def _merge_covariates(
)

# Concatenate the old and delta covariates
return pd.concat([old_covariates, delta_covariates], ignore_index=True, copy=False)
return pd.concat([old_covariates, delta_covariates], ignore_index=True)
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ def _update_and_merge_text_units(
initial_id, initial_id + len(delta_text_units)
)
# Merge the final text units
return pd.concat([old_text_units, delta_text_units], ignore_index=True, copy=False)
return pd.concat([old_text_units, delta_text_units], ignore_index=True)
4 changes: 3 additions & 1 deletion packages/graphrag/graphrag/logger/blob_workflow_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ def _write_log(self, log: dict[str, Any]):
blob_client = self._blob_service_client.get_blob_client(
self._container_name, self._blob_name
)
blob_client.append_block(json.dumps(log, indent=4, ensure_ascii=False) + "\n")
blob_client.append_block(
(json.dumps(log, indent=4, ensure_ascii=False) + "\n").encode("utf-8")
)

# update the blob's block count
self._num_blocks += 1
Loading
Loading