Last night my wife and I spent 40 minutes choosing what movie to watch. We finally settled on watching a chick flick, which I only lasted 20 mins watching before I fell asleep.
Would it be nice if AI could recommend me a movie? Well,
Last night my wife and I spent 40 minutes choosing what movie to watch. We finally settled on watching a chick flick, which I only lasted 20 mins watching before I fell asleep.
Would it be nice if AI could recommend me a movie? Well,
/ is powering the interaction to IMDB.
// api/getMediaDetails/+server.ts
import {OMDB_API_KEY} from '$env/static/private';
import {json} from '@sveltejs/kit';
export async function POST({request}: {request: any) {
const {
title
} = await request.json();
const url = `http://www.omdbapi.com/?apikey=${OMDB_API_KEY}&t=${title}`;
const res = await fetch(url);
const details = await res.json();
return json(details);
}
The AI is powered using a ReadableStream, which I cover in my previous service.
// src/routes/api/getRecommendation/+server.ts
export async function POST({
request
}: {
request: any
}) {
const {
searched
} = await request.json();
const payload = {
model: 'text-davinci-003',
prompt: searched,
temperature: 0.7,
max_tokens: 2048,
top_p: 1.0,
frequency_penalty: 0.0,
stream: true,
presence_penalty: 0.0,
n: 1
}; // all params are explained in the openai completion docs
const stream = await OpenAIStream(payload);
return new Response(stream);
}
All params are explained in the .
Find more AI projects using OpenSauced
Stay saucy.
Ähnliche Beiträge
Thematisch verwandte Begriffe: powered, movie, recommendations · 6 Treffer
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.
Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.
SOCIAL SHARE CARD GENERATOR