Skip to content

A powerful ChatGPT plugin that integrates with the OpenAI API, enabling creative text generation, conversational AI, model fine-tuning, and more. Enhance ChatGPT's capabilities with seamless access to OpenAI's language models.

License

Notifications You must be signed in to change notification settings

ruvnet/chatgpt-openai-api-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatGPT Plugin for OpenAI API

Introduction

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. 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.

Examples of commands you can use:

Title Command and Description Parameters
Generate a Short Poem Using the OpenAI API, generate a short poem about the moon Temperature: 0.7
Translate English to French Using the OpenAI API, translate the English text 'Hello, how are you?' to French -
Fine-Tune for Creative Writing Using the OpenAI API, fine-tune a language model to improve its creative writing ability Training data provided
Multiple Completions for a Prompt Using the OpenAI API, generate multiple completions (n=3) for the prompt 'Once upon a time' Temperature: 0.5, 0.7, 0.9
Generate Factorial Code Snippet Using the OpenAI API, generate a Python code snippet that calculates the factorial of a given number Max tokens: 50
Create a Short Story Using the OpenAI API, create a short story about a robot who discovers its own consciousness Temperature: 0.8
Write a Haiku Using the OpenAI API, write a haiku about the changing seasons Temperature: 0.6
Multiple Versions of a Quote Using the OpenAI API, generate multiple versions (n=2) of a motivational quote with different levels of assertiveness Temperature: 0.3, 0.9
Fine-Tune for Creative Recipes Using the OpenAI API, fine-tune a language model to generate creative recipes based on a list of ingredients, and provide a recipe using the fine-tuned model -
Generate a Dialogue Using the OpenAI API, generate a dialogue between two characters discussing the meaning of life with different levels of formality Top_p: 0.7, 0.95
Find Longest Palindrome Using the OpenAI API, create a code snippet that finds the longest palindrome in a given string Max tokens: 80
Generate a Limerick Using the OpenAI API, generate a limerick about a mischievous cat Temperature: 0.75
Describe an Imaginary Planet Using the OpenAI API, write a short description of an imaginary planet with different levels of detail n=2, Temperature: 0.5, 0.9
Multiple Endings for a Story Using the OpenAI API, generate multiple endings (n=3) for the story 'The princess was trapped in the tower by an evil witch' with different levels of optimism Temperature: 0.4, 0.7, 1.0

Advanced Examples with OpenAI API and ChatGPT Plugins Integration

Title Command and Description Parameters
Creative Recipe and Poem Using the OpenAI API, fine-tune a language model to generate creative recipes, then use the fine-tuned model to create a recipe for a dish with specific dietary restrictions, and finally generate a poem about the dish Training data provided, Dietary restrictions, Temperature for poem
Dialogue and Short Story Using the OpenAI API, generate a dialogue between two characters discussing the meaning of life, then use the dialogue to create a short story, and finally summarize the story in a single sentence Top_p for dialogue, Temperature for story, Max tokens for summary
Prime Number Riddle Using the OpenAI API, generate a Python code snippet that finds prime numbers in a given range, then use the code to find prime numbers between 1 and 100, and finally generate a riddle about one of the prime numbers Max tokens for code, Range: 1-100, Temperature for riddle
Imaginary Planet News Using the OpenAI API, create a short description of an imaginary planet, then generate a fictional news article about a major event on the planet, and finally write a speech by the planet's leader addressing the event Temperature for description, Top_p for article, Max tokens for speech
Mischievous Cat Play Using the OpenAI API, generate a limerick about a mischievous cat, then use the limerick as a prompt to generate a short play featuring the cat, and finally write a review of the play as if it were performed on stage Temperature for limerick, Top_p for play, Max tokens for review
Character Profile and Story Using the OpenAI API, create a program that: (1) Generates a fictional character's profile (name, age, occupation, etc.), (2) Creates a dialogue between the character and an interviewer, (3) Based on the dialogue, generates a short story involving the character, (4) Summarizes the story into a single paragraph, (5) Translates the summary into three different languages Temperature for profile, Top_p for dialogue, Temperature for story, Max tokens for summary, Target languages for translation
Detective Story and Plot Twist Using the OpenAI API, fine-tune a language model to generate detective stories, then use the fine-tuned model to: (1) Generate a detective story with a mysterious crime, (2) Create a list of suspects and their motives, (3) Generate a plot twist revealing the true culprit, (4) Write the detective's closing monologue summarizing the case Training data provided, Temperature for story, Top_p for plot twist, Max tokens for monologue
Math Equation Visualization Using the Wolfram Alpha plugin, generate a visual representation of a mathematical equation, then use the OpenAI API to fine-tune a language model to describe mathematical visuals, and generate a description of the visual representation Mathematical equation, Max tokens for description
Web Content Analysis Using the URL Browser plugin, retrieve the content of a specific website, then use the OpenAI API to fine-tune a language model for text analysis, and generate an analysis report of the website content Website URL, Max tokens for analysis report

Recursive and Chain of Thought

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

Technically Focused

Title Command and Description Parameters
Code Generation: Sorting Algorithm Using the OpenAI API, generate a Python code snippet that implements the merge sort algorithm, then generate comments explaining each step of the code Max tokens for code, Temperature for comments
Enterprise Use: IT Security Policy Using the OpenAI API, generate a comprehensive IT security policy for an enterprise, then summarize the key points of the policy in bullet points Max tokens for policy, Temperature for summary
Startup Management: Pitch Deck Using the OpenAI API, create a pitch deck for a startup in the fintech industry, then generate a script for the founder to use when presenting the pitch deck to investors Temperature for pitch deck, Max tokens for script
Legal: Contract Review Using the OpenAI API, analyze a legal contract for potential risks and liabilities, then generate a report outlining the findings and recommendations for revisions Top_p for analysis, Temperature for report
Consulting: Market Analysis Using the OpenAI API, conduct a market analysis for a new product in the consumer electronics industry, then generate a SWOT analysis and strategic recommendations for market entry Temperature for market analysis, Max tokens for SWOT analysis
Marketing: Ad Campaign Using the OpenAI API, generate a creative ad campaign for a new line of eco-friendly clothing, then create a series of social media posts to promote the campaign Temperature for ad campaign, Top_p for social media posts

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.

Conclusion

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

Additional Examples

Advanced Examples with Various Models and Settings

Title Command and Description Parameters Model
Creative Recipe and Poem Using the OpenAI API, fine-tune a language model to generate creative recipes, then use the fine-tuned model to create a recipe for a dish with specific dietary restrictions, and finally generate a poem about the dish Training data provided, Dietary restrictions, Temperature for poem gpt-4
Dialogue and Short Story Using the OpenAI API, generate a dialogue between two characters discussing the meaning of life, then use the dialogue to create a short story, and finally summarize the story in a single sentence Top_p for dialogue, Temperature for story, Max tokens for summary gpt-3.5-turbo
Prime Number Riddle Using the OpenAI API, generate a Python code snippet that finds prime numbers in a given range, then use the code to find prime numbers between 1 and 100, and finally generate a riddle about one of the prime numbers Max tokens for code, Range: 1-100, Temperature for riddle davinci
Imaginary Planet News Using the OpenAI API, create a short description of an imaginary planet, then generate a fictional news article about a major event on the planet, and finally write a speech by the planet's leader addressing the event Temperature for description, Top_p for article, Max tokens for speech curie
Mischievous Cat Play Using the OpenAI API, generate a limerick about a mischievous cat, then use the limerick as a prompt to generate a short play featuring the cat, and finally write a review of the play as if it were performed on stage Temperature for limerick, Top_p for play, Max tokens for review babbage
Character Profile and Story Using the OpenAI API, create a program that: (1) Generates a fictional character's profile (name, age, occupation, etc.), (2) Creates a dialogue between the character and an interviewer, (3) Based on the dialogue, generates a short story involving the character, (4) Summarizes the story into a single paragraph, (5) Translates the summary into three different languages Temperature for profile, Top_p for dialogue, Temperature for story, Max tokens for summary, Target languages for translation gpt-3.5-turbo-0301
Detective Story and Plot Twist Using the OpenAI API, fine-tune a language model to generate detective stories, then use the fine-tuned model to: (1) Generate a detective story with a mysterious crime, (2) Create a list of suspects and their motives, (3) Generate a plot twist revealing the true culprit, (4) Write the detective's closing monologue summarizing the case Training data provided, Temperature for story, Top_p for plot twist, Max tokens for monologue gpt-4-0314
Code Generation and Explanation Using the OpenAI API, generate a Python code snippet that calculates the factorial of a given number, then use the code to calculate the factorial of 5, and finally generate a natural language explanation of how the code works Max tokens for code, Input number: 5, Temperature for explanation text-davinci-002
Creative Writing and Translation Using the OpenAI API, generate a short story about a robot who discovers its own consciousness, then summarize the story in a single sentence, and finally translate the summary into French, Spanish, and German Temperature for story, Max tokens for summary, Target languages:

Fine-Tuning Examples with OpenAI API (Simple to Complex)

Title Command and Description Parameters
Code Generation: Sorting Algorithm Using the OpenAI API, fine-tune a language model to generate Python code snippets, then generate a code snippet that implements the merge sort algorithm, and finally generate comments explaining the code. Temperature for code generation, Max tokens for comments
Sentiment Analysis Using the OpenAI API, fine-tune a language model for sentiment analysis, then classify the sentiment of the following text: "I love the beautiful sunset." Training data provided, Sentiment labels: Positive, Negative, Neutral
Text Summarization Using the OpenAI API, fine-tune a language model for text summarization, then generate a concise summary of a long news article. Training data provided, Max tokens for summary
Language Translation Using the OpenAI API, fine-tune a language model for language translation, then translate the following English text to French: "Hello, how are you?" Training data provided, Target language: French
Creative Recipe Generation Using the OpenAI API, fine-tune a language model to generate creative recipes, then use the fine-tuned model to create a recipe for a dish with specific dietary restrictions, and finally generate a poem about the dish. Training data provided, Dietary restrictions, Temperature for poem
Dialogue Generation Using the OpenAI API, fine-tune a language model for dialogue generation, then generate a dialogue between two characters discussing the meaning of life. Training data provided, Top_p for dialogue
Story Continuation Using the OpenAI API, fine-tune a language model for story continuation, then generate a continuation for the story prompt: "Once upon a time in a faraway land..." Training data provided, Temperature for story continuation
Multi-Task Learning Using the OpenAI API, fine-tune a language model for multi-task learning, then perform tasks such as text classification, named entity recognition, and sentiment analysis on a given text. Training data provided, Multiple tasks and labels
Custom Language Model Using the OpenAI API, fine-tune a language model to mimic the writing style of a specific author, then generate a short story in the style of that author. Training data provided, Target author, Temperature for story generation
Complex NLP Pipeline Using the OpenAI API, fine-tune a language model to perform a series of NLP tasks, such as text classification, entity linking, relation extraction, and coreference resolution on a given text. Training data provided, Multiple NLP tasks and annotations

Fine-Tuning Examples with OpenAI API and ChatGPT Plugins Integration

Title Command and Description Parameters
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

Preview

ChatGPT OpenAI API Plugin

About

A powerful ChatGPT plugin that integrates with the OpenAI API, enabling creative text generation, conversational AI, model fine-tuning, and more. Enhance ChatGPT's capabilities with seamless access to OpenAI's language models.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages