asticaVoice: GPT-S Generate - Javascript Client API
asticaVision
asticaListen
asticaVoice
asticaGPT
asticaGPT - Generate Usage:
<script src="https://astica.ai/javascript-sdk/2023-07-09/astica.api.js"></script>
<script>
asticaAPI_start('API KEY HERE'); //only needs to be called once.
//Simple Usage:
asticaGPT("Write a sentence about apples:")
//With Token Limit:
asticaGPT("Write a sentence about apples:", 10)
//Advanced:
var asticaGPT_params = {
instruction:document.getElementById("astica_ML_temperature").value,
temperature:document.getElementById("astica_ML_temperature").value,
top_p:document.getElementById("astica_ML_top_p").value,
think_pass:document.getElementById("astica_ML_think_pass").value,
stop_sequence:document.getElementById("astica_ML_stop_sequence").value,
stream_output: document.getElementById("astica_ML_stream_output").value
}
asticaGPT(
document.getElementById("astica_ML_version").value,
document.getElementById("astica_ML_gpt_input").value,
document.getElementById("astica_ML_tokens_max").value,
asticaGPT_params
);
//default asticaGPT callbacks
function asticaGPT_generateComplete(data){
console.log(data);
if(typeof data.error != 'undefined') { alert(data.error); }
$('#your_div').val(data.output)
//optional text to speech with asticaVoice:
asticaVoice(data.output);
}
function asticaGPT_generatePreview(data){
console.log(data);
if(typeof data.error != 'undefined') { alert(data.error); return; }
$('#your_div').val(data.output)
}
//Plug and play example:
function asticaGPT_example(string, tokens) {
asticaGPT(string, tokens)
}
setTimeout(function() {
asticaAPI_start('API KEY HERE'); //only needs to be called once.
asticaGPT_example('Write a sentence about apples:', 55); //max 55 tokens
}, 1000);
</script>