InferenceIndex

Private beta · Early access

Cookbook

Contract review

Pull the same clause fields out of every new contract, as JSON your product already stores.

Private beta. InferenceIndex is changing fast. Models, endpoints, pricing and these docs may change without notice, so check back before you build on a detail.

A legal agent reads a new contract and fills in the same fields every time: governing law, term, renewal, notice period, and liability cap. The contract changes each time, but the fields don't, so it's a good fit for a Compiled Agent Model.

A new contract in, the same clause fields back

The job

  • New each run: the contract text, the counterparty, and the values in each clause.
  • Same each run: the fields you extract, the definitions you apply, and the JSON shape your product stores.

The call

python
import json
from openai import OpenAI

client = OpenAI(api_key="YOUR_KEY", base_url="https://inferenceindex-skills-25534459979.us-east4.run.app/v1")
SKILL_ID = "skl_YOUR_SKILL_ID"  # this job, saved once as a skill

FIELDS = """Return JSON with exactly these keys:
governing_law (string), term_months (integer), auto_renewal (boolean),
termination_notice_days (integer), liability_cap (string, or null if none).
Use null when the contract is silent."""

def review(contract_text: str) -> dict:
    response = client.chat.completions.create(
        model="inferenceindex-0.1/" + SKILL_ID,
        messages=[
            {"role": "system", "content": "You review commercial contracts. " + FIELDS},
            {"role": "user", "content": contract_text},
        ],
    )
    return json.loads(response.choices[0].message.content)

What comes back

An example reply for a master services agreement:

json
{
  "governing_law": "Delaware",
  "term_months": 24,
  "auto_renewal": true,
  "termination_notice_days": 60,
  "liability_cap": "12 months of fees"
}

In production

  • Keep the system prompt and field list fixed. That fixed definition is what makes it the same job each time.
  • Validate the JSON before you store it, the same way you do today.
  • A contract type your agent has never handled goes to your fallback model, so you get today's answer at today's price.