SOLVED - Module 'openai' has no attribute 'answers'

After successful work with the answers endpoint via curl, I tried to code the same experience with python.

The code is like this:

answers = openai.answers.create(question=prompt,file='file-xxxxxxxxxxxxxx,search_model='ada',model='curie',examples_context='In 2017, U.S. life expectancy was 78.6 years.',examples=[['What is human life expectancy in the United States?','based on the data, it is about 79 years. Still, there is some room for improvement.']],stop=stop)
        return answers

however, when I run the code, it returns the following error:

AttributeError: module 'openai' has no attribute 'answers'

Any idea how to fix this?


I realized that it’s the “Answer” not “answers”.
The correct code is here:

answers = openai.Answer.create(...)