Skip to content

Commit

Permalink
Add GPT-4o to the list of supported models
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmyersdev committed May 13, 2024
1 parent cacb9ae commit 156c78d
Showing 1 changed file with 42 additions and 35 deletions.
77 changes: 42 additions & 35 deletions composables/useAssistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,46 @@ import {
useStorage,
} from 'vellma/peripherals'

const defaultLanguageModels = [
{
id: 'gpt-4o',
label: 'GPT-4o',
contextWindow: '128k',
},
{
id: 'gpt-4-turbo',
label: 'GPT-4 Turbo',
contextWindow: '128k',
},
{
id: 'gpt-4-turbo-preview',
label: 'GPT-4 Turbo (Preview)',
contextWindow: '128k',
},
{
id: 'gpt-4-vision-preview',
label: 'GPT-4 Turbo Vision',
contextWindow: '128k',
comingSoon: true,
disabled: true,
},
{
id: 'gpt-4',
label: 'GPT-4',
contextWindow: '8k',
},
{
id: 'gpt-4-32k',
label: 'GPT-4 (32k)',
contextWindow: '32k',
},
{
id: 'gpt-3.5-turbo-0125',
label: 'GPT-3.5 Turbo',
contextWindow: '16k',
},
] as const

export const dexieStorage = (): StorageAdapter => {
const { db } = useDatabase()

Expand Down Expand Up @@ -50,7 +90,7 @@ export const dexieStorage = (): StorageAdapter => {
}
}

export const useAssistant = ({ chatId, languageModel = ref({ id: 'gpt-4-1106-preview', label: 'GPT-4 Turbo' }) }: { chatId: Ref<string>, languageModel?: Ref<{ id: string, label: string }> }) => {
export const useAssistant = ({ chatId, languageModel = ref(defaultLanguageModels[0]) }: { chatId: Ref<string>, languageModel?: Ref<{ id: string, label: string }> }) => {
const storageAdapter = dexieStorage()
const apiKey = useLocalStorage<string>('openAiApiKey', '', {
initOnMounted: true,
Expand All @@ -63,40 +103,7 @@ export const useAssistant = ({ chatId, languageModel = ref({ id: 'gpt-4-1106-pre
const chatModel = computed(() => chatInterface.value.model)
const chatFactory = computed(() => chatInterface.value.factory)

const languageModels = ref([
{
id: 'gpt-4-turbo',
label: 'GPT-4 Turbo',
contextWindow: '128k',
},
{
id: 'gpt-4-turbo-preview',
label: 'GPT-4 Turbo (Preview)',
contextWindow: '128k',
},
{
id: 'gpt-4-vision-preview',
label: 'GPT-4 Turbo Vision',
contextWindow: '128k',
comingSoon: true,
disabled: true,
},
{
id: 'gpt-4',
label: 'GPT-4',
contextWindow: '8k',
},
{
id: 'gpt-4-32k',
label: 'GPT-4 (32k)',
contextWindow: '32k',
},
{
id: 'gpt-3.5-turbo-0125',
label: 'GPT-3.5 Turbo',
contextWindow: '16k',
},
])
const languageModels = ref(defaultLanguageModels)

return {
apiKey,
Expand Down

0 comments on commit 156c78d

Please sign in to comment.