haystack icon indicating copy to clipboard operation
haystack copied to clipboard

gpt-3.5-turbo does not work in the `OpenAIAnswerGenerator`

Open anakin87 opened this issue 11 months ago • 0 comments

Describe the bug Reported on Discord: using OpenAIAnswerGenerator with gpt-3.5-turbo raises an error.

Generator vs PromptNode The OpenAIAnswerGenerator is still available in Haystack while the PromptNode is the preferred choice. The OpenAIAnswerGenerator is not kept up to date.

I see two possible solutions:

  • deprecate and remove the OpenAIAnswerGenerator
  • make the OpenAIAnswerGenerator simply instantiate a PromptNode under the hood

To Reproduce

from haystack.nodes import OpenAIAnswerGenerator
from haystack import Document

ag = OpenAIAnswerGenerator(api_key="MY-API-KEY", model="gpt-3.5-turbo")

ag.run(
  query="What is the capital of Germany?",
  documents=[Document("Berlin is the capital of Germany.")]
)

Error message

OpenAIError: OpenAI returned an error. Status code: 404 Response body: { "error": { "message": "This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?", "type": "invalid_request_error", "param": "model", "code": null } }

System:

  • Haystack version (commit or version number): 1.18.1

anakin87 avatar Jul 13 '23 08:07 anakin87