Skip to content

latent.context.review

Offline context review tool.

Provides :func:review_context, the CI / offline entry point that instantiates all static context scanners, runs them against the provided messages and tools, and collects findings into a :class:ContextReport.

Functions

review_context

review_context(messages: list[dict[str, Any]], tools: list[dict[str, Any]] | None = None, include_semantic: bool = False, model: str = 'gpt-4o-mini', model_limit: int = 200000) -> ContextReport

Run all static context validators and return a structured report.

This is the offline review / CI entry point. Instantiates all static scanners, runs them against the provided messages and tools, and collects findings into a :class:ContextReport.

Args: messages: OpenAI-format message list. tools: Tool definitions (JSON schema format). include_semantic: If True, also run LLM-backed semantic validators. Requires litellm and makes API calls. model: Model to use for semantic validators. model_limit: Token limit for budget calculations.

Returns: ContextReport with findings, budget breakdown, and severity flags.