{"id":13490117,"url":"https://github.com/promptslab/Promptify","last_synced_at":"2025-03-28T05:31:56.215Z","repository":{"id":65489276,"uuid":"577429312","full_name":"promptslab/Promptify","owner":"promptslab","description":"Prompt Engineering | Prompt Versioning | Use GPT or other prompt based models to get structured output. Join our discord for Prompt-Engineering, LLMs and other latest research","archived":false,"fork":false,"pushed_at":"2025-02-12T19:26:51.000Z","size":2881,"stargazers_count":3449,"open_issues_count":60,"forks_count":268,"subscribers_count":49,"default_branch":"main","last_synced_at":"2025-03-27T16:00:35.437Z","etag":null,"topics":["chatgpt","chatgpt-api","chatgpt-python","gpt-3","gpt-3-prompts","gpt-4","gpt-4-api","gpt3-library","large-language-models","machine-learning","nlp","openai","prompt-engineering","prompt-toolkit","prompt-tuning","prompt-versioning","prompting","prompts","promptversioning","transformers"],"latest_commit_sha":null,"homepage":"https://discord.gg/m88xfYMbK6","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/promptslab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-12T18:06:32.000Z","updated_at":"2025-03-27T12:48:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"1292a150-31f4-49ca-822b-d04e638ed85b","html_url":"https://github.com/promptslab/Promptify","commit_stats":{"total_commits":561,"total_committers":14,"mean_commits":40.07142857142857,"dds":0.124777183600713,"last_synced_commit":"27a53fa8e8f2a4d90f887d06ece65a44466f873a"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/promptslab%2FPromptify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/promptslab%2FPromptify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/promptslab%2FPromptify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/promptslab%2FPromptify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/promptslab","download_url":"https://codeload.github.com/promptslab/Promptify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245978200,"owners_count":20703675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","chatgpt-api","chatgpt-python","gpt-3","gpt-3-prompts","gpt-4","gpt-4-api","gpt3-library","large-language-models","machine-learning","nlp","openai","prompt-engineering","prompt-toolkit","prompt-tuning","prompt-versioning","prompting","prompts","promptversioning","transformers"],"created_at":"2024-07-31T19:00:41.072Z","updated_at":"2025-03-28T05:31:56.194Z","avatar_url":"https://github.com/promptslab.png","language":"Jupyter Notebook","readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg width=\"110px\" src=\"https://raw.githubusercontent.com/promptslab/Promptify/main/assets/logo.png\"\u003e\n\u003ch1\u003ePromptify\u003c/h1\u003e\u003c/div\u003e\n\u003c!-- \n\u003ch2 align=\"center\"\u003ePromptify\u003c/h2\u003e --\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cp align=\"center\"\u003ePrompt Engineering, Solve NLP Problems with LLM's \u0026 Easily generate different NLP Task prompts for popular generative models like GPT, PaLM, and more with Promptify\n\u003c/p\u003e\n\u003c/p\u003e\n\n \u003ch4 align=\"center\"\u003e\n  \u003ca href=\"https://github.com/promptslab/Promptify/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-Apache_2.0-blue.svg\" alt=\"Promptify is released under the Apache 2.0 license.\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/promptify/\"\u003e\n    \u003cimg src=\"https://badge.fury.io/py/Promptify.svg\" alt=\"PyPI version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"http://makeapullrequest.com\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\" alt=\"http://makeapullrequest.com\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.gg/m88xfYMbK6\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Discord-Community-orange\" alt=\"Community\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"#\"\u003e\n    \u003cimg src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"colab\" /\u003e\n  \u003c/a\u003e\n\u003c/h4\u003e\n\n\u003cimg width=\"910px\" src=\"https://raw.githubusercontent.com/promptslab/Promptify/main/assets/dark.png\"\u003e\n\n## Installation\n\n### With pip\n\nThis repository is tested on Python 3.7+, openai 0.25+.\n\nYou should install Promptify using Pip command\n\n```bash\npip3 install promptify\n```\n\nor\n\n```bash\npip3 install git+https://github.com/promptslab/Promptify.git\n```\n\n## Quick tour\n\nTo immediately use a LLM model for your NLP task, we provide the `Pipeline` API.\n\n```python\nfrom promptify import Prompter,OpenAI, Pipeline\n\nsentence     =  \"\"\"The patient is a 93-year-old female with a medical  \t\t\t\t \n                history of chronic right hip pain, osteoporosis,\t\t\t\t\t\n                hypertension, depression, and chronic atrial\t\t\t\t\t\t\n                fibrillation admitted for evaluation and management\t\t\t\t\n                of severe nausea and vomiting and urinary tract\t\t\t\t\n                infection\"\"\"\n\nmodel        = OpenAI(api_key) # or `HubModel()` for Huggingface-based inference or 'Azure' etc\nprompter     = Prompter('ner.jinja') # select a template or provide custom template\npipe         = Pipeline(prompter , model)\n\n\nresult = pipe.fit(sentence, domain=\"medical\", labels=None)\n\n\n### Output\n\n[\n    {\"E\": \"93-year-old\", \"T\": \"Age\"},\n    {\"E\": \"chronic right hip pain\", \"T\": \"Medical Condition\"},\n    {\"E\": \"osteoporosis\", \"T\": \"Medical Condition\"},\n    {\"E\": \"hypertension\", \"T\": \"Medical Condition\"},\n    {\"E\": \"depression\", \"T\": \"Medical Condition\"},\n    {\"E\": \"chronic atrial fibrillation\", \"T\": \"Medical Condition\"},\n    {\"E\": \"severe nausea and vomiting\", \"T\": \"Symptom\"},\n    {\"E\": \"urinary tract infection\", \"T\": \"Medical Condition\"},\n    {\"Branch\": \"Internal Medicine\", \"Group\": \"Geriatrics\"},\n]\n \n```\n\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/promptslab/Promptify/main/assets/ner.png\" width=\"250\" /\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/promptslab/Promptify/main/assets/multilabel.png\" width=\"250\" /\u003e \n  \u003cimg src=\"https://raw.githubusercontent.com/promptslab/Promptify/main/assets/qa_gen.png\" width=\"250\" /\u003e\n\u003c/p\u003e\n\u003ch4 align=\"center\"\u003eGPT-3 Example with NER, MultiLabel, Question Generation Task\u003c/h3\u003e\n\n\n\u003ch2\u003eFeatures 🎮 \u003c/h2\u003e\n\u003cul\u003e\n  \u003cli\u003e Perform NLP tasks (such as NER and classification) in just 2 lines of code, with no training data required\u003c/li\u003e\n  \u003cli\u003e Easily add one shot, two shot, or few shot examples to the prompt\u003c/li\u003e\n  \u003cli\u003e Handling out-of-bounds prediction from LLMS (GPT, t5, etc.)\u003c/li\u003e\n  \u003cli\u003e Output always provided as a Python object (e.g. list, dictionary) for easy parsing and filtering. This is a major advantage over LLMs generated output, whose unstructured and raw output makes it difficult to use in business or other applications.\u003c/li\u003e\n  \u003cli\u003e Custom examples and samples can be easily added to the prompt\u003c/li\u003e\n  \u003cli\u003e 🤗 Run inference on any model stored on the Huggingface Hub (see \u003ca href=\"https://github.com/promptslab/Promptify/blob/main/notebooks/huggingface.ipynb\"\u003enotebook guide\u003c/a\u003e).\u003c/li\u003e\n  \u003cli\u003e Optimized prompts to reduce OpenAI token costs (coming soon)\u003c/li\u003e\n\u003c/ul\u003e\n\n\n### Supporting wide-range of Prompt-Based NLP tasks :\n\n| Task Name | Colab Notebook | Status |\n|-------------|-------|-------|\n| Named Entity Recognition | [NER Examples with GPT-3](https://colab.research.google.com/drive/16DUUV72oQPxaZdGMH9xH1WbHYu6Jqk9Q?usp=sharing) | ✅  |\n| Multi-Label Text Classification | [Classification Examples with GPT-3](https://colab.research.google.com/drive/1gNqDxNyMMUO67DxigzRAOa7C_Tcr2g6M?usp=sharing) | ✅    |\n| Multi-Class Text Classification | [Classification Examples with GPT-3](https://colab.research.google.com/drive/1gNqDxNyMMUO67DxigzRAOa7C_Tcr2g6M?usp=sharing) | ✅    |\n| Binary Text Classification  | [Classification Examples with GPT-3](https://colab.research.google.com/drive/1gNqDxNyMMUO67DxigzRAOa7C_Tcr2g6M?usp=sharing) | ✅    |\n| Question-Answering | [QA Task Examples with GPT-3](https://colab.research.google.com/drive/1Yhl7iFb7JF0x89r1L3aDuufydVWX_VrL?usp=sharing) | ✅    |\n| Question-Answer Generation | [QA Task Examples with GPT-3](https://colab.research.google.com/drive/1Yhl7iFb7JF0x89r1L3aDuufydVWX_VrL?usp=sharing) | ✅    |\n| Relation-Extraction | [Relation-Extraction Examples with GPT-3](https://colab.research.google.com/drive/1iW4QNjllc8ktaQBWh3_04340V-tap1co?usp=sharing) | ✅    |\n| Summarization  | [Summarization Task Examples with GPT-3](https://colab.research.google.com/drive/1PlXIAMDtrK-RyVdDhiSZy6ztcDWsNPNw?usp=sharing) | ✅    |\n| Explanation    | [Explanation Task Examples with GPT-3](https://colab.research.google.com/drive/1PlXIAMDtrK-RyVdDhiSZy6ztcDWsNPNw?usp=sharing) | ✅    |\n| SQL Writer    | [SQL Writer Example with GPT-3](https://colab.research.google.com/drive/1JNUYCTdqkdeIAxiX-NzR-4dngdmWj0rV?usp=sharing) | ✅    |\n| Tabular Data | |    |\n| Image Data | |     |\n| More Prompts | |     |\n\n\n## Docs\n\n[Promptify Docs](https://promptify.readthedocs.io/)\n\n## Community \n\u003cdiv align=\"center\"\u003e\nIf you are interested in Prompt-Engineering, LLMs, ChatGPT and other latest research discussions, please consider joining \u003ca href=\"https://discord.gg/m88xfYMbK6\"\u003ePromptsLab\u003c/a\u003e\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n\u003cimg alt=\"Join us on Discord\" src=\"https://img.shields.io/discord/1069129502472556587?color=5865F2\u0026logo=discord\u0026logoColor=white\"\u003e\n\u003c/div\u003e\n\n\n\n```\n\n@misc{Promptify2022,\n  title = {Promptify: Structured Output from LLMs},\n  author = {Pal, Ankit},\n  year = {2022},\n  howpublished = {\\url{https://github.com/promptslab/Promptify}},\n  note = {Prompt-Engineering components for NLP tasks in Python}\n}\n\n```\n\n## 💁 Contributing\n\nWe welcome any contributions to our open source project, including new features, improvements to infrastructure, and more comprehensive documentation. \nPlease see the [contributing guidelines](contribute.md)\n","funding_links":[],"categories":["Tools (GitHub)","Jupyter Notebook","Other Useful Resources","Prompting libraries \u0026 tools","A01_文本生成_文本对话","Tools \u0026 Code","LLM Applications","HarmonyOS","SDK, Libraries, Frameworks","工具和代码","Prompt Improvement","Building","其他LLM框架","Structured output","Prompting libraries \u0026 tools (in alphabetical order)","Other LLM Frameworks"],"sub_categories":["LLMOps vs MLOps","\u003ch3 id=\"mllm\"\u003e🧠 Multimodal Reasoning in Large Language Models\u003ch3/\u003e","大语言对话模型及数据","Windows Manager","Python library, sdk or frameworks","Prompt Engineering","文章","Videos Playlists"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpromptslab%2FPromptify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpromptslab%2FPromptify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpromptslab%2FPromptify/lists"}