Repository: deepset-ai/haystack

Issue:
gpt-3.5-turbo does not work in the `OpenAIAnswerGenerator`
**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**
```python
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


Discussion:
coveralls: ## Pull Request Test Coverage Report for [Build 6391450617](https://coveralls.io/builds/63047952)

* **0** of **0**   changed or added relevant lines in **0** files are covered.
* No unchanged relevant lines lost coverage.
* Overall first build on deprecate-openai-ansgen at **50.187%**

---



|  Totals | [![Coverage Status](https://coveralls.io/builds/63047952/badge)](https://coveralls.io/builds/63047952) |
| :-- | --: |
| Change from base [Build 6390685436](https://coveralls.io/builds/63046261): |  50.2% |
| Covered Lines: | 12512 |
| Relevant Lines: | 24931 |

---
##### 💛  - [Coveralls](https://coveralls.io)


Patch:
diff --git a/haystack/nodes/answer_generator/openai.py b/haystack/nodes/answer_generator/openai.py
index ae1ac362..6b8893c9 100644
--- a/haystack/nodes/answer_generator/openai.py
+++ b/haystack/nodes/answer_generator/openai.py
@@ -1,6 +1,7 @@
 import logging
 import os
 from typing import List, Optional, Tuple, Union
+import warnings
 
 from haystack import Document
 from haystack.environment import HAYSTACK_REMOTE_API_TIMEOUT_SEC
@@ -21,6 +22,10 @@ OPENAI_TIMEOUT = float(os.environ.get(HAYSTACK_REMOTE_API_TIMEOUT_SEC, 30))
 
 class OpenAIAnswerGenerator(BaseGenerator):
     """
+    This component is now deprecated and will be removed in future versions.
+    Use `PromptNode` instead of `OpenAIAnswerGenerator`,
+    as explained in https://haystack.deepset.ai/tutorials/22_pipeline_with_promptnode.
+
     Uses the GPT-3 models from the OpenAI API to generate Answers based on the Documents it receives.
     The Documents can come from a Retriever or you can supply them manually.
 
@@ -109,6 +114,12 @@ class OpenAIAnswerGenerator(BaseGenerator):
         :param openai_organization: The OpenAI-Organization ID, defaults to `None`. For more details, see see OpenAI
         [documentation](https://platform.openai.com/docs/api-reference/requesting-organization).
         """
+        warnings.warn(
+            "`OpenAIAnswerGenerator component is deprecated and will be removed in future versions. Use `PromptNode` "
+            "instead of `OpenAIAnswerGenerator`.",
+            category=DeprecationWarning,
+        )
+
         super().__init__(progress_bar=progress_bar)
         if (examples is None and examples_context is not None) or (examples is not None and examples_context is None):
             logger.warning(
diff --git a/releasenotes/notes/deprecate-openai-answergenerator-537266612ba1ffff.yaml b/releasenotes/notes/deprecate-openai-answergenerator-537266612ba1ffff.yaml
new file mode 100644
index 00000000..3e42dfac
--- /dev/null
+++ b/releasenotes/notes/deprecate-openai-answergenerator-537266612ba1ffff.yaml
@@ -0,0 +1,5 @@
+---
+deprecations:
+  - |
+    Deprecate `OpenAIAnswerGenerator` in favor of `PromptNode`.
+    `OpenAIAnswerGenerator` will be removed in Haystack 1.23.


Test patch:
diff --git a/test/nodes/test_generator.py b/test/nodes/test_generator.py
index 1fea0fc4..f69663ae 100644
--- a/test/nodes/test_generator.py
+++ b/test/nodes/test_generator.py
@@ -6,9 +6,19 @@ from haystack.schema import Document, Answer
 from haystack.nodes.answer_generator import OpenAIAnswerGenerator
 from haystack.nodes import PromptTemplate
 
+from ..conftest import fail_at_version
+
 import logging
 
 
+@pytest.mark.unit
+@fail_at_version(1, 23)
+@patch("haystack.nodes.answer_generator.openai.load_openai_tokenizer")
+def test_openaianswergenerator_deprecation(mock_load_tokenizer):
+    with pytest.warns(DeprecationWarning):
+        OpenAIAnswerGenerator(api_key="fake_api_key")
+
+
 @pytest.mark.unit
 @patch("haystack.nodes.answer_generator.openai.openai_request")
 def test_no_openai_organization(mock_request):