zylon-ai/private-gpt · error · ValueError

context_filter is required

Error message

context_filter is required

What it means

ValueError from SummaryToolBuilder._validate_context: the summarize workflow's context retrieval path requires a context_filter and it was None. This mirrors the semantic search builder's validation; the summary tool falls back to it when summarizing ingested documents rather than inline texts.

Source

Thrown at private_gpt/components/tools/builders/summary_builder.py:79

        content_service: ContentService | None = None,
    ) -> None:
        self.settings = settings
        self.llm_component = llm_component
        self.vector_store_component = vector_store_component
        self.node_store_component = node_store_component
        self.embedding_component = embedding_component
        self.ingest_component = ingest_component
        self.parse_component = parse_component
        self.content_service = content_service
        self.prompt_builder_service = prompt_builder_service

    def _create_text_retriever(self, texts: list[str]) -> InMemoryRetriever:
        """Create an in-memory retriever for text summarization."""
        return InMemoryRetriever.from_texts(texts=texts)

    def _validate_context(self, context_filter: ContextFilter | None) -> ContextFilter:
        if not context_filter:
            raise ValueError("context_filter is required")

        if not context_filter.collection:
            raise ValueError("collection is required in context")

        assert self.vector_store_component, "Vector store component is required"
        assert self.node_store_component, "Node store component is required"
        assert self.embedding_component, "Embedding component is required"
        assert self.ingest_component, "Ingest component is required"
        assert self.parse_component, "Parse component is required"
        assert self.content_service, "Content service is required"

        # If artifacts are provided, verify the related required indexes are ready
        # or throw an error
        if context_filter.artifacts:
            for artifact in context_filter.artifacts:
                vector_artifact_index = VectorArtifactIndex(
                    collection=context_filter.collection,
                    artifact=artifact,

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Pass a ContextFilter with a non-empty collection when you want document/collection summarization.
  2. If summarizing raw strings only, pass texts and skip the context path entirely (see also error 269 which guards the both-empty case).
  3. Make the caller's payload builder always populate one of texts or context_filter.
Defensive patterns

Strategy: validation

Validate before calling

if context_filter is None:
    if not texts:
        raise ValueError("provide texts or a context_filter for summarization")
    workflow = builder.build(texts=texts)
else:
    workflow = builder.build(context_filter=context_filter)

Prevention

When it happens

Trigger: Building/running the summarize workflow with context_filter=None while expecting document-based summarization; _validate_context is called from _create_context_retriever setup.

Common situations: Calling the summary tool with only texts is fine — this error only fires when the code path that needs context retrieval gets None; typically an integration passes context_filter conditionally and it ends up None.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/809c1ba8c76c3ba4. Report an issue: GitHub.