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.1.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.1.tar.gz.
File metadata
- Download URL: markprompt-0.1.1.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 |
fb09bf1bedc744769422bc32511d03b9f2b0bd84cb4e0c04d6ab31f72cbf3b87
|
|
| MD5 |
b3558b4d201278043c2101bd18b1c799
|
|
| BLAKE2b-256 |
a20dacc37ec4f725f511f3d8d20b46db3b941e55281f108e6cc84a6b5c3cc180
|
File details
Details for the file markprompt-0.1.1-py3-none-any.whl.
File metadata
- Download URL: markprompt-0.1.1-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 |
f4360755fdaf0da0fae85cfe8c106cb8a48a09e89e2a4052387b25defc5104e0
|
|
| MD5 |
e16c59b3e66d2bfc0b9438112c4bf2a3
|
|
| BLAKE2b-256 |
33016a3d89120cc996b55e87c052f645c40c991d3345c05ab8892d94c213449e
|