Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js: Support beta namespace for wrapOpenAI #1102

Open
jmoseley opened this issue Oct 16, 2024 · 2 comments
Open

js: Support beta namespace for wrapOpenAI #1102

jmoseley opened this issue Oct 16, 2024 · 2 comments

Comments

@jmoseley
Copy link

jmoseley commented Oct 16, 2024

Issue you'd like to raise.

For the JS SDK, I believe that the wrapOpenAI helper is failing to expose anything except parse on the beta chat completions resource.

The problem may have been introduced in this change, as it only happens after version 0.1.62.

This crops up as this error:

TypeError: openai.beta.chat.completions.runTools is not a function

I logged the resources and noticed that openai.beta.chat.completions is an object that only has parse as a member.

// console.log('wat', { openai, "oepnai.beta": openai?.beta, "openai.beta.chat": openai?.beta?.chat, "openai.beta.chat.completions": openai?.beta?.chat?.completions, "openai.beta.chat.completions.runTools": openai?.beta?.chat?.completions?.runTools })
  
wat {
  openai: {
    baseURL: 'https://api.openai.com/v1',
    maxRetries: 2,
    timeout: 600000,
    httpAgent: undefined,
    fetch: <ref *1> [Function: fetch] {
      isRedirect: [Function (anonymous)],
      Promise: [Function: Promise],
      default: [Circular *1],
      Headers: [class Headers],
      Request: [class Request],
      Response: [class Response],
      FetchError: [Function: FetchError],
      AbortError: [Function: AbortError]
    },
    completions: { _client: [OpenAI], create: [Function: traceableFunc] },
    chat: { _client: [OpenAI], completions: [Object] },
    embeddings: Embeddings { _client: [OpenAI] },
    files: Files { _client: [OpenAI] },
    images: Images { _client: [OpenAI] },
    audio: Audio {
      _client: [OpenAI],
      transcriptions: [Transcriptions],
      translations: [Translations],
      speech: [Speech]
    },
    moderations: Moderations { _client: [OpenAI] },
    models: Models { _client: [OpenAI] },
    fineTuning: FineTuning { _client: [OpenAI], jobs: [Jobs] },
    beta: {
      _client: [OpenAI],
      vectorStores: [VectorStores],
      chat: [Object],
      assistants: [Assistants],
      threads: [Threads]
    },
    batches: Batches { _client: [OpenAI] },
    uploads: Uploads { _client: [OpenAI], parts: [Parts] },
    _options: {
      apiKey: '[secret]',
      organization: null,
      project: null,
      baseURL: 'https://api.openai.com/v1'
    },
    apiKey: '[secret]',
    organization: null,
    project: null
  },
  "openai.beta": {
    _client: OpenAI {
      baseURL: 'https://api.openai.com/v1',
      maxRetries: 2,
      timeout: 600000,
      httpAgent: undefined,
      fetch: [Function],
      completions: [Completions],
      chat: [Chat],
      embeddings: [Embeddings],
      files: [Files],
      images: [Images],
      audio: [Audio],
      moderations: [Moderations],
      models: [Models],
      fineTuning: [FineTuning],
      beta: [Beta],
      batches: [Batches],
      uploads: [Uploads],
      _options: [Object],
      apiKey: '[secret]',
      organization: null,
      project: null
    },
    vectorStores: VectorStores {
      _client: [OpenAI],
      files: [Files],
      fileBatches: [FileBatches]
    },
    chat: { _client: [OpenAI], completions: [Object] },
    assistants: Assistants { _client: [OpenAI] },
    threads: Threads { _client: [OpenAI], runs: [Runs], messages: [Messages] }
  },
  "openai.beta.chat": {
    _client: OpenAI {
      baseURL: 'https://api.openai.com/v1',
      maxRetries: 2,
      timeout: 600000,
      httpAgent: undefined,
      fetch: [Function],
      completions: [Completions],
      chat: [Chat],
      embeddings: [Embeddings],
      files: [Files],
      images: [Images],
      audio: [Audio],
      moderations: [Moderations],
      models: [Models],
      fineTuning: [FineTuning],
      beta: [Beta],
      batches: [Batches],
      uploads: [Uploads],
      _options: [Object],
      apiKey: '[secret]',
      organization: null,
      project: null
    },
    completions: { _client: [OpenAI], parse: [Function: traceableFunc] }
  },
  "openai.beta.chat.completions": {
    _client: OpenAI {
      baseURL: 'https://api.openai.com/v1',
      maxRetries: 2,
      timeout: 600000,
      httpAgent: undefined,
      fetch: [Function],
      completions: [Completions],
      chat: [Chat],
      embeddings: [Embeddings],
      files: [Files],
      images: [Images],
      audio: [Audio],
      moderations: [Moderations],
      models: [Models],
      fineTuning: [FineTuning],
      beta: [Beta],
      batches: [Batches],
      uploads: [Uploads],
      _options: [Object],
      apiKey: '[secret]',
      organization: null,
      project: null
    },
    parse: [Function: traceableFunc]
  },
  "openai.beta.chat.completions.runTools": undefined
}

Suggestion:

No response

@jacoblee93
Copy link
Collaborator

Hey @jmoseley, having a look at this! Thanks for reporting!

@chulanpro5
Copy link

I tried downgrading to [email protected], and it worked!

@jacoblee93 jacoblee93 changed the title Issue: runTools is not a function js: Support beta namespace for wrapOpenAI Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants