Git Product home page Git Product logo

promptify's Introduction

Promptify

Prompt Engineering, Solve NLP Problems with LLM's & Easily generate different NLP Task prompts for popular generative models like GPT, PaLM, and more with Promptify

Installation

With pip

This repository is tested on Python 3.7+, openai 0.25+.

You should install Promptify using Pip command

pip3 install promptify

Quick tour

To immediately use a LLM model for your NLP task, we provide the Prompter API.

from promptify import OpenAI
from promptify import Prompter

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)
nlp_prompter = Prompter(model)


result       = nlp_prompter.fit('ner.jinja',
                          domain      = 'medical',
                          text_input  = sentence)
                          
                          
### 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'}]
 

GPT-3 Example with NER, MultiLabel, Question Generation Task

Features ๐ŸŽฎ

  • Perform NLP tasks (such as NER and classification) in just 2 lines of code, with no training data required
  • Easily add one shot, two shot, or few shot examples to the prompt
  • Handling out-of-bounds prediction from LLMS (GPT, t5, etc.)
  • 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.
  • Custom examples and samples can be easily added to the prompt
  • Optimized prompts to reduce OpenAI token costs (coming soon)

Supporting wide-range of Prompt-Based NLP tasks :

Task Name Colab Notebook Status
Named Entity Recognition NER Examples with GPT-3 โœ…
Multi-Label Text Classification Classification Examples with GPT-3 โœ…
Multi-Class Text Classification Classification Examples with GPT-3 โœ…
Binary Text Classification Classification Examples with GPT-3 โœ…
Question-Answering QA Task Examples with GPT-3 โœ…
Question-Answer Generation QA Task Examples with GPT-3 โœ…
Summarization Summarization Task Examples with GPT-3 โœ…
Explanation Explanation Task Examples with GPT-3 โœ…
Tabular Data
Image Data
More Prompts

๐Ÿ’ Contributing

We welcome any contributions to our open source project, including new features, improvements to infrastructure, and more comprehensive documentation. Please see the contributing guidelines

promptify's People

Contributors

kamalkraj avatar monk1337 avatar samsu007 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.