protected init()

in packages/instrumentation-openai/src/instrumentation.ts [86:113]


  protected init() {
    return [
      new InstrumentationNodeModuleDefinition(
        'openai',
        ['>=4.19.0 <5'],
        (modExports, modVer) => {
          debug(
            'instrument openai@%s (isESM=%s), config=%o',
            modVer,
            modExports[Symbol.toStringTag] === 'Module',
            this.getConfig()
          );
          this._wrap(
            modExports.OpenAI.Chat.Completions.prototype,
            'create',
            this._getPatchedChatCompletionsCreate()
          );
          this._wrap(
            modExports.OpenAI.Embeddings.prototype,
            'create',
            this._getPatchedEmbeddingsCreate()
          );

          return modExports;
        }
      ),
    ];
  }