Skip to content

Commit df2bfe2

Browse files
Zdravko BozakovyGuy
Zdravko Bozakov
authored andcommitted
add option to pass API basepath
1 parent c6e5471 commit df2bfe2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ or when [running the docker image](#using-the-ready-made-docker-image) or when c
2727
| MATTERMOST_URL | yes | `https://mattermost.server` | The URL to the server. This is used for connecting the bot to the Mattermost API |
2828
| MATTERMOST_TOKEN | yes | `abababacdcdcd` | The authentication token from the logged in mattermost bot |
2929
| OPENAI_API_KEY | yes | `sk-234234234234234234` | The OpenAI API key to authenticate with OpenAI |
30+
| OPENAI_API_BASE | no | `http://example.com:8080/v1` | The address of an OpenAI compatible API. Overrides the default base path (`https://api.openai.com`) |
3031
| OPENAI_MODEL_NAME | no | `gpt-3.5-turbo` | The OpenAI language model to use, defaults to `gpt-3.5-turbo` |
3132
| OPENAI_MAX_TOKENS | no | `2000` | The maximum number of tokens to pass to the OpenAI API, defaults to 2000 |
3233
| OPENAI_TEMPERATURE | no | `0.2` | The sampling temperature to use, between 0 and 2, defaults to 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. |

src/openai-wrapper.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import {PluginBase} from "./plugins/PluginBase";
1111
import {AiResponse, MessageData} from "./types";
1212

1313
const apiKey = process.env['OPENAI_API_KEY'];
14-
log.trace({apiKey})
14+
const basePath = process.env['OPENAI_API_BASE'];
15+
log.trace({apiKey, basePath})
1516

16-
const configuration = new Configuration({ apiKey })
17+
const configuration = new Configuration({ apiKey, basePath })
1718

1819
const openai = new OpenAIApi(configuration)
1920

0 commit comments

Comments
 (0)