Open API Platformのexamplesをnode.jsで試す旅です。この記事ではNatural language to Stripeを試してみます。
サンプルのソースはこちらにあります。
https://platform.openai.com/examples/default-stripe-api
サンプルソースのままだと動かないので少し修正を加えます。ソースコードは次の通りです。
[someone@somewhere stub]$ cat exsamples_Natual_language_to_stripe_api.js
require('dotenv').config();
const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
async function run(){
const response = await openai.createCompletion({
model: "text-davinci-003",
prompt: "\"\"\"\nUtil exposes the following:\n\nutil.stripe() -> authenticates & returns the stripe module; usable as stripe.Charge.create etc\n\"\"\"\nimport util\n\"\"\"\nCreate a Stripe token using the users credit card: 5555-4444-3333-2222, expiration date 12 / 28, cvc 521\n\"\"\"",
temperature: 0,
max_tokens: 100,
top_p: 1.0,
frequency_penalty: 0.0,
presence_penalty: 0.0,
stop: ["\"\"\""],
});
if (response.data && response.data.choices && response.data.choices.length > 0) {
console.log(response.data.choices[0].text);
} else {
console.log("No response received or empty choices.");
}
}
run();
実行結果は次のようになりました。
[rocky@www stub]$ node exsamples_Natual_language_to_stripe_api.js
token = stripe.Token.create(
card={
"number": "5555-4444-3333-2222",
"exp_month": 12,
"exp_year": 28,
"cvc": 521
},
)
Yo, I use p898login for super easy access to P898, it saves a lot of time. go check it out! quick access: p898login
V88 club, fala a verdade, quem não gosta de um lugar VIP? Esse clube tem tudo pra te fazer sentir o sheik! Joguei e aprovei! Conheça o v88 club.
Just hopped onto 888pcom. They have live casino, which is pretty cool. Worth checking out if you like that immersive experience. Here is the link: 888pcom
Word on the street is f8beta2con is up-and-coming! The design feels really modern. Give it a try and see if you will like the games: f8beta2con
Hey guys, just wanted to say KU19NET is my new go-to! Seriously, the games are popping and the wins feel oh-so-good. Give ku19net a try, you won’t regret it!