Repository: deepset-ai/haystack

Issue:
Unreadability of documentation due to formatting error
While reading the documentation of https://docs.haystack.deepset.ai/reference/answer-generator-api we can see that due to formatting error the docs is in an unorganized format unlike other pages of the documentation.

I propose to rectify the same using a PR to improve readability of the documentation.

![Screenshot 2023-10-22 at 10 14 12 AM](https://github.com/deepset-ai/haystack/assets/91927689/b37b5137-259c-4643-8e1b-f3c871fedaa4)



Discussion:
Hey, @Smartmind12!
Thank you for reporting this issue.

This component has been deprecated and will probably be removed in the near future.

However, if you want to solve this problem, feel free to open a simple PR that improves the format of the docstring.

(FYI @dfokina).

Resolving patch:
diff --git a/haystack/nodes/answer_generator/openai.py b/haystack/nodes/answer_generator/openai.py
--- a/haystack/nodes/answer_generator/openai.py
+++ b/haystack/nodes/answer_generator/openai.py
@@ -58,10 +58,8 @@ def __init__(
         """
         :param api_key: Your API key from OpenAI. It is required for this node to work.
         :param azure_base_url: The base URL for the Azure OpenAI API. If not supplied, Azure OpenAI API will not be used.
-                               This parameter is an OpenAI Azure endpoint, usually in the form `https://<your-endpoint>.openai.azure.com'
-
-        :param azure_deployment_name: The name of the Azure OpenAI API deployment. If not supplied, Azure OpenAI API
-                                     will not be used.
+                               This parameter is an OpenAI Azure endpoint, usually in the form `https://<your-endpoint>.openai.azure.com`.
+        :param azure_deployment_name: The name of the Azure OpenAI API deployment. If not supplied, Azure OpenAI API will not be used.
         :param model: ID of the engine to use for generating the answer. You can select one of `"text-ada-001"`,
                      `"text-babbage-001"`, `"text-curie-001"`, or `"text-davinci-003"`
                      (from worst to best and from cheapest to most expensive). For more information about the models,
@@ -88,22 +86,20 @@ def __init__(
                          format you'd like. We recommend adding 2 to 3 examples.
                          If not supplied, the default from OpenAI API docs is used:
                          `[["Q: What is human life expectancy in the United States?", "A: 78 years."]]`
-        :param stop_words: Up to four sequences where the API stops generating further tokens. The returned text does
-                           not contain the stop sequence.
-                           If you don't provide any stop words, the default value from OpenAI API docs is used: `["\n", "
"]`.
+        :param stop_words: Up to four sequences where the API stops generating further tokens. The returned text does not contain the stop sequence.
+                           If you don't provide any stop words, the default value from OpenAI API docs is used: `["\\n", "
"]`.
         :param prompt_template: A PromptTemplate that tells the model how to generate answers given a
              `context` and `query` supplied at runtime. The `context` is automatically constructed at runtime from a
-            list of provided documents. Use `example_context` and a list of `examples` to provide
-            the model with examples to steer it towards the tone and answer format you would like.
+            list of provided documents. Use `example_context` and a list of `examples` to provide the model with examples to steer it towards the tone and answer format you would like.
             If not supplied, the default prompt template is:
             ```python
                 PromptTemplate(
                     "Please answer the question according to the above context."
-                    "\n===\nContext: {examples_context}\n===\n{examples}\n\n"
-                    "===\nContext: {context}\n===\n{query}",
+                    "\\n===\\nContext: {examples_context}\\n===\\n{examples}\\n\\n"
+                    "===\\nContext: {context}\\n===\\n{query}",
                 )
             ```
-            To learn how variables, such as'{context}', are substituted in the prompt text, see
+            To learn how variables, such as '{context}', are substituted in the prompt text, see
             [PromptTemplate](https://docs.haystack.deepset.ai/docs/prompt_node#template-structure).
         :param context_join_str: The separation string used to join the input documents to create the context
             used by the PromptTemplate.
@@ -114,6 +110,7 @@ def __init__(
         :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`.",


Test patch: