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
Quick start
import determine
determine.configure("http://127.0.0.1:8080")
name = "Jack"
favourite_food = "Chinese"
answer = determine.answer(
"Suggest something I might like for dinner."
)
print(answer)
Determine automatically sees relevant variables and surrounding source code.
answer()
Use answer() when the AI can produce any answer.
player_health = 24
ammo = 0
response = determine.answer(
"Explain what situation the player is in."
)
print(response)
You can set a generation limit:
response = determine.answer(
"Explain this carefully.",
max_tokens=2048
)
choose()
Use choose() when the AI must select from available options.
health = 12
ammo = 0
enemy_distance = 3
action = determine.choose(
"What should the player do?",
[
"fight",
"run",
"hide"
]
)
print(action)
Options can also be other Python values:
difficulty = determine.choose(
"Choose the best difficulty.",
[1, 2, 3, 4, 5]
)
max_tokens
Thinking models may need extra generation space before producing their final answer.
action = determine.choose(
"What should the player do?",
["fight", "run", "hide"],
max_tokens=1024
)
If max_tokens is not supplied, Determine lets the backend use its normal
default.
Multi-turn conversations
Multi-turn only needs a normal Python list:
import determine
determine.configure("http://127.0.0.1:8080")
history = []
print(
determine.answer(
"My spaceship is called Juniper.",
history=history
)
)
print(
determine.answer(
"What is my spaceship called?",
history=history
)
)
The same history works with choose():
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)
Start a fresh conversation with:
history = []
Functions as choices
Functions can also be options.
import determine
determine.configure("http://127.0.0.1:8080")
def backup():
"""Back up the connected device."""
print("Backing up...")
def update(version="latest"):
"""Update the connected device software."""
print("Updating to", version)
def device_info():
"""Show information about the connected device."""
print("Getting device information...")
request = input("> ")
determine.choose(
request,
[
backup,
update,
device_info
]
)
If none of the functions can perform the request, Determine returns None.
OpenAI-compatible APIs
import determine
determine.configure(
"http://127.0.0.1:8080"
)
You can specify the model manually:
determine.configure(
"http://127.0.0.1:8080",
model="my-model"
)
Ollama
import determine
determine.configure(
"ollama:qwen3"
)
print(
determine.answer(
"Say hello."
)
)
Or let Determine use an installed model:
determine.configure("ollama")
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?"
)
)
Extra llama.cpp arguments can be supplied:
determine.configure(
"llama.cpp:/home/me/models/model.gguf",
args=[
"-ngl", "all",
"-c", "32768"
]
)
A custom llama.cpp binary can also be supplied:
determine.configure(
"llama.cpp:/home/me/models/model.gguf",
binary="/home/me/llama.cpp/build/bin/llama-cli"
)
API keys
export DETERMINE_API_KEY="your-key"
Determine also checks OPENAI_API_KEY.
Advanced configuration
determine.configure(
endpoint="http://localhost:8080",
model="my-model",
temperature=0.2,
timeout=120,
reasoning_effort="high"
)
Individual calls can override settings:
answer = determine.answer(
"Think carefully.",
temperature=0.1,
max_tokens=2048,
reasoning_effort="high"
)
Why Determine?
Simple decisions are easy to hard-code:
if health <= 0:
game_over()
But decisions involving many interacting variables can become difficult to maintain.
action = determine.choose(
"What should the enemy do?",
[
"attack",
"defend",
"run",
"heal"
]
)
Determine is useful for things such as:
- game AI
- procedural generation
- natural-language tools
- hardware-aware configuration
- recommendation systems
- adaptive software
- fuzzy classification
- decisions involving many variables and thresholds
Security
AI output is nondeterministic.
Do not use Determine as the only protection for authentication, permissions, financial actions, destructive actions, security boundaries, or other safety-critical systems.
When functions are passed to choose(), only provide functions that you
actually want the AI to be allowed to execute.
License
MIT
Metadata
Release files for determine 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| determine-0.4.3.tar.gz | 13.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| determine-0.4.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.3 kB
Release files / determine-0.4.3.tar.gz
| Download URL | determine-0.4.3.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b643cae91fe849fc510fb94255988bb231068d685f5547746515e5f40f4ba7e
|
|
BLAKE2b-256 checksum How to use checksums |
15a5dd348a3efc16ccacbb83aa8d79cc43a2c9e1e326af60151989f69024889a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / determine-0.4.3-py3-none-any.whl
| Download URL | determine-0.4.3-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed8f79a746bd1eb343fab79acef639764fb7ce89b32368e3f0c76b8d1def6f5e
|
|
BLAKE2b-256 checksum How to use checksums |
8fcfd95397fea8741ad5d249434d8510a9b1f4d2350aaf0b241a1147d38c4ab1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|