Skip to main content

proprioceptive-confidence

See how sure a language model was about every word.

Models sound equally sure whether they're right or guessing. Their own token probabilities tell the difference. proprioceptive-confidence turns those probabilities into a plain report: which words were shaky, how shaky, and whether a short answer still holds when the model is asked again in full.

$ pip install proprioceptive-confidence
$ proprioconf "In what year was Albert Einstein born? Answer with just the year." --double-check

1904

shaky: 1 word(s) below 80%: "190" at 66%
double-check: 'Albert Einstein was born in 1879.' (answers disagree)

(Output from a small local model; your numbers will vary by model.)

  • No dependencies. Standard library only.
  • Works with what you already run: Ollama 0.12+ (native API), and any OpenAI-compatible server that returns logprobs (OpenAI, vLLM, llama.cpp, LM Studio, Ollama's /v1).
  • Plugs into frameworks: a LangChain callback and a LiteLLM logger.
  • Nothing leaves your machine when you point it at a local model.

Python

from proprioceptive_confidence import ConfidenceClient

client = ConfidenceClient(model="llama3.2", threshold=0.8)           # Ollama at 127.0.0.1:11434
ans = client.ask("What is the capital of Australia?", double_check=True)

print(ans.text)                      # the answer
print(ans.report.summary())          # 'confident: ...' or 'shaky: ... "Sydney" at 41%'
print(ans.report.is_confident)       # False if any word was below the threshold
print(ans.report.to_dict())          # min / mean probability, shaky tokens, alternatives

Already have a response? Analyse it directly:

from proprioceptive_confidence import analyze

report = analyze(openai_response)    # OpenAI-style dict or object requested with logprobs=True
report = analyze(ollama_response)    # Ollama /api/chat response requested with "logprobs": true

OpenAI-compatible servers:

client = ConfidenceClient(api="openai", base_url="http://127.0.0.1:8000/v1", model="my-model")

LangChain

from langchain_openai import ChatOpenAI
from proprioceptive_confidence.integrations.langchain import ConfidenceCallbackHandler

conf = ConfidenceCallbackHandler(threshold=0.8)
llm = ChatOpenAI(model="gpt-4o-mini", logprobs=True, callbacks=[conf])
llm.invoke("In what year was Albert Einstein born?")
print(conf.last_report.summary())

pip install "proprioceptive-confidence[langchain]". Pass raise_on_low=True to stop a chain when an answer is shaky.

LiteLLM

import litellm
from proprioceptive_confidence.integrations.litellm import ConfidenceLogger

conf = ConfidenceLogger(threshold=0.8, on_report=lambda r: print(r.summary()))
litellm.callbacks = [conf]
litellm.completion(model="ollama_chat/llama3.2", messages=[{"role": "user", "content": "..."}], logprobs=True)

pip install "proprioceptive-confidence[litellm]". LiteLLM runs loggers after the call returns, so use on_report (or read conf.reports) rather than relying on an exception.

Testing without a model

proprioceptive_confidence.testing.FakeModelServer speaks Ollama's and OpenAI's chat APIs with scripted token probabilities, so you can test confidence handling in CI without a GPU.

What it can't do

A model can be wrong and certain. Token probabilities catch shaky answers, not confident mistakes.

  • pytest-llm-confidence: fail a test when the model wasn't sure of its answer.
  • proprioceptive-mcp: let Claude Code, Cursor and other agents ask your local model and see how sure it was.
  • Proprioceptive Lens: the full local app, with live confidence colouring, double-check, private memory and internal-state behaviour readings: pip install proprioceptive-lens.

MIT licensed. From Proprioceptive AI.

Metadata

Release files for proprioceptive-confidence 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for proprioceptive-confidence 0.1.0
File Size Uploaded Provenance Actions
proprioceptive_confidence-0.1.0.tar.gz 17.0 kB With provenance Details for proprioceptive_confidence-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for proprioceptive-confidence 0.1.0
File Interpreter ABI Platform Actions
proprioceptive_confidence-0.1.0-py3-none-any.whl Python 3 none any Details for proprioceptive_confidence-0.1.0-py3-none-any.whl

Total release size: 34.5 kB

Release files / proprioceptive_confidence-0.1.0.tar.gz

Download URL proprioceptive_confidence-0.1.0.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3d07c1280205317b5d9e28ca992a00171729c317a1187ae03358d674061b5dfc
BLAKE2b-256 checksum
How to use checksums
a628d4c9f4f6672488ac82a8210b8f17a01a3e5b0f0380b4d01817bf465e3bb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / proprioceptive_confidence-0.1.0-py3-none-any.whl

Download URL proprioceptive_confidence-0.1.0-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b51d5019c94132d3188032b76434a001aacd3ffd86f0319e423270a61177b4f
BLAKE2b-256 checksum
How to use checksums
7376ec1ace22f24f401e3b2b418831d952264a25a473b6b274c9097cb0446c17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for proprioceptive-confidence 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for proprioceptive_confidence-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page