Metadata-Version: 2.5
Name: determine
Version: 0.4.0
Summary: Simple context-aware AI inference for Python.
Author: Jack
License-Expression: MIT
License-File: LICENSE
Keywords: ai,decision,generation,inference,llm,procedural,reasoning
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# Determine

Determine makes AI inference feel like a normal part of Python.

The main API has only two operations:

    determine.answer(...)
    determine.choose(...)

## Install

    pip install determine

## Ollama

Run an installed Ollama model directly:

    import determine

    determine.configure("ollama:qwen3")

    name = "Jack"

    print(
        determine.answer(
            "Say hello to the user."
        )
    )

If you leave the model out:

    determine.configure("ollama")

Determine will try to use the first installed Ollama model.

## llama.cpp

Use a local GGUF directly:

    import determine

    determine.configure(
        "llama.cpp:/home/me/models/model.gguf"
    )

    print(
        determine.answer(
            "What should I do?"
        )
    )

Determine automatically looks for either:

    llama-cli

or:

    llama cli

## OpenAI-compatible APIs

Determine still supports OpenAI-compatible endpoints:

    import determine

    determine.configure(
        "http://localhost:8080"
    )

## answer()

Use answer when the result can be anything:

    answer = determine.answer(
        "What should the player be told?"
    )

## choose()

Use choose when the result must come from available options:

    action = determine.choose(
        "What should the enemy do?",
        [
            "attack",
            "run",
            "hide"
        ]
    )

## Automatic context

Determine can automatically see relevant variables and source code.

For example:

    health = 12
    ammo = 0
    enemy_distance = 3

    action = determine.choose(
        "What should the player do?",
        [
            "fight",
            "run",
            "hide"
        ]
    )

Those variables do not have to be manually placed into the prompt.

## Advanced llama.cpp configuration

Extra llama.cpp arguments can be supplied:

    determine.configure(
        "llama.cpp:/home/me/model.gguf",
        temperature=0.2,
        reasoning_effort="high",
        args=[
            "-ngl", "all",
            "-c", "32768"
        ]
    )

A custom executable can also be used:

    determine.configure(
        "llama.cpp:/home/me/model.gguf",
        binary="/home/me/llama.cpp/build/bin/llama-cli"
    )

## Functions as choices

Functions can be choices too:

    def backup():
        """Back up the phone."""
        print("Backing up")

    def update(version="latest"):
        """Update the phone."""
        print("Updating to", version)

    request = input("> ")

    determine.choose(
        request,
        [
            backup,
            update
        ]
    )

## Security

Determine can make fuzzy decisions, but important security boundaries and
destructive actions should still have deterministic validation and
confirmation around them.

## License

MIT

## Multi-turn conversations

Determine can remember previous turns by giving it a normal Python list.

~~~python
import determine

determine.configure("ollama:qwen3")

history = []

print(
    determine.answer(
        "My favourite colour is green.",
        history=history
    )
)

print(
    determine.answer(
        "What is my favourite colour?",
        history=history
    )
)
~~~

The same history can be shared with `choose()`:

~~~python
history = []

determine.answer(
    "I prefer quiet places.",
    history=history
)

place = determine.choose(
    "Where should I go?",
    [
        "busy shopping centre",
        "quiet park",
        "concert"
    ],
    history=history
)

print(place)
~~~

Without `history=`, Determine remains single-turn.

You can start a fresh conversation simply by creating a new list:

~~~python
history = []
~~~
