0.0.7 • Published 29 days ago
oute-services-prompt-sdk v0.0.7
This module expose helper functions
- Initialization
params = {
url: @server url
token: @access token
}
Prompt = require("oute-services-prompt-sdk")
prompt_instance = new Prompt(params)
Cache functions
Core functions
- Save
body = {
"name": "test 1",
"template": "give me info for \#{{title}}# and \#{{max_count}}#",
"inputs": [{
"key": "title",
"type": "STRING",
"default": null,
"required": true
},{
"key": "max_count",
"type": "NUMBER",
"default": 9999,
"required": false
}]
}
await prompt_instance.save(body)
- Find One
query = {
"_id": "UvuPE2PGn"
}
await prompt_instance.findOne(query)
- execute
body = {
"query": "test", //Send either query or prompt_id with state
// "prompt_id": "YxeFhvcnt",
// "state": {
// "title": "Testing",
// "max_count": 30
// },
"authorization": "", //This will be dynamic for users
"key": "", //This will be dynamic for users
// "response_type": "stream", //Send if required as stream or don't set this key. Use only when generate_type is Text
"generate_type": "Image", //Send either Text or Image
"image_size": "256x256", //Use only when generate_type is Text, Image size available '256x256', '512x512', '1024x1024', '1024x1792', '1792x1024'
"number_of_images": 2 //Use only when generate_type is Text
}
await prompt_instance.execute(body)