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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mito_ai_core-0.1.3.tar.gz (152.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mito_ai_core-0.1.3-py3-none-any.whl (219.6 kB view details)

Uploaded Python 3

File details

Details for the file mito_ai_core-0.1.3.tar.gz.

File metadata

  • Download URL: mito_ai_core-0.1.3.tar.gz
  • Upload date:
  • Size: 152.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mito_ai_core-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a148723d09b30eb898af588493107cc09bc6f801271af7ff20d050dc9832079b
MD5 cfcb898a11d56d1d498eb115f4c62c49
BLAKE2b-256 43ab237481b42cc3293e225bb09f15a549862db18a4f9808717ba3ff4f0e2f43

See more details on using hashes here.

File details

Details for the file mito_ai_core-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: mito_ai_core-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 219.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mito_ai_core-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e780d3e91b1ed2077b0b0e906eca72f0e024989aa4f72e046fc86a150dc3115d
MD5 e80ca39ad5f968763d5d97546f6ac959
BLAKE2b-256 c27693ce4b0b72deadce0e2d3ee73a3768d6a81e8d98e9f3b08d2336d46078d3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 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