Skip to content

Major types are not exposed in openai.types ChatCompletion, Response, ResponseUsage #2680

@ievgennaida

Description

@ievgennaida

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

I cannot use strict typing when library is used because not all types are avaliable in the typing.

Examples:

openai.types.CompletionUsage -> Exists

openai.types.ChatCompletion
openai.types.Response
openai.types.ResponseUsage

As a workaround next code can be used but it's not optimal:

resp.class.name == "ChatCompletion":

To Reproduce

import openai.types.ChatCompletion has no type in IDE

Code snippets

import openai.types.ChatCompletion


func test(a:openai.types.ChatCompletion ):
   pass

OS

win

Python version

3.11

Library version

openai 2.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions