Promptify
1.0.0
及时工程,解决LLM的NLP问题,并轻松地生成不同的NLP任务提示,例如GPT,Palm等流行的生成模型
该存储库在Python 3.7+,OpenAI 0.25+上进行了测试。
您应该使用pip命令安装提示
pip3 install promptify或者
pip3 install git+https://github.com/promptslab/Promptify.git为了立即为您的NLP任务使用LLM模型,我们提供Pipeline API。
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 ) # or `HubModel()` for Huggingface-based inference or 'Azure' etc
prompter = Prompter ( 'ner.jinja' ) # select a template or provide custom template
pipe = Pipeline ( prompter , model )
result = pipe . fit ( sentence , domain = "medical" , labels = None )
### Output
[
{ "E" : "93-year-old" , "T" : "Age" },
{ "E" : "chronic right hip pain" , "T" : "Medical Condition" },
{ "E" : "osteoporosis" , "T" : "Medical Condition" },
{ "E" : "hypertension" , "T" : "Medical Condition" },
{ "E" : "depression" , "T" : "Medical Condition" },
{ "E" : "chronic atrial fibrillation" , "T" : "Medical Condition" },
{ "E" : "severe nausea and vomiting" , "T" : "Symptom" },
{ "E" : "urinary tract infection" , "T" : "Medical Condition" },
{ "Branch" : "Internal Medicine" , "Group" : "Geriatrics" },
]
| 任务名称 | COLAB笔记本 | 地位 |
|---|---|---|
| 命名实体识别 | 与GPT-3的示例 | ✅ |
| 多标签文本分类 | GPT-3的分类示例 | ✅ |
| 多级文本分类 | GPT-3的分类示例 | ✅ |
| 二进制文本分类 | GPT-3的分类示例 | ✅ |
| 提问 | QPA-3的质量检查示例 | ✅ |
| 提问的一代 | QPA-3的质量检查示例 | ✅ |
| 关系萃取 | 与GPT-3的关系摘要示例 | ✅ |
| 摘要 | GPT-3的摘要任务示例 | ✅ |
| 解释 | GPT-3的说明任务示例 | ✅ |
| SQL作家 | SQL作家示例与GPT-3 | ✅ |
| 表格数据 | ||
| 图像数据 | ||
| 更多提示 |
提示文档
@misc{Promptify2022,
title = {Promptify: Structured Output from LLMs},
author = {Pal, Ankit},
year = {2022},
howpublished = {url{https://github.com/promptslab/Promptify}},
note = {Prompt-Engineering components for NLP tasks in Python}
}
我们欢迎对我们的开源项目的任何贡献,包括新功能,改进基础架构以及更全面的文档。请参阅贡献指南