Skip to main content

No project description provided

Project description

MarkPrompt

MarkPrompt 是一个用于 LLM 的提示词模板引擎。

特性

  • YAML 元数据支持
  • 基于角色的内容块
  • 模板变量渲染
  • 安全检查机制
  • 工具调用功能(Function Calling)

安装

pip install -e .

使用

from markprompt.client import MarkPromptClient

client = MarkPromptClient("templates")
response = client.generate("example")

工具调用功能

MarkPrompt支持工具调用功能,允许你将Python函数作为工具传递给LLM,并自动执行被调用的函数。

示例

# 定义工具函数
def get_weather(city: str, date: str = "today"):
    """获取指定城市的天气信息"""
    # 实际功能实现
    return f"{city}{date}天气..."

# 使用工具
response = client.generate(
    "assistant", 
    prompt="北京今天天气怎么样?",
    tools=[get_weather]  # 传递工具函数列表
)

更详细的示例请查看 examples/tools_example.py

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

markprompt-0.1.5.tar.gz (40.8 kB view details)

Uploaded Source

Built Distribution

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

markprompt-0.1.5-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file markprompt-0.1.5.tar.gz.

File metadata

  • Download URL: markprompt-0.1.5.tar.gz
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.5

File hashes

Hashes for markprompt-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c8b7795ed3a24cd59755336b50bf525a7a5e96b1ebf8ebcfc32bc2c164ca0dd4
MD5 8adec4bebbb898800c8a6667ca407510
BLAKE2b-256 0f35d7ecd16239df7a7ee9163296b7315862763d710d52d481d6e1ee1f10b565

See more details on using hashes here.

File details

Details for the file markprompt-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: markprompt-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.5

File hashes

Hashes for markprompt-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 15a98c104b7c66d56f608b39af662cf01c2a42d4a158acd0bf03856d2b3d3a16
MD5 2a01fc7934c9b611f52d2879bb686f64
BLAKE2b-256 b0540e3d2213dff85865afa593b6219e6b33b58eebf32a5d80e3fec4a3091c0f

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