Skip to main content

Collinear public Python library

Project description

Collinear Python SDK

Persona‑driven chat simulation for OpenAI‑compatible endpoints.

Requires Python 3.10+.

Install (uv)

uv venv && source .venv/bin/activate  # Windows: .venv\Scripts\activate
uv add collinear
uv sync

Quickstart

import os
from collinear.client import Client

client = Client(
    assistant_model_url="https://api.openai.com/v1",
    assistant_model_api_key=os.environ["OPENAI_API_KEY"],
    assistant_model_name="gpt-4o-mini",
    steer_api_key=os.environ.get("STEER_API_KEY", "demo-001"),
)

steer_config = {
    "ages": [29],
    "genders": ["woman"],
    "occupations": ["teacher"],
    "intents": ["Resolve billing issue"],
    "traits": {"impatience": [0, 1, 2]},
    "locations": ["United States"],
    "languages": ["English"],
    "tasks": ["telecom support"],
}

results = client.simulate(
    steer_config,
    k=1,
    num_exchanges=2,
    steer_temperature=0.7,
    steer_max_tokens=256,
    # max_concurrency defaults to 1 (uses /steer per request). Increase above 1 to
    # opt into /steer_batch with automatic grouping up to 8 concurrent samples.
    max_concurrency=1,
)

assessment = client.assess(results)
for row in assessment.evaluation_result:
    for score in row.values():
        print("score=", score.score, "rationale=", score.rationale)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collinear-1.0.17.tar.gz (39.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

collinear-1.0.17-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file collinear-1.0.17.tar.gz.

File metadata

  • Download URL: collinear-1.0.17.tar.gz
  • Upload date:
  • Size: 39.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for collinear-1.0.17.tar.gz
Algorithm Hash digest
SHA256 de050bd4cd917974843a3710103d43149e028868e409582f543c65995445976b
MD5 bfc6e56f04fd7cf2e5b8e065cffc19ac
BLAKE2b-256 ae79995b1e3b340e826fb318f344a2f5460960a4ce61d7cdc0579fc7da2da3e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for collinear-1.0.17.tar.gz:

Publisher: release.yml on collinear-ai/collinear-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file collinear-1.0.17-py3-none-any.whl.

File metadata

  • Download URL: collinear-1.0.17-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for collinear-1.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 7a62c7609af434862a4e1909cd321bb2223597c7e07d4dad18e98ba01b162733
MD5 8ee306ba24ee83bd6c96f8a19ea6a548
BLAKE2b-256 9e721a7833667aa01dc66a9d9e34dfa87f124a895e9223fc459278484d09beb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for collinear-1.0.17-py3-none-any.whl:

Publisher: release.yml on collinear-ai/collinear-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page