Skip to main content

Modaic, a python framework for packaging and reproducing DSPy programs

Project description

Docs PyPI

Modaic 🐙

Modular + Mosaic, a Python framework for composing and maintaining DSPy applications.

Key Features

  • Hub Support: Load and share precompiled DSPY programs from Modaic Hub
  • Program Framework: Precompiled and auto-loading DSPY programs
  • Automated LM Judge Alignment: Continuously align your LM judges to your preferences while staying at the pareto frontier!

Never lose your progress again. Save everything you need to compare and reproduce optimization runs with GEPA, MIPROv2, etc. - architecture, hyperparameters, precompiled prompts, predictions, git commits, and even datasets - in 5 minutes. Modaic is free for personal use and academic projects, and it's easy to get started.

Installation

Using uv (recommended)

uv add modaic

Optional (for hub operations):

export MODAIC_TOKEN="<your-token>"

Using pip

Please note that you will not be able to push DSPY programs to the Modaic Hub with pip.

pip install modaic

Quick Start

Creating a Simple Program

from modaic import PrecompiledProgram, PrecompiledConfig

class WeatherConfig(PrecompiledConfig):
    weather: str = "sunny"

class WeatherProgram(PrecompiledProgram):
    config: WeatherConfig

    def __init__(self, config: WeatherConfig, **kwargs):
        super().__init__(config, **kwargs)

    def forward(self, query: str) -> str:
        return f"The weather in {query} is {self.config.weather}."

weather_program = WeatherProgram(WeatherConfig())
print(weather_program(query="Tokyo"))
weather_program.push_to_hub("me/my-weather-program")

Save and load locally:

weather_program.save_precompiled("./my-weather")

from modaic import AutoProgram, AutoConfig

cfg = AutoConfig.from_precompiled("./my-weather", local=True)
loaded = AutoProgram.from_precompiled("./my-weather", local=True)
print(loaded(query="Kyoto"))

from hub:

from modaic import AutoProgram, AutoConfig

loaded = AutoProgram.from_precompiled("me/my-weather-program", rev="v2.0.0")
print(loaded(query="Kyoto"))

Architecture

Program Types

  1. PrecompiledProgram: Statically defined programs with explicit configuration
  2. AutoProgram: Dynamically loaded programs from Modaic Hub or local repositories

Support

For issues and questions:

  • GitHub Issues: https://github.com/modaic-ai/modaic/issues
  • Docs: https://docs.modaic.dev

Development

install development dependencies:

uv sync --all-extras

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

modaic-0.18.0.tar.gz (54.3 kB view details)

Uploaded Source

Built Distribution

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

modaic-0.18.0-py3-none-any.whl (58.6 kB view details)

Uploaded Python 3

File details

Details for the file modaic-0.18.0.tar.gz.

File metadata

  • Download URL: modaic-0.18.0.tar.gz
  • Upload date:
  • Size: 54.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for modaic-0.18.0.tar.gz
Algorithm Hash digest
SHA256 269a7991a102c35359b69739ce75ef9283a223b05afc67b841da805968fe586e
MD5 3b4ad13a6b69b4ff050b53079a9ff98b
BLAKE2b-256 ab8f49bf3c094818f7314f536fbf51d0f6cb8caff8da2426b93139d39d79e2d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for modaic-0.18.0.tar.gz:

Publisher: python-publish.yml on modaic-ai/modaic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modaic-0.18.0-py3-none-any.whl.

File metadata

  • Download URL: modaic-0.18.0-py3-none-any.whl
  • Upload date:
  • Size: 58.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for modaic-0.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b081388591452ba3c98b634d8daa05baa0a3625d8a1dffc6cdf2cd843ef3b33
MD5 11cdcafd910e6c9ed1e138f13e00b49d
BLAKE2b-256 9874e9d0c11b17f97661bc32ead56e8845474d382bccd2afee41a7a9f806c1db

See more details on using hashes here.

Provenance

The following attestation bundles were made for modaic-0.18.0-py3-none-any.whl:

Publisher: python-publish.yml on modaic-ai/modaic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page