Skip to main content

mito-ai-core

The shared Python AI layer for Mito -- LLM providers, models, prompts, and utils. No Jupyter Server or Tornado dependency.

mito-ai (the JupyterLab extension) depends on this package for all its AI logic. If you're building something else on top of Mito's AI stack, this is the package you want.

Install

pip install mito-ai-core

Development

Working on mito-ai-core only

cd mito-ai-core
pip install -e ".[test]"

Working on both mito-ai-core and mito-ai at the same time

Install both packages in editable mode so changes in either package are picked up immediately without reinstalling:

# From the repo root
pip install -e ./mito-ai-core
pip install -e "./mito-ai[test]"

Order matters! Install mito-ai-core first since mito-ai depends on it. After this, any change you make to a .py file in either package takes effect on the next import (no rebuild needed).

How it relates to mito-ai

mito-ai-core contains all the pure-Python AI logic -- providers, models, prompts, message history, utils.

mito-ai is the JupyterLab extension that adds WebSocket/REST handlers, UI integration, and Streamlit conversion on top of it.

If you're changing provider logic, prompt templates, or models, you're working here. If you're changing how the extension talks to the frontend or handles HTTP requests, you're working in mito-ai.

Usage

Everything goes through ProviderManager:

from mito_ai_core.provider_manager import ProviderManager
from mito_ai_core.completions.models import MessageType

pm = ProviderManager()
pm.set_selected_model("gpt-4.1")

# One-shot
response = await pm.request_completions(
    message_type=MessageType.CHAT,
    messages=[{"role": "user", "content": "Hello!"}],
)

# Streaming -- pass a callback
response = await pm.stream_completions(
    message_type=MessageType.CHAT,
    messages=[{"role": "user", "content": "Hello!"}],
    message_id="msg-1",
    thread_id="thread-1",
    reply_fn=lambda chunk: print(chunk),
)

ProviderManager picks the right client (OpenAI, Anthropic, Gemini, Copilot, LiteLLM, Abacus) based on the selected model. It handles retries, telemetry, and token logging.

This is a library, not a server. The caller owns the transport (WebSocket, HTTP, CLI, whatever).

Key modules

  • provider_manager -- routes requests to the right LLM client
  • clients/ -- OpenAI, Anthropic, Gemini, Copilot wrappers
  • completions/models -- all the dataclasses and Pydantic models
  • completions/message_history -- thread-safe chat persistence
  • completions/prompt_builders/ -- prompt construction for chat, agent, debug, inline completion, charts
  • utils/ -- model resolution, token estimation, telemetry, rate limits

Metadata

Release files for mito-ai-core 0.1.3

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

Source distribution (sdist)

Source distribution for mito-ai-core 0.1.3
File Size Uploaded
mito_ai_core-0.1.3.tar.gz 152.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mito-ai-core 0.1.3
File Interpreter ABI Platform
mito_ai_core-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 371.7 kB

Release files / mito_ai_core-0.1.3.tar.gz

Download URL mito_ai_core-0.1.3.tar.gz
Size 152.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a148723d09b30eb898af588493107cc09bc6f801271af7ff20d050dc9832079b
BLAKE2b-256 checksum
How to use checksums
43ab237481b42cc3293e225bb09f15a549862db18a4f9808717ba3ff4f0e2f43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / mito_ai_core-0.1.3-py3-none-any.whl

Download URL mito_ai_core-0.1.3-py3-none-any.whl
Size 219.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e780d3e91b1ed2077b0b0e906eca72f0e024989aa4f72e046fc86a150dc3115d
BLAKE2b-256 checksum
How to use checksums
c27693ce4b0b72deadce0e2d3ee73a3768d6a81e8d98e9f3b08d2336d46078d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

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