Skip to main content

synth_ai.sdk.graphs.completions

Alpha Graph completions client for graph inference (policies, verifiers, RLM). This module provides the client for running inference on trained graphs, including policy graphs, verifier graphs, and Reasoning Language Models (RLM).

Classes

GraphTarget

GraphInfo

Metadata for a registered graph.

ListGraphsResponse

Response from list_graphs.

GraphCompletionsClient

Client for /api/graphs/completions with flexible graph targeting. Methods:

list_graphs

list_graphs(self) -> ListGraphsResponse
List graphs registered to your organization. Returns graphs that have been created via GraphGen optimization jobs or manually registered. Only returns graphs belonging to your organization (determined by API key). Args:
  • kind: Optional filter by graph kind (“policy”, “verifier”, “judge”)
  • limit: Maximum number of graphs to return (default: 50)
Returns:
  • ListGraphsResponse with graphs list and total count

run

run(self) -> dict[str, Any]

run_output

run_output(self) -> Any

complete

complete(self, graph_id: str, input_data: Mapping[str, Any]) -> dict[str, Any]
Execute any graph with arbitrary input. Args:
  • graph_id: Built-in graph name, GraphGen job_id, or snapshot UUID
  • input_data: Graph-specific input data
  • model: Optional model override
Returns:
  • Graph output dictionary

verify_with_rubric

verify_with_rubric(self) -> dict[str, Any]
Verify trace using rubric criteria. Args:
  • session_trace: V3 trace format
  • rubric: Rubric with event/outcome criteria
  • system_prompt: Optional custom system prompt
  • user_prompt: Optional custom user prompt
  • verifier_type: “single”, “mapreduce”, or “rlm” (auto-detects if None)
  • options: Optional execution options (event, outcome, etc.)
  • model: Optional model override
Returns:
  • Verification result with event_reviews, outcome_review, etc.

verify_fewshot

verify_fewshot(self) -> dict[str, Any]
Verify trace using few-shot calibration examples. Args:
  • session_trace: V3 trace format (validated using SessionTraceInput)
  • calibration_examples: List of calibration examples with:
  • session_trace: V3 trace format
  • event_rewards: List[float] (0.0-1.0), one per event
  • outcome_reward: float (0.0-1.0)
  • expected_score: Optional expected score for the trace being evaluated
  • expected_rubric: Optional rubric/ground truth for the trace being evaluated
  • system_prompt: Optional custom system prompt
  • user_prompt: Optional custom user prompt
  • verifier_type: “single”, “mapreduce”, or “rlm” (auto-detects if None)
  • options: Optional execution options
  • model: Optional model override
Returns:
  • Verification result with event_reviews, outcome_review, etc.
Raises:
  • ValueError: If calibration_examples are invalid (validated client-side)

verify_contrastive

verify_contrastive(self) -> dict[str, Any]
Verify verifier judgment by comparing to gold-standard examples. NOTE: Contrastive mode evaluates a VERIFIER’s judgment, not a trace directly. It asks: “Is this verifier’s judgment consistent with how gold examples were scored?” Args:
  • session_trace: V3 trace format (the trace being evaluated)
  • gold_examples: List of gold examples with:
  • summary: str (required, non-empty)
  • gold_score: float (0.0-1.0, required)
  • gold_reasoning: str (required, non-empty)
  • candidate_score: Verifier’s predicted score for this trace (0.0-1.0, what we’re evaluating)
  • candidate_reasoning: Verifier’s reasoning for this score (what we’re evaluating)
  • expected_rubric: Optional rubric/ground truth for this trace
  • system_prompt: Optional custom system prompt
  • user_prompt: Optional custom user prompt
  • verifier_type: “single”, “mapreduce”, or “rlm” (auto-detects if None)
  • options: Optional execution options
  • model: Optional model override
Returns:
  • Verification result with event_reviews, outcome_review, etc.
Raises:
  • ValueError: If gold_examples or candidate_score/reasoning are invalid (validated client-side)

verify_with_prompts

verify_with_prompts(self) -> dict[str, Any]
Verify trace using custom prompts (no rubric/examples). Args:
  • session_trace: V3 trace format
  • system_prompt: Custom system prompt (required)
  • user_prompt: Custom user prompt (required)
  • verifier_type: “single”, “mapreduce”, or “rlm” (auto-detects if None)
  • options: Optional execution options
  • model: Optional model override
Returns:
  • Verification result

rlm_inference

rlm_inference(self) -> dict[str, Any]
Zero-shot RLM inference for large-context tasks. Args:
  • query: The query/question to answer
  • context: Large context (can be string or dict, 1M+ tokens)
  • system_prompt: Optional custom system prompt
  • user_prompt: Optional custom user prompt
  • model: Model to use (must be RLM-capable, default: gpt-4o-mini)
  • provider: Provider name (default: openai)
  • options: Optional execution options (max_iterations, max_cost_usd, etc.)
Returns:
  • RLM inference result with output, usage, metadata

VerifierClient

Verifier graph client that builds standard verifier inputs. Methods:

evaluate

evaluate(self) -> dict[str, Any]