|
@@ -22,6 +22,14 @@ class TogetherAIService extends BaseService {
|
|
|
|
|
|
static IMPLEMENTS = {
|
|
static IMPLEMENTS = {
|
|
['puter-chat-completion']: {
|
|
['puter-chat-completion']: {
|
|
|
|
+ async list () {
|
|
|
|
+ let models = this.modules.kv.get(`${this.kvkey}:models`);
|
|
|
|
+ if ( models ) return models;
|
|
|
|
+ models = await this.together.models.list();
|
|
|
|
+ this.modules.kv.set(
|
|
|
|
+ `${this.kvkey}:models`, models, { EX: 5*60 });
|
|
|
|
+ return models;
|
|
|
|
+ },
|
|
async complete ({ messages, stream, model }) {
|
|
async complete ({ messages, stream, model }) {
|
|
console.log('model?', model);
|
|
console.log('model?', model);
|
|
const completion = await this.together.chat.completions.create({
|
|
const completion = await this.together.chat.completions.create({
|