Closed
Description
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library
Describe the bug
Referenced previously here, closed without resolution: #903
This is a pretty big issue as it prevents usage of the SDK while using the latest Sentry monitoring package.
To Reproduce
- Install Sentry Node sdk via
npm i @sentry/node --save
- Enter the following code;
import * as Sentry from '@sentry/node';
// Start Sentry
Sentry.init({
dsn: "https://your-sentry-url",
environment: "your-env",
tracesSampleRate: 1.0, // Capture 100% of the transactions
});
- Try to create a completion somewhere in the process after Sentry has been initialized:
const params = {
model: model,
stream: true,
stream_options: {
include_usage: true
},
messages
};
const completion = await openai.chat.completions.create(params);
Results in error:
TypeError: getDefaultAgent is not a function
at OpenAI.buildRequest (file:///my-project/node_modules/openai/core.mjs:208:66)
at OpenAI.makeRequest (file:///my-project/node_modules/openai/core.mjs:279:44)
Code snippets
(Included)
OS
All operating systems (macOS, Linux)
Node version
v20.10.0
Library version
v4.56.0