fix: chatgpt prompts
This commit is contained in:
parent
e863e74e22
commit
0adce93c81
28
deno.json
28
deno.json
@ -8,14 +8,7 @@
|
||||
"preview": "deno run -A main.ts",
|
||||
"update": "deno run -A -r https://fresh.deno.dev/update ."
|
||||
},
|
||||
"lint": {
|
||||
"rules": {
|
||||
"tags": [
|
||||
"fresh",
|
||||
"recommended"
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": { "rules": { "tags": ["fresh", "recommended"] } },
|
||||
"imports": {
|
||||
"typesense": "https://raw.githubusercontent.com/bradenmacdonald/typesense-deno/main/mod.ts",
|
||||
"yaml": "https://deno.land/std@0.197.0/yaml/mod.ts",
|
||||
@ -26,22 +19,17 @@
|
||||
"@islands": "./islands",
|
||||
"@islands/": "./islands/",
|
||||
"zod": "https://deno.land/x/zod@v3.21.4/mod.ts",
|
||||
"$fresh/": "https://deno.land/x/fresh@1.6.1/",
|
||||
"preact": "https://esm.sh/preact@10.19.2",
|
||||
"preact/": "https://esm.sh/preact@10.19.2/",
|
||||
"$fresh/": "https://deno.land/x/fresh@1.6.8/",
|
||||
"preact": "https://esm.sh/preact@10.19.6",
|
||||
"preact/": "https://esm.sh/preact@10.19.6/",
|
||||
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.2",
|
||||
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.1",
|
||||
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.0",
|
||||
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
|
||||
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
|
||||
"$std/": "https://deno.land/std@0.193.0/",
|
||||
"tailwindcss": "npm:tailwindcss@3.3.5",
|
||||
"tailwindcss/": "npm:/tailwindcss@3.3.5/",
|
||||
"tailwindcss/plugin": "npm:/tailwindcss@3.3.5/plugin.js"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "preact"
|
||||
},
|
||||
"exclude": [
|
||||
"**/_fresh/*"
|
||||
]
|
||||
"compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" },
|
||||
"exclude": ["**/_fresh/*"]
|
||||
}
|
||||
|
@ -17,15 +17,15 @@ function extractListFromResponse(response?: string): string[] {
|
||||
|
||||
export async function summarize(content: string) {
|
||||
if (!openAI) return;
|
||||
const chatCompletion = await openAI.createChatCompletion({
|
||||
const chatCompletion = await openAI.chat.completions.create({
|
||||
model: "gpt-3.5-turbo",
|
||||
messages: [
|
||||
{ "role": "system", "content": "You are a helpful assistant." },
|
||||
{ "role": "user", "content": content.slice(0, 2000) },
|
||||
{
|
||||
"role": "user",
|
||||
"content":
|
||||
"Please summarize the article in one sentence as short as possible",
|
||||
role: "user",
|
||||
content:
|
||||
`Please summarize the article in one sentence as short as possible: ${
|
||||
content.slice(0, 2000)
|
||||
}`,
|
||||
},
|
||||
],
|
||||
});
|
||||
@ -34,15 +34,17 @@ export async function summarize(content: string) {
|
||||
}
|
||||
export async function shortenTitle(content: string) {
|
||||
if (!openAI) return;
|
||||
const chatCompletion = await openAI.createChatCompletion({
|
||||
const chatCompletion = await openAI.chat.completions.create({
|
||||
model: "gpt-3.5-turbo",
|
||||
messages: [
|
||||
{ "role": "system", "content": "You are a helpful assistant." },
|
||||
{ "role": "user", "content": content.slice(0, 2000) },
|
||||
{
|
||||
"role": "user",
|
||||
"content":
|
||||
"Please shorten the provided website title as much as possible, don't rewrite it, just remove unneccesary informations. Please remove for example any mention of the name of the website.",
|
||||
role: "system",
|
||||
content:
|
||||
"You shorten the title of the provided website as much as possible, don't rewrite it, just remove unneccesary information. Please remove for example any mention of the name of the website.",
|
||||
},
|
||||
{
|
||||
role: "user",
|
||||
content: content.slice(0, 2000),
|
||||
},
|
||||
],
|
||||
});
|
||||
@ -52,15 +54,17 @@ export async function shortenTitle(content: string) {
|
||||
|
||||
export async function extractAuthorName(content: string) {
|
||||
if (!openAI) return;
|
||||
const chatCompletion = await openAI.createChatCompletion({
|
||||
const chatCompletion = await openAI.chat.completions.create({
|
||||
model: "gpt-3.5-turbo",
|
||||
messages: [
|
||||
{ "role": "system", "content": "You are a helpful assistant." },
|
||||
{ "role": "user", "content": content.slice(0, 2000) },
|
||||
{
|
||||
"role": "user",
|
||||
"content":
|
||||
"If you are able to extract the name of the author from the text please respond with the name, otherwise respond with 'not found'",
|
||||
role: "system",
|
||||
content:
|
||||
"You extract the name of the author from the given text. If you are not able to extract the name, please respond with 'not found' and do not include any other output.",
|
||||
},
|
||||
{
|
||||
role: "user",
|
||||
content: content.slice(0, 2000),
|
||||
},
|
||||
],
|
||||
});
|
||||
@ -85,20 +89,15 @@ export async function createGenres(
|
||||
model: "gpt-3.5-turbo",
|
||||
messages: [
|
||||
{
|
||||
"role": "system",
|
||||
"content":
|
||||
role: "system",
|
||||
content:
|
||||
`you create some keywords that can be used in a recommendation system. The keywords are based on a ${type} description or title. If you do not know the title, take into account the description aswell. Create a range of keywords from very specific ones that describe the general vibe. ${
|
||||
title ? `The name of the ${type} is ${title}` : ""
|
||||
}`,
|
||||
}. Return a list of around 20 keywords seperated by commas`,
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": `description:
|
||||
${description.slice(0, 2000)}`,
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": "return a list of around 20 keywords seperated by commas",
|
||||
role: "user",
|
||||
content: description.slice(0, 2000),
|
||||
},
|
||||
],
|
||||
});
|
||||
@ -123,12 +122,12 @@ export async function createKeywords(
|
||||
"content":
|
||||
`you create some keywords that can be used in a recommendation system. The keywords are based on a ${type} description or title. If you do not know the title, take into account the description aswell. Create a range of keywords from very specific ones that describe the general vibe.
|
||||
title: ${title}
|
||||
description: ${description.slice(0, 2000).replaceAll("\n", " ")}}
|
||||
return a list of around 20 keywords seperated by commas
|
||||
`,
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": "return a list of around 20 keywords seperated by commas",
|
||||
"content": description.slice(0, 2000).replaceAll("\n", " "),
|
||||
},
|
||||
],
|
||||
});
|
||||
@ -147,8 +146,8 @@ export const getMovieRecommendations = (keywords: string, exclude: string[]) =>
|
||||
model: "gpt-3.5-turbo",
|
||||
messages: [
|
||||
{
|
||||
"role": "system",
|
||||
"content":
|
||||
role: "user",
|
||||
content:
|
||||
`Could you recommend me 10 movies based on the following attributes:
|
||||
|
||||
${keywords}
|
||||
@ -190,13 +189,12 @@ export async function createTags(content: string) {
|
||||
const chatCompletion = await openAI.createChatCompletion({
|
||||
model: "gpt-3.5-turbo",
|
||||
messages: [
|
||||
{ "role": "system", "content": "You are a helpful assistant." },
|
||||
{ "role": "user", "content": content.slice(0, 2000) },
|
||||
{
|
||||
"role": "user",
|
||||
"content":
|
||||
role: "system",
|
||||
content:
|
||||
"Please respond with a list of genres the corresponding article falls into, dont include any other informations, just a comma seperated list of top 5 categories. Please respond only with tags that make sense even if there are less than five.",
|
||||
},
|
||||
{ role: "user", content: content.slice(0, 2000) },
|
||||
],
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user