We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
PR stuck after approval and automated "Update Documentation & Code Style" commit
**Describe the bug**
See https://github.com/deepset-ai/haystack/pull/2838
This PR has approval, all tests passed and is ready to merge. However due to the "Update Documentation & Code Style" commit, the required tests have not been executed and it's stuck. Manually executing the Test workflow on this branch does not help: see https://github.com/deepset-ai/haystack/actions/runs/2692003395.

All I can do, is make a minimal change to trigger the Test workflow correctly. That's cumbersome.

**Expected behavior**
Being able to merge after "Update Documentation & Code Style" commit when all tests of the previous commit are green or maybe easier: being able to manually trigger the workflow to run all required tests for merging.

**To Reproduce**
- Create PR with docs change
- Wait till workflows pass correctly and someone approves

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `.github/utils/generate_openapi_specs.py`
Content:
```
1 import json
2 from pathlib import Path
3 import os
4 import sys
5 import shutil
6 
7 sys.path.append(".")
8 from rest_api.utils import get_openapi_specs, get_app, get_pipelines  # pylint: disable=wrong-import-position
9 from haystack import __version__  # pylint: disable=wrong-import-position
10 
11 REST_PATH = Path("./rest_api").absolute()
12 PIPELINE_PATH = str(REST_PATH / "pipeline" / "pipeline_empty.haystack-pipeline.yml")
13 APP_PATH = str(REST_PATH / "application.py")
14 DOCS_PATH = Path("./docs") / "_src" / "api" / "openapi"
15 
16 os.environ["PIPELINE_YAML_PATH"] = PIPELINE_PATH
17 
18 print(f"Loading OpenAPI specs from {APP_PATH} with pipeline at {PIPELINE_PATH}")
19 
20 # To initialize the app and the pipelines
21 get_app()
22 get_pipelines()
23 
24 # Generate the openapi specs
25 specs = get_openapi_specs()
26 
27 # Dump the specs into a JSON file
28 with open(DOCS_PATH / "openapi.json", "w") as f:
29     json.dump(specs, f, indent=4)
30 
31 # Remove rc versions of the specs from the folder
32 for specs_file in os.listdir():
33     if os.path.isfile(specs_file) and "rc" in specs_file and Path(specs_file).suffix == ".json":
34         os.remove(specs_file)
35 
36 # Add versioned copy
37 shutil.copy(DOCS_PATH / "openapi.json", DOCS_PATH / f"openapi-{__version__}.json")
38
```

Path: `.github/utils/generate_json_schema.py`
Content:
```
1 import sys
2 import logging
3 from pathlib import Path
4 
5 logging.basicConfig(level=logging.INFO)
6 
7 
8 sys.path.append(".")
9 from haystack.nodes._json_schema import update_json_schema
10 
11 update_json_schema(destination_path=Path(__file__).parent.parent.parent / "haystack" / "json-schemas")
12
```

Path: `.github/utils/convert_notebooks_into_webpages.py`
Content:
```
1 import re
2 
3 from nbconvert import MarkdownExporter
4 import os
5 from pathlib import Path
6 
7 headers = {
8     1: """<!---
9 title: "Tutorial 1"
10 metaTitle: "Build Your First QA System"
11 metaDescription: ""
12 slug: "/docs/tutorial1"
13 date: "2020-09-03"
14 id: "tutorial1md"
15 --->""",
16     2: """<!---
17 title: "Tutorial 2"
18 metaTitle: "Fine-tuning a model on your own data"
19 metaDescription: ""
20 slug: "/docs/tutorial2"
21 date: "2020-09-03"
22 id: "tutorial2md"
23 --->""",
24     3: """<!---
25 title: "Tutorial 3"
26 metaTitle: "Build a QA System Without Elasticsearch"
27 metaDescription: ""
28 slug: "/docs/tutorial3"
29 date: "2020-09-03"
30 id: "tutorial3md"
31 --->""",
32     4: """<!---
33 title: "Tutorial 4"
34 metaTitle: "Utilizing existing FAQs for Question Answering"
35 metaDescription: ""
36 slug: "/docs/tutorial4"
37 date: "2020-09-03"
38 id: "tutorial4md"
39 --->""",
40     5: """<!---
41 title: "Tutorial 5"
42 metaTitle: "Evaluation of a QA System"
43 metaDescription: ""
44 slug: "/docs/tutorial5"
45 date: "2020-09-03"
46 id: "tutorial5md"
47 --->""",
48     6: """<!---
49 title: "Tutorial 6"
50 metaTitle: "Better retrieval via Dense Passage Retrieval"
51 metaDescription: ""
52 slug: "/docs/tutorial6"
53 date: "2020-09-03"
54 id: "tutorial6md"
55 --->""",
56     7: """<!---
57 title: "Tutorial 7"
58 metaTitle: "Generative QA with RAG"
59 metaDescription: ""
60 slug: "/docs/tutorial7"
61 date: "2020-11-12"
62 id: "tutorial7md"
63 --->""",
64     8: """<!---
65 title: "Tutorial 8"
66 metaTitle: "Preprocessing"
67 metaDescription: ""
68 slug: "/docs/tutorial8"
69 date: "2021-01-08"
70 id: "tutorial8md"
71 --->""",
72     9: """<!---
73 title: "Tutorial 9"
74 metaTitle: "Training a Dense Passage Retrieval model"
75 metaDescription: ""
76 slug: "/docs/tutorial9"
77 date: "2021-01-08"
78 id: "tutorial9md"
79 --->""",
80     10: """<!---
81 title: "Tutorial 10"
82 metaTitle: "Knowledge Graph QA"
83 metaDescription: ""
84 slug: "/docs/tutorial10"
85 date: "2021-04-06"
86 id: "tutorial10md"
87 --->""",
88     11: """<!---
89 title: "Tutorial 11"
90 metaTitle: "Pipelines"
91 metaDescription: ""
92 slug: "/docs/tutorial11"
93 date: "2021-04-06"
94 id: "tutorial11md"
95 --->""",
96     12: """<!---
97 title: "Tutorial 12"
98 metaTitle: "Generative QA with LFQA"
99 metaDescription: ""
100 slug: "/docs/tutorial12"
101 date: "2021-04-06"
102 id: "tutorial12md"
103 --->""",
104     13: """<!---
105 title: "Tutorial 13"
106 metaTitle: "Question Generation"
107 metaDescription: ""
108 slug: "/docs/tutorial13"
109 date: "2021-08-23"
110 id: "tutorial13md"
111 --->""",
112     14: """<!---
113 title: "Tutorial 14"
114 metaTitle: "Query Classifier Tutorial"
115 metaDescription: ""
116 slug: "/docs/tutorial14"
117 date: "2021-08-23"
118 id: "tutorial14md"
119 --->""",
120     15: """<!---
121 title: "Tutorial 15"
122 metaTitle: "TableQA Tutorial"
123 metaDescription: ""
124 slug: "/docs/tutorial15"
125 date: "2021-10-28"
126 id: "tutorial15md"
127 --->""",
128     16: """<!---
129 title: "Tutorial 16"
130 metaTitle: "DocumentClassifier at Index Time Tutorial"
131 metaDescription: ""
132 slug: "/docs/tutorial16"
133 date: "2021-11-05"
134 id: "tutorial16md"
135 --->""",
136     17: """<!---
137 title: "Tutorial 17"
138 metaTitle: "Audio Tutorial"
139 metaDescription: ""
140 slug: "/docs/tutorial17"
141 date: "2022-06-15"
142 id: "tutorial17md"
143 --->""",
144     18: """<!---
145 title: "Tutorial 18"    
146 metaTitle: "GPL Domain Adaptation"
147 metaDescription: ""
148 slug: "/docs/tutorial18"
149 date: "2022-06-22"
150 id: "tutorial18md"
151 --->""",
152 }
153 
154 
155 def atoi(text):
156     return int(text) if text.isdigit() else text
157 
158 
159 def natural_keys(text):
160     test = [atoi(c) for c in re.split("(\d+)", text)]
161     return test
162 
163 
164 dir = Path(__file__).parent.parent.parent / "tutorials"
165 
166 notebooks = [x for x in os.listdir(dir) if x[-6:] == ".ipynb"]
167 # sort notebooks based on numbers within name of notebook
168 notebooks = sorted(notebooks, key=lambda x: natural_keys(x))
169 
170 
171 e = MarkdownExporter(exclude_output=True)
172 for i, nb in enumerate(notebooks):
173     body, resources = e.from_filename(dir / nb)
174     print(f"Processing {dir}/{nb}")
175 
176     tutorials_path = Path(__file__).parent.parent.parent / "docs" / "_src" / "tutorials" / "tutorials"
177     with open(tutorials_path / f"{i + 1}.md", "w", encoding="utf-8") as f:
178         try:
179             f.write(headers[i + 1] + "\n\n")
180         except IndexError as e:
181             raise IndexError(
182                 "Can't find the header for this tutorial. Have you added it in '.github/utils/convert_notebooks_into_webpages.py'?"
183             )
184         f.write(body)
185
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/.github/utils/convert_notebooks_into_webpages.py b/.github/utils/convert_notebooks_into_webpages.py
old mode 100644
new mode 100755
--- a/.github/utils/convert_notebooks_into_webpages.py
+++ b/.github/utils/convert_notebooks_into_webpages.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 import re
 
 from nbconvert import MarkdownExporter
@@ -142,7 +144,7 @@
 id: "tutorial17md"
 --->""",
     18: """<!---
-title: "Tutorial 18"    
+title: "Tutorial 18"
 metaTitle: "GPL Domain Adaptation"
 metaDescription: ""
 slug: "/docs/tutorial18"
diff --git a/.github/utils/generate_json_schema.py b/.github/utils/generate_json_schema.py
old mode 100644
new mode 100755
--- a/.github/utils/generate_json_schema.py
+++ b/.github/utils/generate_json_schema.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 import sys
 import logging
 from pathlib import Path
diff --git a/.github/utils/generate_openapi_specs.py b/.github/utils/generate_openapi_specs.py
old mode 100644
new mode 100755
--- a/.github/utils/generate_openapi_specs.py
+++ b/.github/utils/generate_openapi_specs.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 import json
 from pathlib import Path
 import os

{"golden_diff": "diff --git a/.github/utils/convert_notebooks_into_webpages.py b/.github/utils/convert_notebooks_into_webpages.py\nold mode 100644\nnew mode 100755\n--- a/.github/utils/convert_notebooks_into_webpages.py\n+++ b/.github/utils/convert_notebooks_into_webpages.py\n@@ -1,3 +1,5 @@\n+#!/usr/bin/env python3\n+\n import re\n \n from nbconvert import MarkdownExporter\n@@ -142,7 +144,7 @@\n id: \"tutorial17md\"\n --->\"\"\",\n     18: \"\"\"<!---\n-title: \"Tutorial 18\"    \n+title: \"Tutorial 18\"\n metaTitle: \"GPL Domain Adaptation\"\n metaDescription: \"\"\n slug: \"/docs/tutorial18\"\ndiff --git a/.github/utils/generate_json_schema.py b/.github/utils/generate_json_schema.py\nold mode 100644\nnew mode 100755\n--- a/.github/utils/generate_json_schema.py\n+++ b/.github/utils/generate_json_schema.py\n@@ -1,3 +1,5 @@\n+#!/usr/bin/env python3\n+\n import sys\n import logging\n from pathlib import Path\ndiff --git a/.github/utils/generate_openapi_specs.py b/.github/utils/generate_openapi_specs.py\nold mode 100644\nnew mode 100755\n--- a/.github/utils/generate_openapi_specs.py\n+++ b/.github/utils/generate_openapi_specs.py\n@@ -1,3 +1,5 @@\n+#!/usr/bin/env python3\n+\n import json\n from pathlib import Path\n import os\n", "issue": "PR stuck after approval and automated \"Update Documentation & Code Style\" commit\n**Describe the bug**\r\nSee https://github.com/deepset-ai/haystack/pull/2838\r\nThis PR has approval, all tests passed and is ready to merge. However due to the \"Update Documentation & Code Style\" commit, the required tests have not been executed and it's stuck. Manually executing the Test workflow on this branch does not help: see https://github.com/deepset-ai/haystack/actions/runs/2692003395.\r\n\r\nAll I can do, is make a minimal change to trigger the Test workflow correctly. That's cumbersome.\r\n\r\n**Expected behavior**\r\nBeing able to merge after \"Update Documentation & Code Style\" commit when all tests of the previous commit are green or maybe easier: being able to manually trigger the workflow to run all required tests for merging.\r\n\r\n**To Reproduce**\r\n- Create PR with docs change\r\n- Wait till workflows pass correctly and someone approves\n", "before_files": [{"content": "import json\nfrom pathlib import Path\nimport os\nimport sys\nimport shutil\n\nsys.path.append(\".\")\nfrom rest_api.utils import get_openapi_specs, get_app, get_pipelines  # pylint: disable=wrong-import-position\nfrom haystack import __version__  # pylint: disable=wrong-import-position\n\nREST_PATH = Path(\"./rest_api\").absolute()\nPIPELINE_PATH = str(REST_PATH / \"pipeline\" / \"pipeline_empty.haystack-pipeline.yml\")\nAPP_PATH = str(REST_PATH / \"application.py\")\nDOCS_PATH = Path(\"./docs\") / \"_src\" / \"api\" / \"openapi\"\n\nos.environ[\"PIPELINE_YAML_PATH\"] = PIPELINE_PATH\n\nprint(f\"Loading OpenAPI specs from {APP_PATH} with pipeline at {PIPELINE_PATH}\")\n\n# To initialize the app and the pipelines\nget_app()\nget_pipelines()\n\n# Generate the openapi specs\nspecs = get_openapi_specs()\n\n# Dump the specs into a JSON file\nwith open(DOCS_PATH / \"openapi.json\", \"w\") as f:\n    json.dump(specs, f, indent=4)\n\n# Remove rc versions of the specs from the folder\nfor specs_file in os.listdir():\n    if os.path.isfile(specs_file) and \"rc\" in specs_file and Path(specs_file).suffix == \".json\":\n        os.remove(specs_file)\n\n# Add versioned copy\nshutil.copy(DOCS_PATH / \"openapi.json\", DOCS_PATH / f\"openapi-{__version__}.json\")\n", "path": ".github/utils/generate_openapi_specs.py"}, {"content": "import sys\nimport logging\nfrom pathlib import Path\n\nlogging.basicConfig(level=logging.INFO)\n\n\nsys.path.append(\".\")\nfrom haystack.nodes._json_schema import update_json_schema\n\nupdate_json_schema(destination_path=Path(__file__).parent.parent.parent / \"haystack\" / \"json-schemas\")\n", "path": ".github/utils/generate_json_schema.py"}, {"content": "import re\n\nfrom nbconvert import MarkdownExporter\nimport os\nfrom pathlib import Path\n\nheaders = {\n    1: \"\"\"<!---\ntitle: \"Tutorial 1\"\nmetaTitle: \"Build Your First QA System\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial1\"\ndate: \"2020-09-03\"\nid: \"tutorial1md\"\n--->\"\"\",\n    2: \"\"\"<!---\ntitle: \"Tutorial 2\"\nmetaTitle: \"Fine-tuning a model on your own data\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial2\"\ndate: \"2020-09-03\"\nid: \"tutorial2md\"\n--->\"\"\",\n    3: \"\"\"<!---\ntitle: \"Tutorial 3\"\nmetaTitle: \"Build a QA System Without Elasticsearch\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial3\"\ndate: \"2020-09-03\"\nid: \"tutorial3md\"\n--->\"\"\",\n    4: \"\"\"<!---\ntitle: \"Tutorial 4\"\nmetaTitle: \"Utilizing existing FAQs for Question Answering\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial4\"\ndate: \"2020-09-03\"\nid: \"tutorial4md\"\n--->\"\"\",\n    5: \"\"\"<!---\ntitle: \"Tutorial 5\"\nmetaTitle: \"Evaluation of a QA System\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial5\"\ndate: \"2020-09-03\"\nid: \"tutorial5md\"\n--->\"\"\",\n    6: \"\"\"<!---\ntitle: \"Tutorial 6\"\nmetaTitle: \"Better retrieval via Dense Passage Retrieval\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial6\"\ndate: \"2020-09-03\"\nid: \"tutorial6md\"\n--->\"\"\",\n    7: \"\"\"<!---\ntitle: \"Tutorial 7\"\nmetaTitle: \"Generative QA with RAG\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial7\"\ndate: \"2020-11-12\"\nid: \"tutorial7md\"\n--->\"\"\",\n    8: \"\"\"<!---\ntitle: \"Tutorial 8\"\nmetaTitle: \"Preprocessing\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial8\"\ndate: \"2021-01-08\"\nid: \"tutorial8md\"\n--->\"\"\",\n    9: \"\"\"<!---\ntitle: \"Tutorial 9\"\nmetaTitle: \"Training a Dense Passage Retrieval model\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial9\"\ndate: \"2021-01-08\"\nid: \"tutorial9md\"\n--->\"\"\",\n    10: \"\"\"<!---\ntitle: \"Tutorial 10\"\nmetaTitle: \"Knowledge Graph QA\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial10\"\ndate: \"2021-04-06\"\nid: \"tutorial10md\"\n--->\"\"\",\n    11: \"\"\"<!---\ntitle: \"Tutorial 11\"\nmetaTitle: \"Pipelines\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial11\"\ndate: \"2021-04-06\"\nid: \"tutorial11md\"\n--->\"\"\",\n    12: \"\"\"<!---\ntitle: \"Tutorial 12\"\nmetaTitle: \"Generative QA with LFQA\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial12\"\ndate: \"2021-04-06\"\nid: \"tutorial12md\"\n--->\"\"\",\n    13: \"\"\"<!---\ntitle: \"Tutorial 13\"\nmetaTitle: \"Question Generation\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial13\"\ndate: \"2021-08-23\"\nid: \"tutorial13md\"\n--->\"\"\",\n    14: \"\"\"<!---\ntitle: \"Tutorial 14\"\nmetaTitle: \"Query Classifier Tutorial\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial14\"\ndate: \"2021-08-23\"\nid: \"tutorial14md\"\n--->\"\"\",\n    15: \"\"\"<!---\ntitle: \"Tutorial 15\"\nmetaTitle: \"TableQA Tutorial\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial15\"\ndate: \"2021-10-28\"\nid: \"tutorial15md\"\n--->\"\"\",\n    16: \"\"\"<!---\ntitle: \"Tutorial 16\"\nmetaTitle: \"DocumentClassifier at Index Time Tutorial\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial16\"\ndate: \"2021-11-05\"\nid: \"tutorial16md\"\n--->\"\"\",\n    17: \"\"\"<!---\ntitle: \"Tutorial 17\"\nmetaTitle: \"Audio Tutorial\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial17\"\ndate: \"2022-06-15\"\nid: \"tutorial17md\"\n--->\"\"\",\n    18: \"\"\"<!---\ntitle: \"Tutorial 18\"    \nmetaTitle: \"GPL Domain Adaptation\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial18\"\ndate: \"2022-06-22\"\nid: \"tutorial18md\"\n--->\"\"\",\n}\n\n\ndef atoi(text):\n    return int(text) if text.isdigit() else text\n\n\ndef natural_keys(text):\n    test = [atoi(c) for c in re.split(\"(\\d+)\", text)]\n    return test\n\n\ndir = Path(__file__).parent.parent.parent / \"tutorials\"\n\nnotebooks = [x for x in os.listdir(dir) if x[-6:] == \".ipynb\"]\n# sort notebooks based on numbers within name of notebook\nnotebooks = sorted(notebooks, key=lambda x: natural_keys(x))\n\n\ne = MarkdownExporter(exclude_output=True)\nfor i, nb in enumerate(notebooks):\n    body, resources = e.from_filename(dir / nb)\n    print(f\"Processing {dir}/{nb}\")\n\n    tutorials_path = Path(__file__).parent.parent.parent / \"docs\" / \"_src\" / \"tutorials\" / \"tutorials\"\n    with open(tutorials_path / f\"{i + 1}.md\", \"w\", encoding=\"utf-8\") as f:\n        try:\n            f.write(headers[i + 1] + \"\\n\\n\")\n        except IndexError as e:\n            raise IndexError(\n                \"Can't find the header for this tutorial. Have you added it in '.github/utils/convert_notebooks_into_webpages.py'?\"\n            )\n        f.write(body)\n", "path": ".github/utils/convert_notebooks_into_webpages.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\nimport os\nimport sys\nimport shutil\n\nsys.path.append(\".\")\nfrom rest_api.utils import get_openapi_specs, get_app, get_pipelines  # pylint: disable=wrong-import-position\nfrom haystack import __version__  # pylint: disable=wrong-import-position\n\nREST_PATH = Path(\"./rest_api\").absolute()\nPIPELINE_PATH = str(REST_PATH / \"pipeline\" / \"pipeline_empty.haystack-pipeline.yml\")\nAPP_PATH = str(REST_PATH / \"application.py\")\nDOCS_PATH = Path(\"./docs\") / \"_src\" / \"api\" / \"openapi\"\n\nos.environ[\"PIPELINE_YAML_PATH\"] = PIPELINE_PATH\n\nprint(f\"Loading OpenAPI specs from {APP_PATH} with pipeline at {PIPELINE_PATH}\")\n\n# To initialize the app and the pipelines\nget_app()\nget_pipelines()\n\n# Generate the openapi specs\nspecs = get_openapi_specs()\n\n# Dump the specs into a JSON file\nwith open(DOCS_PATH / \"openapi.json\", \"w\") as f:\n    json.dump(specs, f, indent=4)\n\n# Remove rc versions of the specs from the folder\nfor specs_file in os.listdir():\n    if os.path.isfile(specs_file) and \"rc\" in specs_file and Path(specs_file).suffix == \".json\":\n        os.remove(specs_file)\n\n# Add versioned copy\nshutil.copy(DOCS_PATH / \"openapi.json\", DOCS_PATH / f\"openapi-{__version__}.json\")\n", "path": ".github/utils/generate_openapi_specs.py"}, {"content": "#!/usr/bin/env python3\n\nimport sys\nimport logging\nfrom pathlib import Path\n\nlogging.basicConfig(level=logging.INFO)\n\n\nsys.path.append(\".\")\nfrom haystack.nodes._json_schema import update_json_schema\n\nupdate_json_schema(destination_path=Path(__file__).parent.parent.parent / \"haystack\" / \"json-schemas\")\n", "path": ".github/utils/generate_json_schema.py"}, {"content": "#!/usr/bin/env python3\n\nimport re\n\nfrom nbconvert import MarkdownExporter\nimport os\nfrom pathlib import Path\n\nheaders = {\n    1: \"\"\"<!---\ntitle: \"Tutorial 1\"\nmetaTitle: \"Build Your First QA System\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial1\"\ndate: \"2020-09-03\"\nid: \"tutorial1md\"\n--->\"\"\",\n    2: \"\"\"<!---\ntitle: \"Tutorial 2\"\nmetaTitle: \"Fine-tuning a model on your own data\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial2\"\ndate: \"2020-09-03\"\nid: \"tutorial2md\"\n--->\"\"\",\n    3: \"\"\"<!---\ntitle: \"Tutorial 3\"\nmetaTitle: \"Build a QA System Without Elasticsearch\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial3\"\ndate: \"2020-09-03\"\nid: \"tutorial3md\"\n--->\"\"\",\n    4: \"\"\"<!---\ntitle: \"Tutorial 4\"\nmetaTitle: \"Utilizing existing FAQs for Question Answering\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial4\"\ndate: \"2020-09-03\"\nid: \"tutorial4md\"\n--->\"\"\",\n    5: \"\"\"<!---\ntitle: \"Tutorial 5\"\nmetaTitle: \"Evaluation of a QA System\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial5\"\ndate: \"2020-09-03\"\nid: \"tutorial5md\"\n--->\"\"\",\n    6: \"\"\"<!---\ntitle: \"Tutorial 6\"\nmetaTitle: \"Better retrieval via Dense Passage Retrieval\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial6\"\ndate: \"2020-09-03\"\nid: \"tutorial6md\"\n--->\"\"\",\n    7: \"\"\"<!---\ntitle: \"Tutorial 7\"\nmetaTitle: \"Generative QA with RAG\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial7\"\ndate: \"2020-11-12\"\nid: \"tutorial7md\"\n--->\"\"\",\n    8: \"\"\"<!---\ntitle: \"Tutorial 8\"\nmetaTitle: \"Preprocessing\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial8\"\ndate: \"2021-01-08\"\nid: \"tutorial8md\"\n--->\"\"\",\n    9: \"\"\"<!---\ntitle: \"Tutorial 9\"\nmetaTitle: \"Training a Dense Passage Retrieval model\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial9\"\ndate: \"2021-01-08\"\nid: \"tutorial9md\"\n--->\"\"\",\n    10: \"\"\"<!---\ntitle: \"Tutorial 10\"\nmetaTitle: \"Knowledge Graph QA\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial10\"\ndate: \"2021-04-06\"\nid: \"tutorial10md\"\n--->\"\"\",\n    11: \"\"\"<!---\ntitle: \"Tutorial 11\"\nmetaTitle: \"Pipelines\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial11\"\ndate: \"2021-04-06\"\nid: \"tutorial11md\"\n--->\"\"\",\n    12: \"\"\"<!---\ntitle: \"Tutorial 12\"\nmetaTitle: \"Generative QA with LFQA\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial12\"\ndate: \"2021-04-06\"\nid: \"tutorial12md\"\n--->\"\"\",\n    13: \"\"\"<!---\ntitle: \"Tutorial 13\"\nmetaTitle: \"Question Generation\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial13\"\ndate: \"2021-08-23\"\nid: \"tutorial13md\"\n--->\"\"\",\n    14: \"\"\"<!---\ntitle: \"Tutorial 14\"\nmetaTitle: \"Query Classifier Tutorial\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial14\"\ndate: \"2021-08-23\"\nid: \"tutorial14md\"\n--->\"\"\",\n    15: \"\"\"<!---\ntitle: \"Tutorial 15\"\nmetaTitle: \"TableQA Tutorial\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial15\"\ndate: \"2021-10-28\"\nid: \"tutorial15md\"\n--->\"\"\",\n    16: \"\"\"<!---\ntitle: \"Tutorial 16\"\nmetaTitle: \"DocumentClassifier at Index Time Tutorial\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial16\"\ndate: \"2021-11-05\"\nid: \"tutorial16md\"\n--->\"\"\",\n    17: \"\"\"<!---\ntitle: \"Tutorial 17\"\nmetaTitle: \"Audio Tutorial\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial17\"\ndate: \"2022-06-15\"\nid: \"tutorial17md\"\n--->\"\"\",\n    18: \"\"\"<!---\ntitle: \"Tutorial 18\"\nmetaTitle: \"GPL Domain Adaptation\"\nmetaDescription: \"\"\nslug: \"/docs/tutorial18\"\ndate: \"2022-06-22\"\nid: \"tutorial18md\"\n--->\"\"\",\n}\n\n\ndef atoi(text):\n    return int(text) if text.isdigit() else text\n\n\ndef natural_keys(text):\n    test = [atoi(c) for c in re.split(\"(\\d+)\", text)]\n    return test\n\n\ndir = Path(__file__).parent.parent.parent / \"tutorials\"\n\nnotebooks = [x for x in os.listdir(dir) if x[-6:] == \".ipynb\"]\n# sort notebooks based on numbers within name of notebook\nnotebooks = sorted(notebooks, key=lambda x: natural_keys(x))\n\n\ne = MarkdownExporter(exclude_output=True)\nfor i, nb in enumerate(notebooks):\n    body, resources = e.from_filename(dir / nb)\n    print(f\"Processing {dir}/{nb}\")\n\n    tutorials_path = Path(__file__).parent.parent.parent / \"docs\" / \"_src\" / \"tutorials\" / \"tutorials\"\n    with open(tutorials_path / f\"{i + 1}.md\", \"w\", encoding=\"utf-8\") as f:\n        try:\n            f.write(headers[i + 1] + \"\\n\\n\")\n        except IndexError as e:\n            raise IndexError(\n                \"Can't find the header for this tutorial. Have you added it in '.github/utils/convert_notebooks_into_webpages.py'?\"\n            )\n        f.write(body)\n", "path": ".github/utils/convert_notebooks_into_webpages.py"}]}