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.6.tar.gz
(40.9 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.6.tar.gz.
File metadata
- Download URL: markprompt-0.1.6.tar.gz
- Upload date:
- Size: 40.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91f4c326087df501f468adee1c0c79db4088353db16ccf0555c738121cc43fea
|
|
| MD5 |
0fe187721cfbe8f6cb8914e60d566bdb
|
|
| BLAKE2b-256 |
b8c1dd0e36de0af873f056d0e455ea4e7ac3aedb16187cf7983a5f9160a7611d
|
File details
Details for the file markprompt-0.1.6-py3-none-any.whl.
File metadata
- Download URL: markprompt-0.1.6-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a15df129d3e8b663fe5bc515f75dcacc2f5b3a6311314e8e10a07409c82be84
|
|
| MD5 |
f2bbfd7c314eb2f803da4f8c3b4c8a94
|
|
| BLAKE2b-256 |
e3f9655ac9d32489673802c63f9cc16500ae148eeb868f9e34cbb4265f27617b
|