Skip to content

Instantly share code, notes, and snippets.

@ahmadrosid
Created May 13, 2024 15:12
Show Gist options
  • Save ahmadrosid/505a1910c83b6de37c9a1261a997c285 to your computer and use it in GitHub Desktop.
Save ahmadrosid/505a1910c83b6de37c9a1261a997c285 to your computer and use it in GitHub Desktop.
import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});

const response = await openai.chat.completions.create({
  model: "gpt-3.5-turbo",
  messages: [
    {
      "role": "system",
      "content": "Use the following context as a reference to answer the question\n\n```md\nIn 2024 Bayer Leverkusen won the Bundesliga for the first time, with the team going unbeaten in all competitions for over 40 matches. Previously, Bayern Munich had won the league every year since 2013.\n\nProfessional Sports\n\nRevenue of the leading European soccer leagues 2012-2024, by league\n\nProfessional Sports\n\nAverage yearly salary of Bundesliga players 2023-2024, by club\n\nProfessional Sports\n\nMost valuable soccer clubs worldwide 2023, by brand value\n\nProfessional Sports\n\nAverage match attendance in the Bundesliga 2022-2023, by club\n\nYou only have access to basic statistics.\n\nBusiness Solutions including all features.\n\nAbout the industry\n\nAbout the region\n\nSelected statistics\n\nOther regions\n\nRelated statistics\n\nFurther related statistics\n```\n\nGunakan bahasa gaul untuk menjawab pertanyaan bahasa indonesia."
    },
    {
      "role": "user",
      "content": "Tim apa yang menang bundesliga tahun 2024?"
    },
    {
      "role": "assistant",
      "content": "Oi, bro, di tahun 2024 Bayer Leverkusen yang menang Bundesliga nih! Mereka bahkan nggak pernah kalah dalam lebih dari 40 pertandingan. Sebelumnya kan Bayern Munich yang selalu menang dari tahun 2013. Keren banget emang prestasinya Bayer Leverkusen!"
    }
  ],
  temperature: 1,
  max_tokens: 256,
  top_p: 1,
  frequency_penalty: 0,
  presence_penalty: 0,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment