@botonic/plugin-ai-agents 0.45.0 → 0.46.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/agent-builder.d.ts +3 -0
- package/lib/cjs/agent-builder.js +7 -15
- package/lib/cjs/agent-builder.js.map +1 -1
- package/lib/cjs/bot-config-tools.d.ts +7 -0
- package/lib/cjs/bot-config-tools.js +19 -0
- package/lib/cjs/bot-config-tools.js.map +1 -0
- package/lib/cjs/constants.d.ts +2 -1
- package/lib/cjs/constants.js +3 -2
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/debug-logger.d.ts +2 -1
- package/lib/cjs/debug-logger.js +4 -14
- package/lib/cjs/debug-logger.js.map +1 -1
- package/lib/cjs/guardrails/input.d.ts +2 -1
- package/lib/cjs/guardrails/input.js +7 -2
- package/lib/cjs/guardrails/input.js.map +1 -1
- package/lib/cjs/hubtype-api-client.d.ts +2 -2
- package/lib/cjs/hubtype-api-client.js +4 -4
- package/lib/cjs/hubtype-api-client.js.map +1 -1
- package/lib/cjs/index.d.ts +4 -1
- package/lib/cjs/index.js +25 -12
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/llm-config.d.ts +15 -0
- package/lib/cjs/llm-config.js +66 -0
- package/lib/cjs/llm-config.js.map +1 -0
- package/lib/cjs/runner.d.ts +3 -1
- package/lib/cjs/runner.js +13 -3
- package/lib/cjs/runner.js.map +1 -1
- package/lib/esm/agent-builder.d.ts +3 -0
- package/lib/esm/agent-builder.js +7 -15
- package/lib/esm/agent-builder.js.map +1 -1
- package/lib/esm/bot-config-tools.d.ts +7 -0
- package/lib/esm/bot-config-tools.js +19 -0
- package/lib/esm/bot-config-tools.js.map +1 -0
- package/lib/esm/constants.d.ts +2 -1
- package/lib/esm/constants.js +3 -2
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/debug-logger.d.ts +2 -1
- package/lib/esm/debug-logger.js +4 -14
- package/lib/esm/debug-logger.js.map +1 -1
- package/lib/esm/guardrails/input.d.ts +2 -1
- package/lib/esm/guardrails/input.js +7 -2
- package/lib/esm/guardrails/input.js.map +1 -1
- package/lib/esm/hubtype-api-client.d.ts +2 -2
- package/lib/esm/hubtype-api-client.js +4 -4
- package/lib/esm/hubtype-api-client.js.map +1 -1
- package/lib/esm/index.d.ts +4 -1
- package/lib/esm/index.js +25 -12
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/llm-config.d.ts +15 -0
- package/lib/esm/llm-config.js +66 -0
- package/lib/esm/llm-config.js.map +1 -0
- package/lib/esm/runner.d.ts +3 -1
- package/lib/esm/runner.js +13 -3
- package/lib/esm/runner.js.map +1 -1
- package/package.json +4 -3
- package/src/agent-builder.ts +19 -19
- package/src/bot-config-tools.ts +21 -0
- package/src/constants.ts +3 -2
- package/src/debug-logger.ts +7 -27
- package/src/guardrails/input.ts +13 -4
- package/src/hubtype-api-client.ts +4 -4
- package/src/index.ts +45 -14
- package/src/llm-config.ts +96 -0
- package/src/runner.ts +24 -4
- package/lib/cjs/openai.d.ts +0 -1
- package/lib/cjs/openai.js +0 -39
- package/lib/cjs/openai.js.map +0 -1
- package/lib/esm/openai.d.ts +0 -1
- package/lib/esm/openai.js +0 -39
- package/lib/esm/openai.js.map +0 -1
- package/src/openai.ts +0 -49
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { VerbosityLevel } from '@botonic/core'
|
|
2
|
+
import {
|
|
3
|
+
type ModelProvider,
|
|
4
|
+
type ModelSettings,
|
|
5
|
+
OpenAIProvider,
|
|
6
|
+
} from '@openai/agents'
|
|
7
|
+
import OpenAI, { AzureOpenAI } from 'openai'
|
|
8
|
+
import {
|
|
9
|
+
AZURE_OPENAI_API_BASE,
|
|
10
|
+
AZURE_OPENAI_API_KEY,
|
|
11
|
+
AZURE_OPENAI_API_VERSION,
|
|
12
|
+
isProd,
|
|
13
|
+
OPENAI_API_KEY,
|
|
14
|
+
OPENAI_MODEL,
|
|
15
|
+
OPENAI_PROVIDER,
|
|
16
|
+
} from './constants'
|
|
17
|
+
|
|
18
|
+
export class LLMConfig {
|
|
19
|
+
private readonly maxRetries: number
|
|
20
|
+
private readonly timeout: number
|
|
21
|
+
public readonly modelName: string
|
|
22
|
+
public readonly modelSettings: ModelSettings
|
|
23
|
+
public readonly modelProvider: ModelProvider
|
|
24
|
+
|
|
25
|
+
constructor(
|
|
26
|
+
maxRetries: number,
|
|
27
|
+
timeout: number,
|
|
28
|
+
modelName: string,
|
|
29
|
+
verbosity: VerbosityLevel
|
|
30
|
+
) {
|
|
31
|
+
this.maxRetries = maxRetries
|
|
32
|
+
this.timeout = timeout
|
|
33
|
+
this.modelName = OPENAI_PROVIDER === 'openai' ? OPENAI_MODEL : modelName
|
|
34
|
+
this.modelProvider = this.getModelProvider()
|
|
35
|
+
this.modelSettings = this.getModelSettings(modelName, verbosity)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private getModelProvider(): ModelProvider {
|
|
39
|
+
const client = this.getClient()
|
|
40
|
+
return new OpenAIProvider({
|
|
41
|
+
openAIClient: client,
|
|
42
|
+
useResponses: false,
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private getClient(): OpenAI | AzureOpenAI {
|
|
47
|
+
if (OPENAI_PROVIDER === 'openai') {
|
|
48
|
+
return this.getOpenAIClient()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return this.getAzureClient()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private getOpenAIClient(): OpenAI {
|
|
55
|
+
return new OpenAI({
|
|
56
|
+
apiKey: OPENAI_API_KEY,
|
|
57
|
+
timeout: this.timeout,
|
|
58
|
+
maxRetries: this.maxRetries,
|
|
59
|
+
dangerouslyAllowBrowser: !isProd,
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private getAzureClient(): AzureOpenAI {
|
|
64
|
+
return new AzureOpenAI({
|
|
65
|
+
apiKey: AZURE_OPENAI_API_KEY,
|
|
66
|
+
apiVersion: AZURE_OPENAI_API_VERSION,
|
|
67
|
+
deployment: this.modelName,
|
|
68
|
+
baseURL: AZURE_OPENAI_API_BASE,
|
|
69
|
+
timeout: this.timeout,
|
|
70
|
+
maxRetries: this.maxRetries,
|
|
71
|
+
dangerouslyAllowBrowser: !isProd,
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private getModelSettings(
|
|
76
|
+
model: string,
|
|
77
|
+
verbosity: VerbosityLevel
|
|
78
|
+
): ModelSettings {
|
|
79
|
+
if (model.includes('gpt-5')) {
|
|
80
|
+
return {
|
|
81
|
+
reasoning: { effort: 'none' },
|
|
82
|
+
temperature: 1,
|
|
83
|
+
text: { verbosity },
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (model.includes('gpt-4')) {
|
|
88
|
+
return {
|
|
89
|
+
temperature: 0,
|
|
90
|
+
text: { verbosity },
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
throw new Error(`Unsupported model: ${model}`)
|
|
95
|
+
}
|
|
96
|
+
}
|
package/src/runner.ts
CHANGED
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
RunToolCallItem,
|
|
10
10
|
RunToolCallOutputItem,
|
|
11
11
|
} from '@openai/agents'
|
|
12
|
-
|
|
12
|
+
import { OPENAI_PROVIDER } from './constants'
|
|
13
13
|
import type { DebugLogger } from './debug-logger'
|
|
14
|
+
import type { LLMConfig } from './llm-config'
|
|
14
15
|
import { retrieveKnowledge } from './tools'
|
|
15
16
|
import type {
|
|
16
17
|
AgenticInputMessage,
|
|
@@ -35,9 +36,15 @@ export class AIAgentRunner<
|
|
|
35
36
|
> {
|
|
36
37
|
private agent: AIAgent<TPlugins, TExtraData>
|
|
37
38
|
private logger: DebugLogger
|
|
39
|
+
private llmConfig: LLMConfig
|
|
38
40
|
|
|
39
|
-
constructor(
|
|
41
|
+
constructor(
|
|
42
|
+
agent: AIAgent<TPlugins, TExtraData>,
|
|
43
|
+
openAiClient: LLMConfig,
|
|
44
|
+
logger: DebugLogger
|
|
45
|
+
) {
|
|
40
46
|
this.agent = agent
|
|
47
|
+
this.llmConfig = openAiClient
|
|
41
48
|
this.logger = logger
|
|
42
49
|
}
|
|
43
50
|
|
|
@@ -47,11 +54,24 @@ export class AIAgentRunner<
|
|
|
47
54
|
): Promise<RunResult> {
|
|
48
55
|
const startTime = Date.now()
|
|
49
56
|
|
|
50
|
-
this.logger.logRunnerStart(
|
|
57
|
+
this.logger.logRunnerStart(
|
|
58
|
+
this.llmConfig.modelName,
|
|
59
|
+
this.llmConfig.modelSettings
|
|
60
|
+
)
|
|
51
61
|
|
|
52
62
|
try {
|
|
63
|
+
const modelProvider = this.llmConfig.modelProvider
|
|
64
|
+
const modelSettings = this.llmConfig.modelSettings
|
|
65
|
+
|
|
66
|
+
const hasRetrieveKnowledge = this.agent.tools.includes(retrieveKnowledge)
|
|
67
|
+
if (hasRetrieveKnowledge && OPENAI_PROVIDER === 'azure') {
|
|
68
|
+
modelSettings.toolChoice = retrieveKnowledge.name
|
|
69
|
+
}
|
|
70
|
+
|
|
53
71
|
const runner = new Runner({
|
|
54
|
-
modelSettings
|
|
72
|
+
modelSettings,
|
|
73
|
+
modelProvider,
|
|
74
|
+
tracingDisabled: true,
|
|
55
75
|
})
|
|
56
76
|
// Type assertion to bypass strict type checking - the actual return type from runner.run()
|
|
57
77
|
// doesn't perfectly match our interface, but the properties we access are compatible
|
package/lib/cjs/openai.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function setUpOpenAI(maxRetries?: number, timeout?: number): void;
|
package/lib/cjs/openai.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setUpOpenAI = setUpOpenAI;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const agents_1 = require("@openai/agents");
|
|
6
|
-
const openai_1 = tslib_1.__importStar(require("openai"));
|
|
7
|
-
const constants_1 = require("./constants");
|
|
8
|
-
function setUpOpenAI(maxRetries, timeout) {
|
|
9
|
-
if (constants_1.OPENAI_PROVIDER === 'azure') {
|
|
10
|
-
setAzureOpenAIClient(maxRetries, timeout);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
setOpenAIClient(maxRetries, timeout);
|
|
14
|
-
}
|
|
15
|
-
(0, agents_1.setOpenAIAPI)('chat_completions');
|
|
16
|
-
(0, agents_1.setTracingDisabled)(true);
|
|
17
|
-
}
|
|
18
|
-
function setOpenAIClient(maxRetries, timeout) {
|
|
19
|
-
const client = new openai_1.default({
|
|
20
|
-
apiKey: constants_1.OPENAI_API_KEY,
|
|
21
|
-
timeout: timeout || 16000, // 16 seconds
|
|
22
|
-
maxRetries: maxRetries || 2,
|
|
23
|
-
dangerouslyAllowBrowser: !constants_1.isProd,
|
|
24
|
-
});
|
|
25
|
-
(0, agents_1.setDefaultOpenAIClient)(client);
|
|
26
|
-
}
|
|
27
|
-
function setAzureOpenAIClient(maxRetries, timeout) {
|
|
28
|
-
const client = new openai_1.AzureOpenAI({
|
|
29
|
-
apiKey: constants_1.AZURE_OPENAI_API_KEY,
|
|
30
|
-
apiVersion: constants_1.AZURE_OPENAI_API_VERSION,
|
|
31
|
-
deployment: constants_1.AZURE_OPENAI_API_DEPLOYMENT_NAME,
|
|
32
|
-
baseURL: constants_1.AZURE_OPENAI_API_BASE,
|
|
33
|
-
timeout: timeout || 16000, // 16 seconds
|
|
34
|
-
maxRetries: maxRetries || 2,
|
|
35
|
-
dangerouslyAllowBrowser: !constants_1.isProd,
|
|
36
|
-
});
|
|
37
|
-
(0, agents_1.setDefaultOpenAIClient)(client);
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=openai.js.map
|
package/lib/cjs/openai.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/openai.ts"],"names":[],"mappings":";;AAiBA,kCAQC;;AAzBD,2CAIuB;AACvB,yDAA4C;AAE5C,2CAQoB;AAEpB,SAAgB,WAAW,CAAC,UAAmB,EAAE,OAAgB;IAC/D,IAAI,2BAAe,KAAK,OAAO,EAAE,CAAC;QAChC,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;SAAM,CAAC;QACN,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACtC,CAAC;IACD,IAAA,qBAAY,EAAC,kBAAkB,CAAC,CAAA;IAChC,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,eAAe,CAAC,UAAmB,EAAE,OAAgB;IAC5D,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC;QACxB,MAAM,EAAE,0BAAc;QACtB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,aAAa;QACxC,UAAU,EAAE,UAAU,IAAI,CAAC;QAC3B,uBAAuB,EAAE,CAAC,kBAAM;KACjC,CAAC,CAAA;IACF,IAAA,+BAAsB,EAAC,MAAM,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,oBAAoB,CAAC,UAAmB,EAAE,OAAgB;IACjE,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC;QAC7B,MAAM,EAAE,gCAAoB;QAC5B,UAAU,EAAE,oCAAwB;QACpC,UAAU,EAAE,4CAAgC;QAC5C,OAAO,EAAE,iCAAqB;QAC9B,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,aAAa;QACxC,UAAU,EAAE,UAAU,IAAI,CAAC;QAC3B,uBAAuB,EAAE,CAAC,kBAAM;KACjC,CAAC,CAAA;IACF,IAAA,+BAAsB,EAAC,MAAM,CAAC,CAAA;AAChC,CAAC"}
|
package/lib/esm/openai.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function setUpOpenAI(maxRetries?: number, timeout?: number): void;
|
package/lib/esm/openai.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setUpOpenAI = setUpOpenAI;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const agents_1 = require("@openai/agents");
|
|
6
|
-
const openai_1 = tslib_1.__importStar(require("openai"));
|
|
7
|
-
const constants_1 = require("./constants");
|
|
8
|
-
function setUpOpenAI(maxRetries, timeout) {
|
|
9
|
-
if (constants_1.OPENAI_PROVIDER === 'azure') {
|
|
10
|
-
setAzureOpenAIClient(maxRetries, timeout);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
setOpenAIClient(maxRetries, timeout);
|
|
14
|
-
}
|
|
15
|
-
(0, agents_1.setOpenAIAPI)('chat_completions');
|
|
16
|
-
(0, agents_1.setTracingDisabled)(true);
|
|
17
|
-
}
|
|
18
|
-
function setOpenAIClient(maxRetries, timeout) {
|
|
19
|
-
const client = new openai_1.default({
|
|
20
|
-
apiKey: constants_1.OPENAI_API_KEY,
|
|
21
|
-
timeout: timeout || 16000, // 16 seconds
|
|
22
|
-
maxRetries: maxRetries || 2,
|
|
23
|
-
dangerouslyAllowBrowser: !constants_1.isProd,
|
|
24
|
-
});
|
|
25
|
-
(0, agents_1.setDefaultOpenAIClient)(client);
|
|
26
|
-
}
|
|
27
|
-
function setAzureOpenAIClient(maxRetries, timeout) {
|
|
28
|
-
const client = new openai_1.AzureOpenAI({
|
|
29
|
-
apiKey: constants_1.AZURE_OPENAI_API_KEY,
|
|
30
|
-
apiVersion: constants_1.AZURE_OPENAI_API_VERSION,
|
|
31
|
-
deployment: constants_1.AZURE_OPENAI_API_DEPLOYMENT_NAME,
|
|
32
|
-
baseURL: constants_1.AZURE_OPENAI_API_BASE,
|
|
33
|
-
timeout: timeout || 16000, // 16 seconds
|
|
34
|
-
maxRetries: maxRetries || 2,
|
|
35
|
-
dangerouslyAllowBrowser: !constants_1.isProd,
|
|
36
|
-
});
|
|
37
|
-
(0, agents_1.setDefaultOpenAIClient)(client);
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=openai.js.map
|
package/lib/esm/openai.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/openai.ts"],"names":[],"mappings":";;AAiBA,kCAQC;;AAzBD,2CAIuB;AACvB,yDAA4C;AAE5C,2CAQoB;AAEpB,SAAgB,WAAW,CAAC,UAAmB,EAAE,OAAgB;IAC/D,IAAI,2BAAe,KAAK,OAAO,EAAE,CAAC;QAChC,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;SAAM,CAAC;QACN,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACtC,CAAC;IACD,IAAA,qBAAY,EAAC,kBAAkB,CAAC,CAAA;IAChC,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,eAAe,CAAC,UAAmB,EAAE,OAAgB;IAC5D,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC;QACxB,MAAM,EAAE,0BAAc;QACtB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,aAAa;QACxC,UAAU,EAAE,UAAU,IAAI,CAAC;QAC3B,uBAAuB,EAAE,CAAC,kBAAM;KACjC,CAAC,CAAA;IACF,IAAA,+BAAsB,EAAC,MAAM,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,oBAAoB,CAAC,UAAmB,EAAE,OAAgB;IACjE,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC;QAC7B,MAAM,EAAE,gCAAoB;QAC5B,UAAU,EAAE,oCAAwB;QACpC,UAAU,EAAE,4CAAgC;QAC5C,OAAO,EAAE,iCAAqB;QAC9B,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,aAAa;QACxC,UAAU,EAAE,UAAU,IAAI,CAAC;QAC3B,uBAAuB,EAAE,CAAC,kBAAM;KACjC,CAAC,CAAA;IACF,IAAA,+BAAsB,EAAC,MAAM,CAAC,CAAA;AAChC,CAAC"}
|
package/src/openai.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
setDefaultOpenAIClient,
|
|
3
|
-
setOpenAIAPI,
|
|
4
|
-
setTracingDisabled,
|
|
5
|
-
} from '@openai/agents'
|
|
6
|
-
import OpenAI, { AzureOpenAI } from 'openai'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
AZURE_OPENAI_API_BASE,
|
|
10
|
-
AZURE_OPENAI_API_DEPLOYMENT_NAME,
|
|
11
|
-
AZURE_OPENAI_API_KEY,
|
|
12
|
-
AZURE_OPENAI_API_VERSION,
|
|
13
|
-
isProd,
|
|
14
|
-
OPENAI_API_KEY,
|
|
15
|
-
OPENAI_PROVIDER,
|
|
16
|
-
} from './constants'
|
|
17
|
-
|
|
18
|
-
export function setUpOpenAI(maxRetries?: number, timeout?: number) {
|
|
19
|
-
if (OPENAI_PROVIDER === 'azure') {
|
|
20
|
-
setAzureOpenAIClient(maxRetries, timeout)
|
|
21
|
-
} else {
|
|
22
|
-
setOpenAIClient(maxRetries, timeout)
|
|
23
|
-
}
|
|
24
|
-
setOpenAIAPI('chat_completions')
|
|
25
|
-
setTracingDisabled(true)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function setOpenAIClient(maxRetries?: number, timeout?: number) {
|
|
29
|
-
const client = new OpenAI({
|
|
30
|
-
apiKey: OPENAI_API_KEY,
|
|
31
|
-
timeout: timeout || 16000, // 16 seconds
|
|
32
|
-
maxRetries: maxRetries || 2,
|
|
33
|
-
dangerouslyAllowBrowser: !isProd,
|
|
34
|
-
})
|
|
35
|
-
setDefaultOpenAIClient(client)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function setAzureOpenAIClient(maxRetries?: number, timeout?: number) {
|
|
39
|
-
const client = new AzureOpenAI({
|
|
40
|
-
apiKey: AZURE_OPENAI_API_KEY,
|
|
41
|
-
apiVersion: AZURE_OPENAI_API_VERSION,
|
|
42
|
-
deployment: AZURE_OPENAI_API_DEPLOYMENT_NAME,
|
|
43
|
-
baseURL: AZURE_OPENAI_API_BASE,
|
|
44
|
-
timeout: timeout || 16000, // 16 seconds
|
|
45
|
-
maxRetries: maxRetries || 2,
|
|
46
|
-
dangerouslyAllowBrowser: !isProd,
|
|
47
|
-
})
|
|
48
|
-
setDefaultOpenAIClient(client)
|
|
49
|
-
}
|