ChatGPT-4 Workflow Parameter Missing in Pipedream: How to Find It?

This topic was automatically generated from Slack. You can find the original thread here.

I am working on a ChatGPT-4 workflow for the first time and I do not see this parameter available in Pipedream. Can someone help?

Hi Russell,

Good question, for missing props to pre-built actions you can request to have them added here: New Pipedream Integration Request

All actions are open source, so you could add it yourself.

However, you can also use the Send Any HTTP Request to any OpenAI action to include this property yourself as well:

Or you can even use Mario our GPT powered bot that can write Node.js steps for you.

can you write a Node.js code step that integrations with ChatGPT via OpenAI that passes a Memory Key prop to the OpenAI API endpoint?

I can help you with a Node.js code step that integrates with ChatGPT via OpenAI and passes a Memory Key prop to the OpenAI API endpoint. Here’s an example: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { apiKey: { type: "string", label: "OpenAI API Key", secret: true, }, prompt: { type: "string", label: "Prompt", }, memoryKey: { type: "string", label: "Memory Key", }, }, async run({ $ }) { const openaiUrl = "https://api.openai.com/v1/engines/davinci-codex/completions"; const headers = { "Content-Type": "application/json", "Authorization": `Bearer ${this.apiKey}`, }; const data = { prompt: this.prompt, max_tokens: 50, n: 1, stop: null, temperature: 1, user_memory: { role: "system", content: this.memoryKey, }, }; try { const response = await axios($, { method: "POST", url: openaiUrl, headers: headers, data: data, }); return response; } catch (error) { console.error("Error:", error); throw error; } }, }); This code step requires an OpenAI API Key, a prompt, and a memory key as input props. It sends a request to the OpenAI API with the provided memory key and returns the response. Make sure to replace the davinci-codex engine with text-davinci-002 if you want to use ChatGPT specifically.

How would I “All actions are open source, so you could add it yourself”?

All of the Pipedream components, including triggers and actions are hosted on our public Github repository here:

So you could fork this repository and modify the OpenAI action and publish the modified version to your account.

This file in particular is the pre-built action for sending a prompt to OpenAI:

Looking at this now. How do I publish to my account?

I appreciate the help btw

Of course, happy to help.

Once you have the Pipedream repository set up, then you can install the Pipedream CLI tool. That will allow you to run commands that interact with your Pipedream workspace.

pd publish components/openai/actions/send-prompt/send-prompt.mjs will publish your version of the action to your account:

The correct component would be chat.mjs since I am using gpt-4, correct?

Also, would i not just modify the common.mjs to add the memory_key?

Again, please forgive me, as I am no developer.