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}
}
我們歡迎對我們的開源項目的任何貢獻,包括新功能,改進基礎架構以及更全面的文檔。請參閱貢獻指南