Skip to main content

MPS Engine Python SDK

Project description

MPS Engine

The official engine implementation of Context Meta Pattern Strategy (MPS) architecture.

Context is an extension of the MPS architecture built on top of Markitdown, its whole purpose is to allow you to freely input any kind of file and the mps-engine automatically fit it into the MPS architecture.

MPS

from mps import Mps, MPSHierarchy

mps = MPS()
# uses default hierarchy, you can import it and see it at <mps.MPSLocatorDefaults>

# or
mps = Mps.from_location("path/to/project/mps")

# or
mps = Mps.from_location(MPSHierarchy(
    base_dir = "mps",
    meta_dir = "meta",
    pattern_dir = "pattern",
    context_dir = "context",
    strategy_dir = "strategy"
))

Context

Example

from mps import context

# => Markdown file placed under mps/context/my_finances.md
c = context(name="my-finances")  # Context object

Supported Formats

  • xml
  • pdf
  • html
  • .mp4
  • .mp3

Pattern

Example

from mps import pattern, inject

ta = pattern(name="teacher-assistant")  # => Pattern object

# or if a variable exist in the pattern
p = inject(pattern("translate"), lang_code="en-US")

Strategy

Example

from mps import strategy

cot = strategy(name="CoT")  # => Strategy object

Integration

Semantic Kernel

  1. Supplying kernel functions with more context
@context(name="my-details")
@kernel_function(name="greeter", description="Greets people")
def greet(name: str) -> str:
    return f"Hello {name}"
  1. Personalizing agents
from semantic_kernel.agents import ChatCompletionAgent
from mps import pattern

p = pattern("student-tutor")
# or
p = pattern("www.mydrive.com/student-tutor.md")
# or
p = pattern("www.mydrive.com/student-tutor.md", nopersist=True)  #* (not recommended)
# by default the engine thinks the url that you used for a pattern is useful so it persists
# this is due to the [reusability philosophy](<../../README.md#reusability-philosophy>)
# and the [insurance phiolosophy](<../../README.md#insurance-philosophy>)
# in the MPS architecture

student_tutor_agent = ChatCompletionAgent(
    instructions=pattern("student-tutor"),
)
  1. Giving agents a personality
from semantic_kernel.agents import ChatCompletionAgent
from mps import strategy, strategizer, context, pattern

finance_agent = ChatCompletionAgent(
    instructions=strategizer(
        context=context("my-monthly-billings"),
        pattern=pattern("finance-consultant"),
        strategy=startegy("AoT"),
    )
)

Interfaces (Miniatures & MPS)

Miniatures

from mps import get_minatures_homeland, set_minatures_homeland, Miniatures

get_minatures_homeland()
set_minatures_homeland("path/to/project/miniatures/")

# or

Miniatures.homeland = "path/to/project/miniatures/"
print(Miniatures.homeland)

MPS

from mps import get_mps_basedir, set_mps_basedir, Mps

get_mps_basedir()
set_mps_basedir("path/to/project/mps/")


Mps.basedir = "/path/to/project/mps"
print(Mps.basedir)

Roadmap

The following features are planned for future releases:

  1. Complete core functionality - Finish any NotImplementedError or @future decorated functions
  2. Documentation sprint - Focus on comprehensive documentation (also including CHANGELOG.md and breaking changes)
  3. Test coverage - Aim for 80%+ test coverage on core functionality
  4. Community preparation - Code of conduct, contribution guidelines
  5. CI/CD setup - GitHub Actions for testing, linting, and deployment to PyPI

Nice to have

  1. AsyncIO Support: Full async API for all MPS operations
  2. Cache Support: Cache frequently requested miniatures via HTTP
  3. Compilation Support: Compile the mps/ directory into a python script to reduce io overhead, and a potentially use for direct imports.
  4. MPS Interface: A friendly UI to show/filter/add/modify miniatures in your local mps collection.
  5. MPS Shop: A remote website where you can pull miniatures made by community to your local mps collection.
  6. MCP Integration: Have your local mps collection converted as MCP prompts.

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

mps_engine-0.0.2.tar.gz (5.3 MB view details)

Uploaded Source

Built Distribution

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

mps_engine-0.0.2-py3-none-any.whl (233.6 kB view details)

Uploaded Python 3

File details

Details for the file mps_engine-0.0.2.tar.gz.

File metadata

  • Download URL: mps_engine-0.0.2.tar.gz
  • Upload date:
  • Size: 5.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.18

File hashes

Hashes for mps_engine-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7f117ad09fa4f6c26267fedf4647cc4145cf8c78f7d9d826c1c3a674229b3b79
MD5 27e5e40833ad131b100a185fdd0bc758
BLAKE2b-256 8820cea3633d5c4160f83d869ac65ff4559fdbf839f37f293b0e3fb5967822ca

See more details on using hashes here.

File details

Details for the file mps_engine-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: mps_engine-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 233.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.18

File hashes

Hashes for mps_engine-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a4ea8b4052fc7a1a46a2cfab38ebcbfeed58ca8692da4e3e263fc6d62b2a1f84
MD5 02d734384606775f8edd76b8302a0383
BLAKE2b-256 b95ec28c6b085ab82965f82d6f9bb498c34041bee0e86894b2c4a6b39799c83b

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