Hi there. I have no coding training but am finding that a little Youtube education goes a long way. I’ve been following a YouTube tutorial on automating notes using PipeDream and making some modifications to automate a few things I do at work.
Unfortunately, I don’t know what I don’t know and am unsure of how a little coding might really be helpful to me.
I am close to achieving what I set out to do but perhaps there is a more efficient way? In a nutshell, I am trying to summarize a script (generated from Whisper) based on a 40 minute 6th grade math school lesson. I am now trying to summarize the script in 1000 words or less but am coming up with an error message due to using too many tokens in Chat. So my next attempt is to divide the script in half (it looks like PipeDream is doing this for me?), summarize each half in the GPT API then combine them back together.
Do you have a better way to do this? My tech knowledge is just enough to be dangerous so please respond in simple terms.
Hi @kpalmer1963,
It sounds like you’re on the right track with dividing the script into smaller parts and summarizing each part separately using GPT-3. To achieve this in Pipedream, you can follow these steps:
- Split the script into smaller parts, for example, two halves.
- For each part, create a Pipedream component that sends the text to GPT-3 API for summarization. You can limit the tokens to avoid exceeding the token limit.
- Combine the summarized parts back together.
Here’s an example Pipedream component that sends text to GPT-3 API for summarization:
import { axios } from "@pipedream/platform";
export default defineComponent({
props: {
gpt3_api_key: {
type: "string",
label: "GPT-3 API Key",
},
text: {
type: "string",
label: "Text to summarize",
},
},
async run({ $ }) {
const response = await axios($, {
method: "POST",
url: "https://api.openai.com/v1/engines/davinci-codex/completions",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${this.gpt3_api_key}`,
},
data: {
prompt: `Please summarize the following text in 1000 words or less:\n\n${this.text}`,
max_tokens: 1000,
n: 1,
stop: null,
temperature: 0.7,
},
});
return response.choices[0].text.trim();
},
});
You can use this component twice in your workflow, once for each part of the script, and then combine the summarized results. Remember to replace gpt3_api_key
with your actual GPT-3 API key.
Please note that this is just an example, and you might need to adjust the parameters according to your specific requirements. If you need further assistance, feel free to ask!
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.
What if I don’t know how long the script will be and that I may need to divide it into more than two parts?