Cordova Plugin for using OpenAI's GPT apis. Supports GPT-3, ChatGPT, and GPT-4. ( Requires third party services https://openai.com/ that charge money )
- Code source: - OpenAI:
- Completions ( model: text-davinci-003 )
- chat completion ( model: gpt-3.5-turbo ) ( Finished )
- edit ( model: text-davinci-edit-001 )
- Images generations
- Speech to text
cordova plugin add emi-indo-cordova-plugin-open-ai
cordova plugin add https://github.com/EMI-INDO/emi-indo-cordova-plugin-open-ai
cordova plugin rm emi-indo-cordova-plugin-open-ai
Example - index.html:
let _Completion = () => {
cordova.plugins.emiOpenAiPlugin.completions(
apiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // apiKey https://platform.openai.com/
timeOut = 0, //set this to 60, If error Failed to load response due to timeout
prompt = "Hi? make me html code", // string
max_tokens = 4000,
temperature = 0,
(result) => { alert(result) },
(error) => { alert(error)
});
}
// call _Completion();
Example - index.html:
let _chat = () => {
cordova.plugins.emiOpenAiPlugin.chat(
apiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // apiKey https://platform.openai.com/
timeOut = 0, //set this to 60, If error Failed to load response due to timeout
role = "user", // The role of the author of this message. One of system, user, or assistant.
content = "Make me coffee",
(result) => { alert(result) },
(error) => { alert(error)
});
}
// call _chat();