Created
April 12, 2023 04:07
-
-
Save brianfoody/fccf79b7b96381f1659a7202285b37d9 to your computer and use it in GitHub Desktop.
gpt4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const payload = { | |
model: "gpt-4", | |
messages: [ | |
{ | |
content: `Tell me the days of the week.`, | |
role: "user", | |
} as ChatGptMessage, | |
], | |
temperature: 0.8, | |
top_p: 1, | |
frequency_penalty: 0.5, | |
presence_penalty: 0.0, | |
max_tokens: 1000, | |
n: 1, | |
}; | |
// const stream = await ChatGPTStream(payload); | |
// return new Response(stream); | |
const completion = await fetch("https://api.openai.com/v1/chat/completions", { | |
headers: { | |
"Content-Type": "application/json", | |
Authorization: `Bearer sk-xxxx`, | |
}, | |
method: "POST", | |
body: JSON.stringify(payload), | |
}).then((x) => x.json()); | |
console.log(JSON.stringify(completion)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment