tweak(puerai): add model parameter

This commit is contained in:
KernelDeimos
2024-08-21 23:15:53 -04:00
parent 439f52b5a3
commit 7b254e8676
3 changed files with 5 additions and 5 deletions
@@ -34,6 +34,7 @@ class AIInterfaceService extends BaseService {
messages: { type: 'json' },
vision: { type: 'flag' },
stream: { type: 'flag' },
model: { type: 'string' },
},
result: { type: 'json' },
}
@@ -26,7 +26,7 @@ class ClaudeService extends BaseService {
static IMPLEMENTS = {
['puter-chat-completion']: {
async complete ({ messages, stream }) {
async complete ({ messages, stream, model }) {
const adapted_messages = [];
const system_prompts = [];
@@ -67,7 +67,7 @@ class ClaudeService extends BaseService {
}, stream);
(async () => {
const completion = await this.anthropic.messages.stream({
model: 'claude-3-5-sonnet-20240620',
model: model ?? 'claude-3-5-sonnet-20240620',
max_tokens: 1000,
temperature: 0,
system: PUTER_PROMPT + JSON.stringify(system_prompts),
@@ -23,7 +23,7 @@ class OpenAICompletionService extends BaseService {
static IMPLEMENTS = {
['puter-chat-completion']: {
async complete ({ messages, test_mode, stream }) {
async complete ({ messages, test_mode, stream, model }) {
if ( test_mode ) {
const { LoremIpsum } = require('lorem-ipsum');
const li = new LoremIpsum({
@@ -49,9 +49,8 @@ class OpenAICompletionService extends BaseService {
}
}
const model = 'gpt-4o';
return await this.complete(messages, {
model,
model: model ?? 'gpt-4o',
moderation: true,
stream,
});