|
var request = require('request'); |
|
|
|
var headers = { |
|
'Content-Type': 'application/json' |
|
}; |
|
|
|
var dataString = '{"contents":[{"parts":[{"text":"d"}]}]}'; |
|
|
|
var options = { |
|
url: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=AIzaSyAueRCtlOkRXRvzexG9MaVB-t7PX8OpK7I', |
|
method: 'POST', |
|
headers: headers, |
|
body: { |
|
contents: [ |
|
{ |
|
parts: [ |
|
{ |
|
text: "hello" |
|
} |
|
] |
|
} |
|
] |
|
}; |
|
|
|
function callback(error, response, body) { |
|
if (!error && response.statusCode == 200) { |
|
console.log(JSON.parse(body).candidates[0].content); |
|
} |
|
} |
|
|
|
request(options, callback); |
|
|