Get error while using file for the purpose of “answering” questions

I run the following code first I create jsonl file then upload by this code
response = openai.File.create(



and get the file id but I got error in the following code
question=“which puppy is happy?”,
examples_context=“In 2017, U.S. life expectancy was 78.6 years.”,
examples=[[“What is human life expectancy in the United States?”, “78 years.”]],
stop=[“\n”, “<|endoftext|>”]
################### error #############
InvalidRequestError Traceback (most recent call last)
----> 1 response=openai.Answer.create(
2 search_model=“ada”,
3 model=“curie”,
4 question=“which puppy is happy?”,
5 file=“file-mQLmOxGJDa0uiQFy4o6g68zb”,

4 frames
/usr/local/lib/python3.8/dist-packages/openai/api_resources/ in create(cls, **params)
10 def create(cls, **params):
11 instance = cls()
—> 12 return instance.request(“post”, cls.get_url(), params)

/usr/local/lib/python3.8/dist-packages/openai/ in request(self, method, url, params, headers, stream, plain_old_data, request_id, request_timeout)
177 organization=self.organization,
178 )
→ 179 response, stream, api_key = requestor.request(
180 method,
181 url,

/usr/local/lib/python3.8/dist-packages/openai/ in request(self, method, url, params, headers, files, stream, request_id, request_timeout)
179 request_timeout=request_timeout,
180 )
→ 181 resp, got_stream = self._interpret_response(result, stream)
182 return resp, got_stream, self.api_key

/usr/local/lib/python3.8/dist-packages/openai/ in _interpret_response(self, result, stream)
394 else:
395 return (
→ 396 self._interpret_response_line(
397 result.content, result.status_code, result.headers, stream=False
398 ),

/usr/local/lib/python3.8/dist-packages/openai/ in _interpret_response_line(self, rbody, rcode, rheaders, stream)
427 stream_error = stream and “error” in
428 if stream_error or not 200 <= rcode < 300:
→ 429 raise self.handle_error_response(
430 rbody, rcode,, rheaders, stream_error=stream_error
431 )

InvalidRequestError: Invalid URL (POST /v1/answers)

Did you try more than once? Looks like it timed out or there’s a problem with the post URL, but that looks fine.

Hopefully someone else comes by and can help.

Welcome to the community!

The answers endpoint is no longer available per Answers, Classification, Search Endpoint Deprecation and the functionality in the openai python package will be removed early in the new year. If you would like to continue to use Answers-like functionality, please see our Answers Transition Guide | OpenAI Help Center

1 Like

There we go. I don’t use answers endpoint often, so I didn’t even catch that at first.