Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ai/src/aiprompt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Aiprompt } from './types/Aiprompt';

export const aiprompt: Aiprompt = {
summarized: {
system:
'You create useful summaries of long, technical articles in a "cliff notes" format.',
promptTemplate:
'Summarize the following in a cliff notes format using no more than 160 words, splitting into paragraphs where appropriate:',
},
eli5: {
system:
'You summarize articles in an "explain like I’m five" format. Assume that the user may not be familiar with the technical jargon in the original text.',
promptTemplate:
'Summarize the following in an ELI5 format using a maximum of 60 words:',
}
}
10 changes: 5 additions & 5 deletions ai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { auto, mapLimit } from 'async'

import getScrapedData from './get_scraped_data'
import writeSummary from './write_summary'
import { meetup } from './meetup'
import { aiprompt } from './aiprompt'

dotenv.config()

Expand Down Expand Up @@ -57,11 +57,11 @@ const main = async () => {
messages: [
{
role: 'system',
content: meetup.ai[0].system,
content: aiprompt.summarized.system,
},
{
role: 'user',
content: `${meetup.ai[0].promptTemplate} ${summary.text}`,
content: `${aiprompt.summarized.promptTemplate} ${summary.text}`,
},
],
}),
Expand All @@ -70,11 +70,11 @@ const main = async () => {
messages: [
{
role: 'system',
content: meetup.ai[1].system,
content: aiprompt.eli5.system,
},
{
role: 'user',
content: `${meetup.ai[1].promptTemplate} ${summary.text}`,
content: `${aiprompt.eli5.promptTemplate} ${summary.text}`,
},
],
}),
Expand Down
9 changes: 9 additions & 0 deletions ai/src/types/Aiprompt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface Aiprompt {
summarized: AiType
eli5: AiType
}

type AiType = {
system: string
promptTemplate: string
}
Comment on lines +1 to +9
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice optimization

16 changes: 0 additions & 16 deletions meetup.sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,4 @@ export const meetup: Meetup = {
},
],
image: '/new-bitdevs-default.jpg',
ai: [
{
name: 'Summarized',
system:
'You create useful summaries of long, technical articles in a "cliff notes" format.',
promptTemplate:
'Summarize the following in a cliff notes format using no more than 160 words, splitting into paragraphs where appropriate:',
},
{
name: 'Explain Like I’m Five',
system:
'You summarize articles in an "explain like I’m five" format. Assume that the user may not be familiar with the technical jargon in the original text.',
promptTemplate:
'Summarize the following in an ELI5 format using a maximum of 60 words:',
},
],
}
16 changes: 0 additions & 16 deletions meetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,4 @@ export const meetup: Meetup = {
},
],
image: '/new-bitdevs-default.jpg',
ai: [
{
name: 'Summarized',
system:
'You create useful summaries of long, technical articles in a "cliff notes" format.',
promptTemplate:
'Summarize the following in a cliff notes format using no more than 160 words, splitting into paragraphs where appropriate:',
},
{
name: 'Explain Like I’m Five',
system:
'You summarize articles in an "explain like I’m five" format. Assume that the user may not be familiar with the technical jargon in the original text.',
promptTemplate:
'Summarize the following in an ELI5 format using a maximum of 60 words:',
},
],
}
7 changes: 0 additions & 7 deletions types/Meetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,9 @@ export interface Meetup {
}
mainNav: NavItemType[]
image: string
ai: AiType[]
}

type NavItemType = {
text: string
link: string
}

type AiType = {
name: string
system: string
promptTemplate: string
}