Closed tecton closed 1 month ago
Hi @tecton,
Are you using a sample from Teams Toolkit? If so, please file the issue with them here instead
Hi @lilyydu,
The root cause of this bug is that azureApiKey
is passed to the constructor of OpenAIModel
link. While in teams-ai library, it checks 'azureApiKey' in options
. In this case, azureApiKey is undefined but still executes the 'trim()' function.
It should either check the azureApiKey is not empty string or avoid passing azureApiKey
in constructor.
Hi @tecton,
The trim is only called if the azureApiKey
or azureADTokenProvider
exists. If you are using OAI instead, you will need to provide the appropriate keys, and comment this section out.
Hi @lilyydu,
Yes, I mean there's a bug that trim() is called even if azureApiKey
doesn't exist. I'm using OpenAI instead of Azure Open AI service, but the sample shows the error: Cannot read properties of undefined (reading 'trim'). Could you please help to fix it?
Hi @tecton,
trim()
is only called if azureApiKey
or azureADTokenProvider
are filled in- if you are using OAI, both of these need to be commented out. Can you confirm you have tried this?
@lilyydu Commenting out Azure related lines is working. I'll create a PR to update README.
Language
Javascript/Typescript
Version
latest
Description
Local debug cannot start and shows the following error: [nodemon] 3.0.3 [nodemon] to restart at any time, enter (\src\index.ts:84:15)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module.m._compile (node_modules\ts-node\src\index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Object.require.extensions. [as .ts] (node_modules\ts-node\src\index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Function.Module._load (node:internal/modules/cjs/loader:1022:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49
[nodemon] app crashed - waiting for file changes before starting...
rs
[nodemon] watching path(s): src*\ [nodemon] watching extensions: ts,json [nodemon] startingnode --inspect=9239 -r ts-node/register ./src/index.ts
Debugger listening on ws://127.0.0.1:9239/xxxx For help, see: https://nodejs.org/en/docs/inspector TypeError: Cannot read properties of undefined (reading 'trim') at new OpenAIModel (node_modules\@microsoft\teams-ai\src\models\OpenAIModel.ts:192:55) at Object.Reproduction Steps