Skip to content

Title: Integration Issue with DALL-E 3 in an Asynchronous Telegram Bot Using Python #1248

@Um-nik123

Description

@Um-nik123

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

Hello OpenAI Community!

I'm working on an asynchronous Telegram bot in Python, utilizing the OpenAI API for generating text with the GPT-3.5 Turbo model. The text generation part is functioning smoothly, however, I've encountered difficulties when trying to add the capability to generate images using DALL-E 3.

I'm using the latest version of the openai library (installed via !pip install --upgrade openai), but my attempts to use openai.Completion or any related methods for DALL-E result in the following error:

To Reproduce

ERROR:main:Error processing message:

You tried to access openai.Completion, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.

You can run openai migrate to automatically upgrade your codebase to use the 1.0.0 interface.

Alternatively, you can pin your installation to the old version, e.g., pip install openai==0.28

A detailed migration guide is available here: #742

Code snippets

import openai

openai.api_key = 'my_openai_api_key'

# Example code that leads to the error
try:
    response = openai.Completion.create(
        engine="text-davinci-003",
        prompt="This is a test prompt.",
        temperature=0.7,
        max_tokens=150
    )
except Exception as e:
    print(f"Encountered an error: {e}")

OS

Google Colab

Python version

3.10.12

Library version

1.14.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions