I would love to see a discussion on using the web-app URL-interface, as a way into using the various AI models and getting some form of semantically structured JSON back. This would make integrating the library a lot easier I think.
In my mind I see the tasks as a function-name name and the model context data as arguments on that function. There can also be global arguments, which are applied to all tasks, eg. the format type of the output (and perhaps the language).
I'm currently using the demo app with some URL parameters: https://conze.pt/app/ai/?task=summarization&arg1=Lightning%20is%20a%20naturally%20occurring&l=en
Maybe a good first step would be to have a set of JS objects describing the:
- Available tasks,
- Supported models for each task,
- The model arguments (defaults, optional. required). Later these could be more formalized using some schema.org schema (or similar), eg: AchieveAction
const tasks = {
'summarization':
'description' : 'text summarization',
'type' : 'text-generation',
'models': {
't5-small' : {
'options' : {
'output_formats' : [ 'text, 'json' ],
'output_name' : 'summary',
'max_new_tokens': 50,
'num_beams': 1,
'temperature': 1,
'top_k': 20,
'do_sample': true,
'summary_text' : 'text',
}
},
't5-base' : ...,
't5-v1_1-small' : ...,
't5-v1_1-base' : ...,
'facebook/bart-large-cnn' : ,
'sshleifer/distilbart-cnn-6-6' : ...,
'sshleifer/distilbart-cnn-12-6', ...,
}
// ...another task
}
TODO: Maybe add some "required / optional" and data-type declarations on the model options too.
Once we have this we can create a URL parameter structure to call a task with its options and get some plaintext or JSON back.
And perhaps (later) look into creating an OpenAPI schema (never did that myself): https://editor.swagger.io
I'm not yet sure what the best way would be to use larger amounts of text for models, I'm currently using HTTP GET, but a POST might be better suited for this. The drawback is the linking needs to become indirect then.