emi-indo-cordova-plugin-open-ai
v0.0.2
Published
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 )
Downloads
4
Maintainers
Readme
emi-indo-cordova-plugin-open-ai
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:
💰Sponsor this project
Features
- Completions ( model: text-davinci-003 )
Coming soon Features
- chat completion ( model: gpt-3.5-turbo ) ( Finished )
- edit ( model: text-davinci-edit-001 )
- Images generations
- Speech to text
Installation
cordova plugin add emi-indo-cordova-plugin-open-ai
Or
cordova plugin add https://github.com/EMI-INDO/emi-indo-cordova-plugin-open-ai
Remove
cordova plugin rm emi-indo-cordova-plugin-open-ai
Completions
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();
result
chat
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();