How to Integrate Perplexity AI within ChatGPT Using Actions

How to Integrate Perplexity AI within ChatGPT Using Actions

I recently discovered a game-changing way to combine the best of two powerful AI tools: ChatGPT and Perplexity AI. By leveraging ChatGPT Actions, I've managed to integrate Perplexity's cutting-edge research capabilities directly into ChatGPT, making it a versatile and robust tool for all your AI needs.

This combination is not just a technical marvel but also an underrated functionality that many are unaware of. With ChatGPT Actions, the possibilities are endless, and setting it up is simpler than you might think. Below, I'll walk you through how I did it and provide a step-by-step guide so you can do the same.

Integrating Perplexity AI into ChatGPT: Step-by-Step Guide

Step 1: Create a New GPT Instance

Begin by creating a new GPT within ChatGPT. This will be the foundation where Perplexity AI will be integrated. You can name it something relevant like "Perplexity Research GPT."

Step 2: Configure Your GPT and Disable Web Browsing

After setting up your new GPT, you’ll need to configure it. One critical step is to ensure that web browsing is disabled. This prevents ChatGPT from using Bing for research, allowing Perplexity AI to take the lead.


Uncheck: Web Browsing

Step 3: Add a New Action

Scroll down in the configuration interface until you see the "Create new action" button. Click on this to start defining how ChatGPT will interact with Perplexity AI.

Step 4: Input the Action Schema

Once you've clicked on "Create new action," you'll need to input the action schema. This schema tells ChatGPT how to interact with the Perplexity API, which will handle the research tasks. Here's the specific JSON code you'll need to paste into the schema section:

{
  "openapi": "3.1.0",
  "info": {
    "title": "Perplexity Chat Completions API",
    "description": "Generates a model’s response for the given chat conversation.",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://api.perplexity.ai",
      "description": "Perplexity API Server"
    }
  ],
  "paths": {
    "/chat/completions": {
      "post": {
        "description": "Creates a model response for the given chat conversation.",
        "operationId": "CreateChatCompletion",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful response containing the model's completion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "ChatCompletionRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "llama-3.1-sonar-small-128k-online"
            ],
            "description": "The name of the model that will complete your prompt. This is always set to 'llama-3.1-sonar-small-128k-online'.",
            "default": "llama-3.1-sonar-small-128k-online"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "system",
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": "string",
                  "description": "The content of the message."
                }
              },
              "required": [
                "role",
                "content"
              ]
            },
            "default": [
              {
                "role": "system",
                "content": "Be precise and concise."
              }
            ],
            "description": "A list of messages comprising the conversation so far, starting with a system instruction."
          },
          "max_tokens": {
            "type": "integer",
            "description": "The maximum number of completion tokens returned by the API."
          },
          "temperature": {
            "type": "number",
            "default": 0.3,
            "description": "The amount of randomness in the response. This is always set to 0.3."
          },
          "top_p": {
            "type": "number",
            "default": 0.9,
            "description": "The nucleus sampling threshold."
          },
          "return_citations": {
            "type": "boolean",
            "default": false,
            "description": "Whether to return citations."
          },
          "search_domain_filter": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of domains to filter the citations."
          },
          "return_images": {
            "type": "boolean",
            "default": false,
            "description": "Whether to return images."
          },
          "return_related_questions": {
            "type": "boolean",
            "default": false,
            "description": "Whether to return related questions."
          },
          "search_recency_filter": {
            "type": "string",
            "description": "Returns search results within the specified time interval."
          },
          "top_k": {
            "type": "integer",
            "default": 0,
            "description": "The number of tokens to keep for highest top-k filtering."
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "Whether to incrementally stream the response."
          },
          "presence_penalty": {
            "type": "number",
            "default": 0,
            "description": "Penalizes new tokens based on their presence in the text."
          },
          "frequency_penalty": {
            "type": "number",
            "default": 1,
            "description": "Penalizes new tokens based on their frequency in the text."
          }
        },
        "required": [
          "model",
          "messages"
        ]
      },
      "ChatCompletionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A unique ID for the response."
          },
          "model": {
            "type": "string",
            "description": "The model used to generate the response."
          },
          "object": {
            "type": "string",
            "description": "The object type, always 'chat.completion'."
          },
          "created": {
            "type": "integer",
            "description": "The Unix timestamp of when the completion was created."
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "finish_reason": {
                  "type": "string"
                },
                "message": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ]
                    },
                    "content": {
                      "type": "string"
                    }
                  }
                },
                "delta": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ]
                    },
                    "content": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "completion_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}        

Step 5: Authenticate with Perplexity AI

Next, you’ll need to authenticate your action. Click on the "Authentication" tab and select "API Key." Paste your Perplexity AI API key, which you can obtain from Perplexity AI’s settings page Set the Auth Type to "Bearer."


Authentication
Authentication

Step 6: Test Your Action

Once everything is set up, it’s crucial to test your action to ensure that ChatGPT can successfully interact with Perplexity AI. Click the "Test" button in the bottom right corner of the interface.

Step 7: Start Using Perplexity within ChatGPT

Now that you’ve set up your Perplexity AI integration, you can start utilizing it directly within ChatGPT. Make sure to reference the Perplexity API within your prompts, for example, by including phrases like "Call the api.perplexity.ai API" or "run the CreateChatCompletion action."


Why ChatGPT Actions Are Underrated

The ChatGPT Actions feature is a powerful yet underutilized aspect of the platform. Many users aren’t even aware of its existence, which is unfortunate given its vast potential. Whether you’re integrating Perplexity AI for advanced research, automating tasks, or customizing workflows, ChatGPT Actions offer endless possibilities.

Feel free to tweak and adapt the setup to suit your specific needs. The only limit is your imagination!

If you're interested in further exploring these functionalities, don't hesitate to dive in and experiment with what ChatGPT Actions can do. You'll be surprised at how much more productive and versatile your AI experience can become.

And if you’re looking to transform your business with AI-driven solutions, book a free consultation with VEPANDO to see how we can help you achieve your goals.

Hrijul Dey

Python/GenAI Dev | 3D Artist | Startup Founder | Social Media Analyst

2 周

Ready to dive into the world of coding? Perplexity AI makes it possible with their interactive learning platform. Break down complex concepts and refine your understanding. Join the movement and level up your skills today. https://www.artificialintelligenceupdate.com/learn-to-code-with-perplexity-ai-guide/riju/ #learnmore #TechLearning #CodingRevolution #AIEducation

回复
Willianne van Hemert

SEO & SEA Specialist bij Search Signals

2 周

Duidelijk en praktisch! Merci!

要查看或添加评论,请登录

社区洞察

其他会员也浏览了