Skip to content

Commit

Permalink
chore: update ChatGPTAPI constructor init for typedoc
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Mar 2, 2023
1 parent ad3d1f9 commit 48cb944
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/chatgpt-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as tokenizer from './tokenizer'
import * as types from './types'
import { fetch as globalFetch } from './fetch'
import { fetchSSE } from './fetch-sse'
import { ChatGPTAPIOptions } from './types'

const CHATGPT_MODEL = 'gpt-3.5-turbo'

Expand Down Expand Up @@ -47,19 +46,21 @@ export class ChatGPTAPI {
* @param upsertMessage - Optional function to insert or update a message. If not provided, the default implementation will be used (using an in-memory `messageStore`).
* @param fetch - Optional override for the `fetch` implementation to use. Defaults to the global `fetch` function.
*/
constructor({
apiKey,
apiBaseUrl = 'https://api.openai.com',
debug = false,
messageStore,
completionParams,
systemMessage,
maxModelTokens = 4096,
maxResponseTokens = 1000,
getMessageById,
upsertMessage,
fetch = globalFetch
}: ChatGPTAPIOptions) {
constructor(opts: types.ChatGPTAPIOptions) {
const {
apiKey,
apiBaseUrl = 'https://api.openai.com',
debug = false,
messageStore,
completionParams,
systemMessage,
maxModelTokens = 4096,
maxResponseTokens = 1000,
getMessageById,
upsertMessage,
fetch = globalFetch
} = opts

this._apiKey = apiKey
this._apiBaseUrl = apiBaseUrl
this._debug = !!debug
Expand Down

0 comments on commit 48cb944

Please sign in to comment.