Skip to content

Commit

Permalink
add option to pass API basepath
Browse files Browse the repository at this point in the history
  • Loading branch information
Zdravko Bozakov authored and yGuy committed Feb 17, 2024
1 parent c6e5471 commit df2bfe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ or when [running the docker image](#using-the-ready-made-docker-image) or when c
| MATTERMOST_URL | yes | `https://mattermost.server` | The URL to the server. This is used for connecting the bot to the Mattermost API |
| MATTERMOST_TOKEN | yes | `abababacdcdcd` | The authentication token from the logged in mattermost bot |
| OPENAI_API_KEY | yes | `sk-234234234234234234` | The OpenAI API key to authenticate with OpenAI |
| 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`) |
| OPENAI_MODEL_NAME | no | `gpt-3.5-turbo` | The OpenAI language model to use, defaults to `gpt-3.5-turbo` |
| OPENAI_MAX_TOKENS | no | `2000` | The maximum number of tokens to pass to the OpenAI API, defaults to 2000 |
| 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. |
Expand Down
5 changes: 3 additions & 2 deletions src/openai-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import {PluginBase} from "./plugins/PluginBase";
import {AiResponse, MessageData} from "./types";

const apiKey = process.env['OPENAI_API_KEY'];
log.trace({apiKey})
const basePath = process.env['OPENAI_API_BASE'];
log.trace({apiKey, basePath})

const configuration = new Configuration({ apiKey })
const configuration = new Configuration({ apiKey, basePath })

const openai = new OpenAIApi(configuration)

Expand Down

0 comments on commit df2bfe2

Please sign in to comment.