Skip to content

Commit

Permalink
allow to change model (#41)
Browse files Browse the repository at this point in the history
Add env variable to change the model. Tested on with
`gpt-3.5-turbo-1106` since I don't have access to GPT4 API.

This was the fastest way to change it by the user, since most users are
developers I think it's ok to use env variable, since you also don't
have UI to change the API Key.
  • Loading branch information
jcubic authored Nov 9, 2023
1 parent 34c484d commit 0e1d9eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ For OpenAI account:
| ------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------ |
| OPENAI_API_BASE_URL | Use if you plan to use a reverse proxy for `api.openai.com`. | `https://api.openai.com` |
| OPENAI_API_KEY | Secret key string obtained from the [OpenAI API website](https://platform.openai.com/account/api-keys). |
| OPENAI_MODEL | Model of GPT used | `gpt-3.5-turbo` |

For Azure OpenAI account:

Expand Down
2 changes: 1 addition & 1 deletion app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const getApiConfig = () => {
}
apiUrl = `${apiBaseUrl}/v1/chat/completions`
apiKey = process.env.OPENAI_API_KEY || ''
model = 'gpt-3.5-turbo' // todo: allow this to be passed through from client and support gpt-4
model = process.env.OPENAI_MODEL || 'gpt-3.5-turbo'
}

return { apiUrl, apiKey, model }
Expand Down

0 comments on commit 0e1d9eb

Please sign in to comment.