Skip to main content

AI Model Match is an open-source service that helps product teams release, test, and optimize prompt configurations for AI-powered applications.

Project description

AI Model Match

AI Model Match is an open-source service that helps product teams release, test, and optimize prompt configurations for AI-powered applications. It transforms the traditionally manual, trial-and-error process into an automated system that continuously identifies the best-performing configurations for each use case.

By organizing AI experimentation into use cases, flows, and steps, AI Model Match allows product teams to rapidly test different strategies, collect real feedback, and deliver AI experiences that continuously improve.


🚀 Overview

AI Model Match enables teams to:

  • Define use cases as product goals, such as providing recommendations, generating content, or planning a trip.
  • Create flows, representing multiple candidate strategies to achieve each goal.
  • Organize flows into steps, precise configurations that guide AI behavior at each stage of the interaction.
  • Intelligently distribute traffic across flows to maintain consistency while optimizing performance.
  • Collect and use feedback from both end users and product teams to automatically improve AI performance.

This system empowers product managers to iterate independently, accelerate release cycles, and minimize risk, while end users benefit from AI interactions that steadily improve.


📐 Core Concepts

  1. Use Case

    • Represents a specific product goal or objective.
    • Defines the scope of experimentation and the metrics for success.
  2. Flow

    • A candidate configuration or strategy to achieve a use case.
    • Multiple flows can be defined to explore different approaches.
  3. Step

    • Each flow is composed of steps, with each step defining a precise prompt configuration.
    • Steps allow fine-grained control of AI behavior at each stage of interaction.
  4. Session & Correlation ID

    • Each user session is tied to a unique correlation ID.
    • Once a flow is selected for a correlation ID, all subsequent steps in that session use the same flow, ensuring predictable and coherent experiences.
  5. Feedback

    • Ratings (1–5) and optional notes can be submitted for each session.
    • Feedback is aggregated per flow to guide automated flow selection and optimization.

⚙️ Rollout Strategy

AI Model Match automates the rollout of flows using a controlled, multi-phase approach:

  1. Warmup

    • New flows are gradually introduced until they reach a target traffic percentage.
  2. Adaptive

    • Traffic is automatically shifted toward higher-performing flows based on feedback.
    • Flows that receive positive feedback gain more traffic until one flow converges to 100%.
  3. Escape

    • Configurable rollback conditions trigger automatic reversion if a flow underperforms (e.g., ≥10 evaluations with an average score < 2/5).
    • Protects user experience while minimizing risks.

💡 Benefits

For Product Managers

  • Accelerates iteration cycles without heavy engineering dependency.
  • Provides a data-driven approach to evaluating AI strategies.
  • Enables safe experimentation with automated traffic distribution and rollback.

For End Users

  • Consistent, high-quality AI experiences.
  • Interactions improve over time based on real-world feedback.

Business Value

  • Reduces time and cost of AI experimentation.
  • Identifies the best-performing strategies quickly.
  • Lowers risk while scaling successful configurations.

🛠️ Technical Details

  • AI Model Match is implemented as an open-source microservice.
  • Provides APIs to external systems for runtime prompt configuration.
  • Supports fine-grained control over AI interactions through use cases, flows, and steps.
  • Correlation IDs ensure consistent execution across multi-step flows.
  • Feedback collection APIs enable automated performance evaluation and optimization.
  • Can be deployed standalone or integrated with existing production environments.
  • Future plans may include a SaaS version to abstract deployment and infrastructure management.

📈 How It Works

  1. Define a use case representing a product goal.
  2. Create one or more flows with structured steps for AI behavior.
  3. Release the flows and let AI Model Match manage traffic distribution and feedback collection.
  4. Monitor performance as the system automatically optimizes flow selection based on real-world data.

🎯 Target Audience

  • Product Managers looking to test AI strategies quickly and independently.
  • Development Teams integrating AI-driven workflows into their applications.
  • End Users who benefit from AI interactions that are consistent, coherent, and continuously improving.

How to use

Installation

pip install ai-model-match

In action

Below is an example of how to use this SDK in your project:

import uuid
from ai_model_match.aimm_client import AIMMClient

# Initialize the client (provide your API base URL and credentials if needed)
client = AIMMClient(base_url="https://your-aimm-server.com", api_key="YOUR_API_KEY")

# Generate a unique correlation ID for the session
correlation_id = uuid.uuid4()

# Pick a prompt configuration for a use case and step
use_case_code = "content_generation"
step_code = "extract_transcript"
picker_response = client.Pick(use_case_code, step_code, correlation_id)
print("Prompt modality:", picker_response.output_message.modality)
print("Prompt configuration:", picker_response.output_message.parameters)

# ... Use the prompt configuration in your AI workflow ...

# After the session, send feedback (score can be a combination of relevance, quality, speed, etc.)
score = 4.5  # Example: weighted average based on your own criteria
comment = "Prompt was relevant and fast, but could be more creative."
feedback_response = client.SendFeedback(correlation_id, score, comment)
print("Feedback submitted:", feedback_response.status)

Internal Documentation: Build & Deploy SDK to PyPI

Prerequisites

Before building and publishing the SDK, you need to install the required packaging tools.
build is used to create distribution archives, and twine is a utility for securely uploading those archives to PyPI.
Install both with:

python3 -m pip install --upgrade build twine

Build & Deploy

To release a new version of the SDK to PyPI, follow these steps:

  1. Update Version

    • Increment the version number in pyproject.toml as appropriate.
  2. Build Distribution

    python3 -m build
    
  3. Verify Build

    • Check the dist/ directory for .tar.gz and .whl files.
  4. Upload to PyPI

    twine upload dist/*
    
  5. Confirm Release

    • Visit PyPI to verify the new version is published.

Note: Ensure your PyPI credentials are configured (~/.pypirc). For test uploads, use twine upload --repository testpypi dist/*.

Project details


Download files

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

Source Distribution

ai_model_match-1.0.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

ai_model_match-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file ai_model_match-1.0.0.tar.gz.

File metadata

  • Download URL: ai_model_match-1.0.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ai_model_match-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ab01b9cf449ae939334f9ce1ee9fb43c86d868422f790a4c8c89f32cc118ebba
MD5 7d4ab646a78488a362c0e65b8413a7e6
BLAKE2b-256 58f42f7027692494bbd582b1a66314dbfd96a7c91e5ffe206df4a3a2657d5101

See more details on using hashes here.

File details

Details for the file ai_model_match-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ai_model_match-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ai_model_match-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03d76a0d7fd64717c01c3cba5690da03c5b4114fef091cefc8b620c8b70d16d4
MD5 7c69aeef417088d493c5b1274e565457
BLAKE2b-256 7dd886bc4cb31f962037c4c1d664c59cafcc02a598b0202600e29fb0ae846c28

See more details on using hashes here.

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