Python prompt-core package for AgentMark - high-level runtime for working with AgentMark prompts
Project description
AgentMark Prompt Core (Python)
Python implementation of the AgentMark prompt-core package. This package provides the high-level runtime for working with AgentMark prompts.
Installation
pip install agentmark-prompt-core
Usage
This package transforms pre-parsed MDX AST trees. The AST is typically obtained by:
- Parsing MDX with the TypeScript
@agentmark-ai/templatedxpackage - Loading a pre-parsed AST from a JSON file
- Receiving an AST from the AgentMark runtime
import asyncio
import json
from agentmark.prompt_core import create_agentmark, DefaultAdapter
async def main():
# Create an AgentMark instance with the default adapter
agentmark = create_agentmark(adapter=DefaultAdapter())
# Load a pre-parsed MDX AST (from TypeScript parser or JSON file)
with open("math.prompt.mdx.json") as f:
ast = json.load(f)
# Load and format a text prompt
prompt = await agentmark.load_text_prompt(ast)
result = await prompt.format(props={"userMessage": "What is 2+2?"})
print(result)
asyncio.run(main())
Features
- Prompt Types: Text, Object, Image, and Speech prompts
- Message Extraction: System, User, and Assistant message roles
- Attachments: Image and file attachments in User messages
- Schema Validation: Pydantic-based validation matching TypeScript Zod schemas
- Adapters: Extensible adapter interface for different LLM providers
- Eval Registry: Registry for evaluation functions
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linting
ruff check src tests
# Run type checking
mypy src/agentmark --strict
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentmark_prompt_core-0.1.2.tar.gz.
File metadata
- Download URL: agentmark_prompt_core-0.1.2.tar.gz
- Upload date:
- Size: 36.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4b3612ff07d2d71fda6d64b074d8920aba6a68d47a7844965dec60187e3bc07
|
|
| MD5 |
f4ead50ebe451e57f00bcf4533ff8684
|
|
| BLAKE2b-256 |
8a6dceb592bad55c84f72752347c99f1dee90085f5c97e4284fb734128ebaefa
|
File details
Details for the file agentmark_prompt_core-0.1.2-py3-none-any.whl.
File metadata
- Download URL: agentmark_prompt_core-0.1.2-py3-none-any.whl
- Upload date:
- Size: 28.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cc404611dfe87842f067f3649d8abbb862e30e5a8f2a9b3e074bd831d33bcdc
|
|
| MD5 |
6a306a9bd8dc9b46f9093ef6263c1fd6
|
|
| BLAKE2b-256 |
4532abc8793523d42e4c6b00378f4262fd9dfc481483e38f27a5459b1523a180
|