Modular + Mosaic, a Python framework for composing and maintaining DSPy applications.
- 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.
uv add modaicOptional (for hub operations):
export MODAIC_TOKEN="<your-token>"Please note that you will not be able to push DSPY programs to the Modaic Hub with pip.
pip install modaicfrom 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"))- PrecompiledProgram: Statically defined programs with explicit configuration
- AutoProgram: Dynamically loaded programs from Modaic Hub or local repositories
For issues and questions:
- GitHub Issues:
https://github.com/modaic-ai/modaic/issues - Docs:
https://docs.modaic.dev
install development dependencies:
uv sync --all-extras