项目详情
深入了解 Promptify 的功能与特性
Promptify
Promptify 是一个用于 NLP 任务的 Prompt 工程化工具。它可以轻松地为 GPT、PaLM 等流行的生成模型生成不同的 NLP 任务的 Prompt。Promptify 提供了一个简单易用的 API,让用户可以通过简单的代码调用生成模型,解决各种 NLP 问题。
项目特性包括:
- 提供了
PipelineAPI,用户可以通过两行代码使用生成模型进行 NLP 任务,无需训练数据。 - 支持添加一次性、两次性或少量示例到 Prompt 中。
- 处理生成模型的越界预测,确保输出结果的正确性。
- 输出结果以 Python 对象的形式返回,便于解析和过滤。
- 支持添加自定义示例和样本到 Prompt 中。
- 支持在 Huggingface Hub 上运行任何存储的模型。
用户可以使用 Pip 命令安装 Promptify:
pip3 install promptify
使用 Promptify 的示例代码如下:
from promptify import Prompter, OpenAI, Pipeline
sentence = "The patient is a 93-year-old female with a medical history of chronic right hip pain, osteoporosis, hypertension, depression, and chronic atrial fibrillation admitted for evaluation and management of severe nausea and vomiting and urinary tract infection"
model = OpenAI(api_key)
prompter = Prompter('ner.jinja')
pipe = Pipeline(prompter, model)
result = pipe.fit(sentence, domain="medical", labels=None)
(result)