🔌[Plugin & Source Code] Introducing the ChatGPT OpenAI API Plugin: Enabling Recursive Workflow, Diverse Output Generation, and Model Fine-Tuning Capabilities

The ChatGPT Plugin for OpenAI API is a powerful tool that seamlessly integrates ChatGPT with the OpenAI API, enabling users to leverage the capabilities of OpenAI’s language models in creative and interactive ways inside the ChatGPT interface.

This plugin acts as an intelligent API caller, allowing ChatGPT to generate text completions, engage in dynamic conversations, fine-tune language models, and explore various output settings, all through natural language interactions.

The plugin is designed to enhance ChatGPT’s functionality by providing access to the OpenAI API, making it a valuable asset for developers, content creators, and businesses seeking to harness the power of language models for a wide range of use-cases inside the ChatGPT interface.

Use-Cases

  • Text Generation: Generate creative and coherent text based on user-defined prompts using OpenAI’s GPT-4, GPT-3.5 Turbo, and other models.
  • Conversational AI: Build interactive chatbots and virtual assistants that can engage in natural language conversations with users.
  • Language Translation: Translate text from one language to another with high accuracy.
  • Code Generation: Generate code snippets, algorithms, and software solutions in various programming languages.
  • Model Fine-Tuning: Fine-tune language models to specialize in specific domains or industries, such as legal, medical, or finance.
  • Recursive Workflow: Generate multiple completions recursively to explore different narrative paths or conversation branches. Utilize recursive feedback loops for creative writing and storytelling.
  • Integration with External Data: Use ChatGPT plugins to integrate with external data sources, such as web content, Wolfram Alpha calculations, and more, to enhance the capabilities of the language model.
  • Creative Writing: Generate poems, short stories, dialogues, and other literary content with varying levels of creativity, formality, and detail.
  • Content Summarization: Summarize long articles, documents, or conversations into concise summaries.
  • Multilingual Applications: Generate content and interact with users in multiple languages.
  • Data Augmentation: Generate synthetic data for training machine learning models in various domains.
  • Chain of Thought: Use the language model to generate a sequence of related content, such as character profiles, dialogues, stories, summaries, and translations.
  • Customization: Experiment with different settings, such as temperature, top_p, and n, to influence the diversity and creativity of generated text.

Benefits

  • Versatility: The plugin supports multiple modes of interaction, including text generation and conversational AI, through the OpenAI API.
  • Intelligent API Caller: ChatGPT acts as an intelligent API caller, proactively calling the OpenAI API to perform actions based on user input.
  • Domain Specialization: Fine-tune language models to meet specific requirements and improve performance in specialized domains.
  • Ease of Use: The plugin provides a simple and intuitive interface for interacting with the OpenAI API through natural language commands.
  • Scalability: The plugin is designed to handle a wide range of tasks and use-cases, making it suitable for both small and large-scale projects.

Plugin Flow

  1. Activate the Plugin: Users must manually activate the ChatGPT Plugin for OpenAI API within the ChatGPT UI.
  2. Begin a Conversation: Users can start a conversation with ChatGPT and provide prompts or commands related to the OpenAI API functionality.
  3. API Invocation: ChatGPT intelligently invokes the OpenAI API based on user input, performing actions such as text generation, model fine-tuning, or recursive completions.
  4. API Results: ChatGPT incorporates the API results into its response to the user, providing coherent and relevant answers based on the API data.

How to Use

To use the ChatGPT Plugin for OpenAI API, follow these steps:

  1. Install and activate the ChatGPT Plugin for OpenAI API within the ChatGPT UI.
  2. Start a conversation with ChatGPT and provide natural language prompts or commands related to the OpenAI API functionality.
  3. ChatGPT will intelligently call the OpenAI API based on your input and provide responses that incorporate the API data.

Advanced Use Cases

Title Command and Description Parameters
Recursive Storytelling Using the OpenAI API, generate a short story with an open ending, then use the ending as a prompt to continue the story, and repeat the process to create a multi-chapter story Temperature for story, Number of chapters
Feedback-Driven Code Optimization Using the OpenAI API, generate a Python code snippet that performs matrix multiplication, then analyze the code for inefficiencies, and iteratively optimize the code based on the analysis Max tokens for code, Number of iterations
Recursive Product Design Using the OpenAI API, design a new product concept, then generate customer feedback for the concept, and iteratively improve the design based on the feedback until the desired satisfaction level is achieved Temperature for design, Desired satisfaction level
Chain of Thought Marketing Using the OpenAI API, generate a marketing slogan for a new brand, then use the slogan to create a marketing campaign, and based on the campaign, generate a series of promotional events Temperature for slogan, Top_p for campaign
Recursive Legal Analysis Using the OpenAI API, analyze a legal case for potential arguments, then generate counterarguments for each argument, and repeat the process to simulate a legal debate until a conclusion is reached Top_p for analysis, Max tokens for debate
Web Content Summarization Using the Web Surfer plugin, retrieve the content of a specific website, then use the OpenAI API to fine-tune a language model for text summarization, and generate a concise summary of the website content. Website URL, Max tokens for summary
Image Captioning Using the Wolfram Alpha plugin, generate an image based on a mathematical equation, then use the OpenAI API to fine-tune a language model for image captioning, and generate a caption for the generated image. Mathematical equation, Max tokens for caption
Data Analysis Using the Wolfram Alpha plugin, retrieve statistical data about a specific topic (e.g., population growth), then use the OpenAI API to fine-tune a language model for data analysis, and generate an analysis report based on the retrieved data. Topic for data retrieval, Max tokens for analysis report
Scientific Explanation Using the Wolfram Alpha plugin, perform a scientific calculation (e.g., calculate the speed of light in a medium), then use the OpenAI API to fine-tune a language model for scientific explanations, and generate an explanation for the calculation result. Scientific calculation, Max tokens for explanation
Recipe Generation with Nutrition Info Using a Nutrition API plugin, retrieve nutrition information for specific ingredients, then use the OpenAI API to fine-tune a language model to generate creative recipes, and create a recipe that meets specific dietary restrictions while including nutrition information. Ingredients, Dietary restrictions, Max tokens for recipe
News Article Generation Using a News API plugin, retrieve the latest news headlines and summaries, then use the OpenAI API to fine-tune a language model for news article generation, and generate a full news article based on one of the headlines. News category, Max tokens for news article
Weather Forecast Narration Using a Weather API plugin, retrieve the current weather forecast for a specific location, then use the OpenAI API to fine-tune a language model for weather forecast narration, and generate a narrative description of the weather forecast. Location, Max tokens for narration
Financial Analysis Using a Stock Market API plugin, retrieve stock price data for a specific company, then use the OpenAI API to fine-tune a language model for financial analysis, and generate an analysis report based on the stock price data. Company ticker symbol, Max tokens for analysis report

See complete list of prompts and the Source Code at GitHub

Installation

To install and use the open-source main.py code for the ChatGPT Plugin for OpenAI API, follow the steps below:

  1. Clone the GitHub repository:
git clone https://github.com/ruvnet/chatgpt-openai-api-plugin.git
  1. Change to the cloned directory:
cd chatgpt-openai-api-plugin
  1. Install the required dependencies:
pip install -r requirements.txt
  1. Set the OPENAI_API_KEY environment variable with your OpenAI API key:
export OPENAI_API_KEY=YOUR_API_KEY
  1. Run the FastAPI application using the Uvicorn ASGI server:
uvicorn main:app --host 0.0.0.0 --port 8080
  1. Update ai-plugin.json
./plugins/ai-plugin.json
  1. Manifest is located http://localhost:8080/.well-known/ai-json.json and API Specification is located http://localhost:8080/openapi.json

The ChatGPT Plugin for OpenAI API is now running and accessible at http://localhost:8080.

Open Source

MIT License.

The ChatGPT Plugin for OpenAI API is a valuable tool for users seeking to explore the capabilities of OpenAI’s language models in creative and interactive

Preview

2 Likes

Looks awesome! How do you enable recursive flows? Any possible way to do that with other plugins too? Ex) Wolfram Alpha is called, then your plugin is triggered.

1 Like

Copy and paste my examples from my GitHub. There are also advanced options using a toml based style. I’ll post that later after some more testing

Does this increase the memory capacity of ChatGPT?
It is a default feature of ChatGPT to retain some memory in chats, so if not, I am not sure how it differs from regular ChatGPT.

How to turn Azure API function app into openai plugin? I am struggling with:

but maybe I should do it as plugin instead?