Skip to content

Proposal: a conformance harness for real inference behavior #454

Open

Description

@RitwijParmar

Problem

A typed SDK can be correct against the API schema and still be unreliable for real inference work. Provider behavior changes at the edges: streaming may end differently, tool calls may be partial, logprobs have nested shapes, context limits may truncate or reject a request, and usage fields can be missing when a request fails halfway through.

Those differences are hard to see from unit tests that validate one response at a time. They show up later as broken agent loops, incorrect accounting, or a client that silently interprets a response differently after an API rollout.

Proposal

Add an opt-in provider conformance harness to the new SDK. It would run a small canonical request corpus and save a versioned behavior report for each model or endpoint.

The report should cover:

  • normal and streamed chat responses
  • tool-call start, delta, completion, and interruption behavior
  • logprob nesting and token alignment
  • context-length truncation versus error behavior
  • finish reasons and usage accounting
  • retryable failures and partial responses
  • request and response schema versions

The output should be a diffable artifact, not a dashboard. A change in a model or API rollout should be visible as a contract change with the exact request, response shape, and expected compatibility impact. Raw prompts and completions should be redacted or represented by hashes unless the user explicitly opts in.

Suggested first slice

  1. Define a small provider-behavior report schema.
  2. Add deterministic mock streams for the edge cases above.
  3. Add a conformance runner that works without an API key against those fixtures.
  4. Add an optional live mode that records sanitized observations from a real endpoint.
  5. Make report diffs usable in CI so SDK changes and API rollouts can be checked before release.

This should stay separate from the request and response models. It is a diagnostic and compatibility layer around them.

Why this matters

Together is operating across many models and inference modes. A schema tells users what a response is supposed to look like. A behavior report tells them what actually changed. That distinction matters for production agents, long-context requests, streaming consumers, and eval pipelines.

I have been working on typed chat-completion and logprob contracts in the older client, and I have built serving and evaluation systems where partial failures and latency behavior needed to be inspected after the run. I would be interested in taking the SDK-side report format and fixture runner through a focused implementation if this is useful for the new client.

Is this the kind of compatibility problem the Together team would want represented in the new SDK?

Activity

  1. EngineeringWithJay commented on Oct 15, 2026

    @EngineeringWithJay

    I put together a small seed packet for the first slice of #454's versioned,
    diffable report, to reduce fixture preparation: packet and instructions.

    Using the public streaming client in Python SDK 2.41.0:

    Synthetic case Observation
    Completed tool-call control Three chunks, tool_calls finish reason and fixture-supplied usage
    Clean EOF at a complete event boundary One chunk; partial arguments preserved; no finish reason
    Completed control with explicit-null usage Three chunks; usage present as None, distinguishable from omission

    All three iterations exhaust without exception. The EOF case is a literal prefix
    of the control. Fixture [DONE] presence is recorded separately because the SDK
    consumes it internally. Missing/null behavior is already documented, not a new
    bug; usage numbers are fixture data, not measured tokens.

    Bundled: fixtures, deterministic JSON report, dependency pins, source and payload
    hashes, and eight unit tests covering reproducibility, closure, environment
    isolation and network denial. This is offline-only evidence, with no claim about
    live-provider behavior, async streams or socket resets.

    It's Apache-2.0 and free to use. Happy to adapt the data to your report format.

    Jay Glidden

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions