Skip to content

Commit

Permalink
refactor(ai): use gpt-4-turbo as default model
Browse files Browse the repository at this point in the history
Also adds a safeguard against gpt 4o in assistants.
  • Loading branch information
Pkmmte committed Jun 18, 2024
1 parent 32e02f3 commit 1520b9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cyan-teachers-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@robojs/ai': patch
---

refactor: use gpt-4-turbo as default model
8 changes: 7 additions & 1 deletion packages/plugin-ai/src/engines/openai/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { AssistantData } from '@/engines/openai/assistant.js'
import type { File, Message } from '@/engines/openai/types.js'
import type { Command } from 'robo.js'

const DEFAULT_MODEL = 'gpt-3.5-turbo'
const DEFAULT_MODEL = 'gpt-4-turbo'

/**
* AI engine powered by OpenAI.
Expand Down Expand Up @@ -271,6 +271,12 @@ async function loadAssistant(functions?: ChatFunction[]): Promise<Assistant | nu
tools: []
}

// TODO: Add support for Assistants v2
if (assistantData.model === 'gpt-4o') {
assistantData.model = DEFAULT_MODEL
logger.debug('Model', color.bold('gpt-4o'), 'is not supported yet. Using', color.bold(DEFAULT_MODEL), 'instead.')
}

// See if we've already created an assistant for this Robo
let assistant: Assistant | undefined | null = null
const assistantId = await Flashcore.get<string>('assistantId', {
Expand Down

0 comments on commit 1520b9f

Please sign in to comment.