diff --git a/src/modules/llms/openai/OpenAISourceSetup.tsx b/src/modules/llms/openai/OpenAISourceSetup.tsx index 0752f637a..477ca109c 100644 --- a/src/modules/llms/openai/OpenAISourceSetup.tsx +++ b/src/modules/llms/openai/OpenAISourceSetup.tsx @@ -38,6 +38,7 @@ export function OpenAISourceSetup(props: { sourceId: DModelSourceId }) { const { isFetching, refetch, isError } = apiQuery.openai.listModels.useQuery({ oaiKey, oaiHost, oaiOrg, heliKey }, { enabled: !hasModels && shallFetchSucceed, onSuccess: models => { + console.log('OpenAI models', models); const llms = source ? models.map(model => openAIModelToDLLM(model, source)) : []; useModelsStore.getState().addLLMs(llms); }, @@ -134,10 +135,10 @@ export function OpenAISourceSetup(props: { sourceId: DModelSourceId }) { // this will help with adding metadata to the models const knownBases = [ { - id: 'gpt-4-32k', - label: 'GPT-4-32', + id: 'gpt-4-32k-0613', + label: 'GPT-4-32k (0613)', context: 32768, - description: 'Largest context window for big thinking', + description: 'Largest context window for big problems', }, { id: 'gpt-4', @@ -145,6 +146,12 @@ const knownBases = [ context: 8192, description: 'Insightful, big thinker, slower, pricey', }, + { + id: 'gpt-3.5-turbo-16k', + label: '3.5-Turbo-16k', + context: 16384, + description: 'Fair speed and smarts, large context', + }, { id: 'gpt-3.5-turbo', label: '3.5-Turbo', diff --git a/src/modules/llms/openai/openai.router.ts b/src/modules/llms/openai/openai.router.ts index f498c1406..a22ff2387 100644 --- a/src/modules/llms/openai/openai.router.ts +++ b/src/modules/llms/openai/openai.router.ts @@ -82,11 +82,18 @@ export const openAIRouter = createTRPCRouter({ // model that have '-0' in their name go at the end // if (a.id.includes('-0') && !b.id.includes('-0')) return 1; // if (!a.id.includes('-0') && b.id.includes('-0')) return -1; - const aCount = a.id.split('-').length; - const bCount = b.id.split('-').length; - if (aCount === bCount) - return b.id.localeCompare(a.id); - return aCount - bCount; + + // sort by the first 5 chars of id, decreasing, then by the number of '-' in the name + const aId = a.id.slice(0, 5); + const bId = b.id.slice(0, 5); + if (aId === bId) { + const aCount = a.id.split('-').length; + const bCount = b.id.split('-').length; + if (aCount === bCount) + return a.id.localeCompare(b.id); + return aCount - bCount; + } + return bId.localeCompare(aId); }); return llms; diff --git a/src/modules/llms/store-llms.ts b/src/modules/llms/store-llms.ts index d4eb598e7..53399eb99 100644 --- a/src/modules/llms/store-llms.ts +++ b/src/modules/llms/store-llms.ts @@ -132,7 +132,7 @@ export const useModelsStore = create()( const defaultChatSuffixPreference = ['gpt-4', 'gpt-4-32k', 'gpt-3.5-turbo']; -const defaultFastSuffixPreference = ['gpt-3.5-turbo']; +const defaultFastSuffixPreference = ['gpt-3.5-turbo-16k', 'gpt-3.5-turbo']; function findLlmIdBySuffix(llms: DLLM[], suffixes: string[]): DLLMId | null { if (!llms?.length) return null;