I've tried to work around this a number of different ways but ultimately I don't think the loadApiProvider issue I was encountering below would even be necessary if I could just specify a function of my choosing for obtaining the bearer token for the Azure OpenAI request. The clientID + secret stuff is nice, but implementations are going to vary for some of this stuff in a deployed environment. Ours for instance leverages Workload Identity Federation between our Azure account and AWS so its not a simple client id and secret and keys aren't allowed for us either. We have a function that grabs the token that works successfully with our Azure endpoint but I don't have a great way to plug it into our deployed environment. The way I'd imagine this could work is if the authFn param is provided it circumvents the other logic and uses that function to provide the bearer token to the resource.
that way, you can include all the code you need to fetch the right tokens. You can reuse our provider to make the request to azure or do it yourself using their libraries or fetch.
d
dreamspider429528
03/27/2025, 3:12 PM
I tried working around this with a custom provider, but I can't easily pass this in as a string, the final package is minified and bundled and these filepath references are not being respected. Its a headache to figure out how to package this stuff differently for this to accommodate. If it was possible to pass in a function in the defaultTest.options.provider that would be an acceptable workaround.
dreamspider429528
03/27/2025, 3:14 PM
Added the detail around that issue here: https://discord.com/channels/1153767083381903389/1351686046999646300. The custom provider thing if we can get it working for this here is an acceptable workaround but given the only real difference I need is to inject an Authorization header I would love to reuse as much of the base code as possible here.