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
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
markprompt-0.1.2.tar.gz
(37.3 kB
view details)
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 markprompt-0.1.2.tar.gz.
File metadata
- Download URL: markprompt-0.1.2.tar.gz
- Upload date:
- Size: 37.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26a91847c6411674bef974b2f707730915e6041448fa5115a13d2547807d8c3a
|
|
| MD5 |
335aef692430288047d191b25ba20713
|
|
| BLAKE2b-256 |
b8fd21867246765d14522e0686daa0eff33478779832a2ac8f932a84d356b69a
|
File details
Details for the file markprompt-0.1.2-py3-none-any.whl.
File metadata
- Download URL: markprompt-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1e35ff0c8cd5cb67024923179a4b4833e6792fc0cd645bf860121d92fec5958
|
|
| MD5 |
8deacc0e9e1d25a79f7eaf5978d7abc0
|
|
| BLAKE2b-256 |
cc654543dbfbb97f9eba2518fd6d0aa2ff865de46333c2be2b014ff812d57fe8
|