Skip to content

Commit

Permalink
Merge pull request #4 from kromiii/model-as-env
Browse files Browse the repository at this point in the history
Specify GPT model as an environment variable
  • Loading branch information
Kazuhiko Yamashita authored Jun 9, 2024
2 parents c71a0e8 + fe3ae06 commit bad4a3e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions manifests/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ spec:
secretKeyRef:
name: slack-gpt
key: openai-secret
- name: GPT_MODEL
value: gpt-4o
- name: LANG
value: C.UTF-8
- name: BOT_USER_ID
Expand Down
3 changes: 2 additions & 1 deletion src/mention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const appMention: any = async ({ event, client, say }) => {
}

const nonNullable = <T>(value: T): value is NonNullable<T> => value != null
let model = 'gpt-4o'
let model = process.env.GPT_MODEL || 'gpt-4-turbo'
let max_tokens = null
const threadMessages = await Promise.all(
replies.messages.map(async (message) => {
Expand All @@ -38,6 +38,7 @@ export const appMention: any = async ({ event, client, say }) => {
}

if (encodedImage) {
model = 'gpt-4-vision-preview'
max_tokens = 4096
contents.push(
{
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (!apiKey) {
}
const openai = new OpenAI({ apiKey })

const GPT_MODEL = 'gpt-4-1106-preview'
const GPT_MODEL = process.env.GPT_MODEL || 'gpt-4-turbo'

const GPT_MAX_TOKEN = 128000

Expand Down

0 comments on commit bad4a3e

Please sign in to comment.