Skip to content
← Back to activity

Public problem

weave.monitoring.openai ignores openai.api_key (requires kwarg)

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Using the Weave OpenAI monitor (weave.monitoring.openai) with the documented auth style openai."YOUR API KEY") fails: the wrapper raises KeyError: 'api_key' and then AuthenticationError: No API key provided, even though the key is set. Passing `"YOUR API KEY" explicitly as a kwarg to ChatCompletion.create works around it.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Weave's openai monitor wrapper only picked up the credentials when passed as an explicit kwarg; openai.credential = ... (the documented OpenAI SDK behavior) was ignored. This was addressed in a later Weave release (maintainer confirmed 2024-04-30). Upgrade to the latest weave version.

Source: https://github.com/wandb/weave/issues/664