Skip to content

Commit

Permalink
GPT model list
Browse files Browse the repository at this point in the history
  • Loading branch information
rpggio committed Feb 9, 2024
1 parent 3be2afc commit a89d85e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 22 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "chat-stream",
"name": "Chat Stream",
"version": "1.4.4",
"version": "1.4.5",
"minAppVersion": "1.1.10",
"description": "Create branching GPT chats using canvas notes.",
"author": "Ryan P Smith",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-chat-stream",
"version": "1.4.",
"version": "1.4.5",
"description": "Create branching GPT chats using Obsidian canvas",
"main": "src/main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/noteGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export function noteGenerator(
}

function getTokenLimit(settings: ChatStreamSettings) {
const model = chatModelByName(settings.apiModel) || CHAT_MODELS.GPT35
const model = chatModelByName(settings.apiModel) || CHAT_MODELS.GPT_35_TURBO_0125
return settings.maxInputTokens
? Math.min(settings.maxInputTokens, model.tokenLimit)
: model.tokenLimit
Expand Down
58 changes: 41 additions & 17 deletions src/openai/chatGPT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,53 @@ import { openai } from './chatGPT-types'
export const OPENAI_COMPLETIONS_URL = `https://api.openai.com/v1/chat/completions`

export const CHAT_MODELS = {
GPT35: {
GPT_35_TURBO: {
name: 'gpt-3.5-turbo',
tokenLimit: 4096
},
GPT35_16K: {
GPT_35_TURBO_0125: {
name: 'gpt-3.5-turbo-0125',
tokenLimit: 16385
},
GPT_35_16K: {
name: 'gpt-3.5-turbo-16k',
tokenLimit: 16384
tokenLimit: 16385
},
GPT_35_TURBO_1106: {
name: 'gpt-3.5-turbo-1106',
tokenLimit: 16385
},
GPT4: {
GPT_4: {
name: 'gpt-4',
tokenLimit: 8000
tokenLimit: 8192
},
GPT_4_TURBO_PREVIEW: {
name: 'gpt-4-turbo-preview',
tokenLimit: 128000
},
GPT_4_0125_PREVIEW: {
name: 'gpt-4-0125-preview',
tokenLimit: 128000
},
GPT_4_1106_PREVIEW: {
name: 'gpt-4-1106-preview',
tokenLimit: 128000
},
GPT4_32K: {
GPT_4_0613: {
name: 'gpt-4-0613',
tokenLimit: 8192
},
GPT_4_32K: {
name: 'gpt-4-32k',
tokenLimit: 32768
},
GPT_4_32K_0613: {
name: 'gpt-4-32k-0613',
tokenLimit: 32768
}
}
} as const

export type ChatGPTModel = typeof CHAT_MODELS.GPT35 | typeof CHAT_MODELS.GPT4
export type ChatGPTModel = keyof typeof CHAT_MODELS

export type ChatGPTModelType = keyof typeof CHAT_MODELS

Expand All @@ -35,15 +59,15 @@ export function chatModelByName(name: string) {
}

export const defaultChatGPTSettings: Partial<openai.CreateChatCompletionRequest> =
{
model: CHAT_MODELS.GPT35.name,
max_tokens: 500,
temperature: 0,
top_p: 1.0,
presence_penalty: 0,
frequency_penalty: 0,
stop: []
}
{
model: CHAT_MODELS.GPT_35_TURBO.name,
max_tokens: 500,
temperature: 0,
top_p: 1.0,
presence_penalty: 0,
frequency_penalty: 0,
stop: []
}

export async function getChatGPTCompletion(
apiKey: string,
Expand Down
2 changes: 1 addition & 1 deletion src/settings/ChatStreamSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Use step-by-step reasoning. Be brief.
export const DEFAULT_SETTINGS: ChatStreamSettings = {
apiKey: '',
apiUrl: OPENAI_COMPLETIONS_URL,
apiModel: CHAT_MODELS.GPT35.name,
apiModel: CHAT_MODELS.GPT_35_TURBO.name,
temperature: 1,
systemPrompt: DEFAULT_SYSTEM_PROMPT,
debug: false,
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"1.3.2": "1.1.10",
"1.3.3": "1.1.10",
"1.4.3": "1.1.10",
"1.4.4": "1.1.10"
"1.4.4": "1.1.10",
"1.4.5": "1.1.10"
}

0 comments on commit a89d85e

Please sign in to comment.