-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f74be96
commit d16133a
Showing
7 changed files
with
31 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import OpenAI, { ClientOptions } from 'openai'; | ||
import OpenAI, { ClientOptions } from 'openai' | ||
|
||
export const createOpenAIClient = (opts:ClientOptions={}): OpenAI => { | ||
return new OpenAI(opts); | ||
}; | ||
export const createOpenAIClient = (opts: ClientOptions = {}): OpenAI => { | ||
return new OpenAI(opts) | ||
} | ||
|
||
let _defaultOpenAIClient: OpenAI = undefined | ||
let _defaultOpenAIClient: OpenAI | undefined = undefined | ||
export const getDefaultOpenAIClient = (): OpenAI => { | ||
if(!_defaultOpenAIClient) { | ||
_defaultOpenAIClient=createOpenAIClient() | ||
} | ||
return _defaultOpenAIClient | ||
} | ||
if (!_defaultOpenAIClient) { | ||
_defaultOpenAIClient = createOpenAIClient() | ||
} | ||
return _defaultOpenAIClient | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters