GithubHelp home page GithubHelp logo

aicodehunt / openai-text-completion-workflow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yohasebe/openai-chat-api-workflow

0.0 0.0 0.0 11.98 MB

An Alfred workflow to use OpenAI text-completion API and chat API from anywhere

Home Page: https://github.com/yohasebe/openai-text-completion-workflow

License: MIT License

openai-text-completion-workflow's Introduction

OpenAI Text-Completion Workflow for Alfred

An Alfred workflow to help use OpenAI GPT-3.5 and GPT-4 via text-completion API and chat API.

Downloads

Current version: 1.7.2

Download Workflow

Change Log

  • 1.7.0: Improved UI
  • 1.6.9: GPT-4 models (e.g., gpt-4) supported
  • 1.6.7: Fixed an error that occurred for some users
  • 1.6.6: Debug mode added that outputs error messages when problems occur
  • 1.6.5: Automatic detection of Pandoc installation
  • 1.6.4: Supress "Please Wait" message feature
  • 1.6.3: OpenAI Textbox feature updated
  • 1.6.0: GPT-3.5-turbo model is set to the default
  • 1.6.0: ChatGPT API support
  • 1.6.0: HTML output option (using Pandoc) is enabled by default
  • 1.6.0: check-for-update command removed (in preparation for Alfred Gallery inclusion)

Complete Change Log

Dependencies

To start using this workflow, you must set the environment variable apikey, which you can get by creating a new OpenAI account. See also the Configuration section below.

You will also need to install the pandoc command. This will allow this workflow to convert the Markdown response from OpenAI to HTML and display the result in your default web browser with syntax highlighting enabled (especially useful when using this workflow to generate program code).

Installing Pandoc will be just a few clicks once this workflow has been included in the Alfred Gallery. For now, install Pandoc using homebrew. Once homebrew is installed, run the following command.

  brew install pandoc

How to Execute This Workflow

๐Ÿ“‹ Using Selected Text

You can select any text on your Mac and send it to the workflow:

  • Method 1: select text โ†’ universal action hotkey โ†’ select OpenAI Query
  • Method 2: set up a custom hotkey to Send selected text to OpenAI

โŒจ๏ธ Using Alfred Textbox

You can enter a query text directly into Alfred textbox:

  • Method 1: Alfred textbox โ†’ keyword (openai) โ†’ tab โ†’ input query text
  • Method 2: Alfred textbox โ†’ input query text โ†’ select fallback search (OpenAI Query)

๐ŸŒ Using Textbox in Default Web-browser

You can open a web interface (see the figure below).

  • Method 1: Alfred textbox โ†’ keyword (openai-textbox)

  • Method 2: set up a custom hotkey to Open web interface

    SCR-20221207-st2

General Query

The input text is used as a prompt to the OpenAI text-completion API. The original input text can be prepended or postfixed with instructional text to compose a complex query to be given to the API.

Direct Query

The input text is directly sent as a prompt to the OpenAI text-completion API.

Prepend Text + Query

After the initial text is entered, the user is prompted for additional text. The additional text is added before the initial text, and the resulting text is used as the query.

Append Text + Query

After the initial text is entered, the user is prompted for additional text. The additional text is added after the initial text and the resulting text is used as the query.

Program Code Generation/Completion

Write Program Code

GPT will generate program code and example output according to the text entered. Specify the purpose of the program, its function, the language and technology to be used, etc.

Example Input

Create a command line program that takes an English sentence and returns syntactically parsed output. Provide program code in Python and example usage.

Example Output

More Specific Commands

These are features mainly based on OpenAI's example usage of its text-completion API. The user-specified values to the following user settings are ignored when running these commands:

  • temperature
  • frequency_penalty
  • presence_penalty

Language-related

Ask in Your Language

You can ask questions in the language set to the variable first_language.

Note: If the value of first_language is not English (e.g. Japanese), the query may result in a more or less inaccurate response.

Translate L1 to L2

Translate text in the language specified in the variable first_language to the language specified in the second_language.

Translate L2 to L1

Translate text in the language specified in the variable second_language to the language specified in the variable first_language.

Grammar Correction

Correct sentences into standard English. See OpenAI's description.

Idea-related

Brainstorm

Brainstorm some ideas about a given text.

Create Study Notes

Provide a topic and get study notes. See OpenAI's description for this example.

Analogy Maker

Create analogies. See OpenAI's description for this example.

Essay Outline

Generate an outline for a research topic. See OpenAI's description for this example.

Summarization-related

TL;DR Summarization

Summarize text by adding a 'tl;dr:' to the end of a text passage. See OpenAI's description for this example.

Summarize for a 2nd Grader

Translates complex text into more straightforward concepts. See OpenAI's description for this example.

Keywords

Extract keywords from a block of text. See OpenAI's description for this example.

Check API Usage

You can check how many tokens you have used in the current billing period on OpenAI Usage Page--type in the keyword openai-usage. See also OpenAI's Billing page.

Configuration

Required Settings

Text Completion Parameters

Optional Settings

  • Your First Language: Set your first language (default: English). This language is used when using GPT for translation.
  • Your Second Language: Set your second language (default: Japanese). This language is used when using GPT for translation.
  • Max Characters: Maximum number of characters that can be included in a query (default: 10000).
  • Timeout: Number of seconds before the timeout (default: 180).
  • "Please Wait" Message: If disabled, the "Please Wait" message is suppressed. (default: checked)
  • Sound: If checked, a notification sound will play when the response is returned.
  • Echo: If enabled, the original prompt is contained in the result text.
  • Save File Path: If set, the results will be saved in the specified path as a markdown file.
  • Text to Speech: If enabled, the results will be read aloud using the system's default text-to-speech language and voice
  • Output HTML Using Pandoc: Show results in the default web browser if pandoc is installed. If unchecked (or Pandoc is not installed), Alfred's "Large Type" feature is used to display the result.

Text to Speech

If the Text to Speech option is enabled, the result text will be read aloud in the system's standard language and voice. To change the language and speech, go to [Accessibility] - [Vision] -[Spoken Content] in the Mac Settings panel.

spoken-content-panel

Author

Yoichiro Hasebe ([email protected])

License

The MIT License

Disclaimer

The author of this software takes no responsibility for any damage that may result from using it.

openai-text-completion-workflow's People

Contributors

jtbg avatar yohasebe 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.