mirror of
https://github.com/microsoft/graphrag.git
synced 2025-06-26 23:19:58 +00:00
Stabilize smoke tests for query community context building (#908)
* Stabilize smoke tests for query community context building * Fix CODEOWNERS
This commit is contained in:
parent
073f650ba9
commit
7fd23fa79c
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"type": "patch",
|
||||||
|
"description": "Stabilize smoke tests for query context building"
|
||||||
|
}
|
@ -2,5 +2,4 @@
|
|||||||
# the repo. Unless a later match takes precedence,
|
# the repo. Unless a later match takes precedence,
|
||||||
# @global-owner1 and @global-owner2 will be requested for
|
# @global-owner1 and @global-owner2 will be requested for
|
||||||
# review when someone opens a pull request.
|
# review when someone opens a pull request.
|
||||||
* @microsoft/societal-resilience
|
* @microsoft/societal-resilience @microsoft/graphrag-core-team
|
||||||
* @microsoft/graphrag-core-team
|
|
||||||
|
@ -15,6 +15,10 @@ from graphrag.query.llm.text_utils import num_tokens
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
NO_COMMUNITY_RECORDS_WARNING: str = (
|
||||||
|
"Warning: No community records added when building community context."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def build_community_context(
|
def build_community_context(
|
||||||
community_reports: list[CommunityReport],
|
community_reports: list[CommunityReport],
|
||||||
@ -128,9 +132,9 @@ def build_community_context(
|
|||||||
record_df = _convert_report_context_to_df(
|
record_df = _convert_report_context_to_df(
|
||||||
context_records=batch_records,
|
context_records=batch_records,
|
||||||
header=header,
|
header=header,
|
||||||
weight_column=community_weight_name
|
weight_column=(
|
||||||
if entities and include_community_weight
|
community_weight_name if entities and include_community_weight else None
|
||||||
else None,
|
),
|
||||||
rank_column=community_rank_name if include_community_rank else None,
|
rank_column=community_rank_name if include_community_rank else None,
|
||||||
)
|
)
|
||||||
if len(record_df) == 0:
|
if len(record_df) == 0:
|
||||||
@ -163,9 +167,7 @@ def build_community_context(
|
|||||||
_cut_batch()
|
_cut_batch()
|
||||||
|
|
||||||
if len(all_context_records) == 0:
|
if len(all_context_records) == 0:
|
||||||
log.warning(
|
log.warning(NO_COMMUNITY_RECORDS_WARNING)
|
||||||
"Warning: No community records added when building community context."
|
|
||||||
)
|
|
||||||
return ([], {})
|
return ([], {})
|
||||||
|
|
||||||
return all_context_text, {
|
return all_context_text, {
|
||||||
|
@ -16,6 +16,9 @@ import pandas as pd
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from graphrag.index.storage.blob_pipeline_storage import BlobPipelineStorage
|
from graphrag.index.storage.blob_pipeline_storage import BlobPipelineStorage
|
||||||
|
from graphrag.query.context_builder.community_context import (
|
||||||
|
NO_COMMUNITY_RECORDS_WARNING,
|
||||||
|
)
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -25,6 +28,8 @@ gh_pages = os.environ.get("GH_PAGES") is not None
|
|||||||
# cspell:disable-next-line well-known-key
|
# cspell:disable-next-line well-known-key
|
||||||
WELL_KNOWN_AZURITE_CONNECTION_STRING = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1"
|
WELL_KNOWN_AZURITE_CONNECTION_STRING = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1"
|
||||||
|
|
||||||
|
KNOWN_WARNINGS = [NO_COMMUNITY_RECORDS_WARNING]
|
||||||
|
|
||||||
|
|
||||||
def _load_fixtures():
|
def _load_fixtures():
|
||||||
"""Load all fixtures from the tests/data folder."""
|
"""Load all fixtures from the tests/data folder."""
|
||||||
@ -294,6 +299,8 @@ class TestIndexer:
|
|||||||
result.stderr if "No existing dataset at" not in result.stderr else ""
|
result.stderr if "No existing dataset at" not in result.stderr else ""
|
||||||
)
|
)
|
||||||
|
|
||||||
assert stderror == "", f"Query failed with error: {stderror}"
|
assert (
|
||||||
|
stderror == "" or stderror.replace("\n", "") in KNOWN_WARNINGS
|
||||||
|
), f"Query failed with error: {stderror}"
|
||||||
assert result.stdout is not None, "Query returned no output"
|
assert result.stdout is not None, "Query returned no output"
|
||||||
assert len(result.stdout) > 0, "Query returned empty output"
|
assert len(result.stdout) > 0, "Query returned empty output"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user