Metadata-Version: 2.5
Name: humansand
Version: 0.1.3
Summary: The official Python SDK for the Persimmon user model by humans&
Project-URL: Documentation, https://persimmon.humansand.ai/docs
Project-URL: Homepage, https://persimmon.humansand.ai
Author: humans&
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: httpx<1,>=0.27
Description-Content-Type: text/markdown

# humansand

The official Python SDK for Persimmon, a user model by humans&.
Create a conversation, request a turn, and control the history sent with each request.

Requires Python 3.12 or later. The package name is `humansand`; the Python
import is `humansand`.

## Install

```sh
pip install humansand
```

Get an API key from the playground's API page. Store it in your secret manager
and load it into the `USER_MODEL_API_KEY` environment variable.

## Quickstart

```python
from humansand import Persimmon

with Persimmon() as client:
    conversation = client.conversations.create(
        model="persimmon-v0.1",
        participants=[
            {"name": "Maya", "description": "Product lead. Calm and direct."},
            {"name": "Theo", "description": "Engineer. Careful and practical."},
        ],
        setting="A team discusses a product launch.",
    )
    turn = conversation.get_turn(speaker="Maya")
    print(turn.content)
    conversation.append_turn(turn)
```

New conversations have timestamps off by default.

`get_turn()` returns a turn without saving it to the local history. Call
`append_turn()` to accept it. Each request sends the current conversation history.

`get_turn(harness=False)` makes one content attempt without quality checks or
judge retries. Output format validation still applies; malformed output fails
without another content attempt. `harness` accepts only a boolean and defaults
to `True`, which uses the selected model's configured checks. It applies to one
turn and does not change the saved conversation.

`get_turn(exclude_speakers=["Theo"])` excludes Theo from speaker selection for
this call only. The participant roster and history stay intact. A later call
without exclusions can select Theo again.

Use `AsyncPersimmon` with `async with` and `await` in asynchronous applications.
Both clients close their HTTP connections when their context ends.

See the [Python SDK guide](https://persimmon.humansand.ai/docs#sdk/quickstart)
for asynchronous examples, error handling, pagination, and configuration.

## Changelog

### 0.1.3

First public-use release.

New conversations default to `timestamps=False` in the Python SDK. The REST API
also defaults to `timestamps: false`. To predict arrival times, pass
`timestamps=True` to `conversations.create()` or send `timestamps: true` when
creating a conversation through the API. Each conversation keeps its saved
timestamp mode.

### 0.1.2

Maintenance release with improved API error handling and updated SDK documentation.
