Skip to content

Commit cea5590

Browse files
Merge branch 'main' into feat/adding-delete-all-docs-to-QdrantDocumentStore
2 parents 5cd0f08 + 347781a commit cea5590

215 files changed

Lines changed: 7032 additions & 806 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/labeler.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ integration:stackit:
174174
- any-glob-to-any-file: "integrations/stackit/**/*"
175175
- any-glob-to-any-file: ".github/workflows/stackit.yml"
176176

177-
integration:together-ai:
177+
integration:togetherai:
178178
- changed-files:
179-
- any-glob-to-any-file: "integrations/together_ai/**/*"
180-
- any-glob-to-any-file: ".github/workflows/together_ai.yml"
179+
- any-glob-to-any-file: "integrations/togetherai/**/*"
180+
- any-glob-to-any-file: ".github/workflows/togetherai.yml"
181181

182182
integration:unstructured-fileconverter:
183183
- changed-files:

.github/utils/deepset_sync.py

Lines changed: 0 additions & 191 deletions
This file was deleted.

.github/utils/validate_version.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import re
2+
import requests
3+
4+
# * integrations/<INTEGRATION_FOLDER_NAME>-v1.0.0
5+
INTEGRATION_VERSION_REGEX = r"integrations/([a-zA-Z_]+)-v([0-9]\.[0-9]+\.[0-9]+)"
6+
7+
8+
def validate_version_number(tag: str):
9+
"""
10+
Verify that a release version number follows semantic versioning rules by checking the latest version on PyPI.
11+
"""
12+
13+
matches = re.match(INTEGRATION_VERSION_REGEX, tag)
14+
if not matches or len(matches.groups()) != 2:
15+
raise ValueError(f"Invalid tag: {tag}")
16+
17+
integration_name, version_to_release = matches.groups()
18+
print(f"Integration name: {integration_name}")
19+
print(f"Integration version to release: {version_to_release}")
20+
21+
# Replace underscores with hyphens to look for the package on PyPi
22+
integration_package = f"{integration_name.replace('_', '-')}-haystack"
23+
print(f"Integration PyPi package: {integration_package}")
24+
25+
# connect to PyPi and check the latest version
26+
try:
27+
response = requests.get(f"https://pypi.org/pypi/{integration_package}/json")
28+
response.raise_for_status()
29+
latest_version = response.json()["info"]["version"]
30+
print(f"Latest version on PyPI: {latest_version}")
31+
except requests.exceptions.HTTPError as e:
32+
if e.response.status_code == 404 and version_to_release in ["0.0.1", "0.1.0", "1.0.0"]:
33+
print("Package not found on PyPI. Assuming this is the first release and skipping version check.")
34+
return
35+
raise e
36+
37+
x, y, z = [int(i) for i in latest_version.split(".")]
38+
39+
acceptable_new_versions = [
40+
f"{x}.{y}.{z + 1}",
41+
f"{x}.{y + 1}.0",
42+
f"{x + 1}.0.0",
43+
]
44+
if version_to_release not in acceptable_new_versions:
45+
msg = (
46+
f"Invalid version to release: {version_to_release}. Acceptable new versions are: {acceptable_new_versions}"
47+
)
48+
raise ValueError(msg)
49+
print("The version to release is acceptable.")
50+
51+
52+
if __name__ == "__main__":
53+
import argparse
54+
55+
parser = argparse.ArgumentParser()
56+
parser.add_argument("--tag", help="Git tag in format 'integrations/<name>-v<version>'", required=True, type=str)
57+
args = parser.parse_args()
58+
59+
validate_version_number(args.tag)
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Core / Sync API reference with Docusaurus
2+
3+
on:
4+
push:
5+
tags:
6+
- "**-v[0-9].[0-9]+.[0-9]+"
7+
8+
workflow_dispatch: # Activate this workflow manually
9+
inputs:
10+
tag:
11+
description: "Tag with this format: integrations/<INTEGRATION_FOLDER_NAME>-v1.0.0. When running this workflow manually, version is irrelevant so you can use any value."
12+
required: true
13+
type: string
14+
default: integrations/<INTEGRATION_FOLDER_NAME>-v1.0.0
15+
16+
env:
17+
TAG: ${{ inputs.tag || github.ref_name }}
18+
19+
jobs:
20+
generate-api-reference:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
integration_name: ${{ steps.pathfinder.outputs.integration_name }}
24+
25+
steps:
26+
- name: Checkout this repo
27+
uses: actions/checkout@v5
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v6
31+
with:
32+
python-version: "3.10"
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install -U haystack-pydoc-tools
38+
39+
- name: Get project folder
40+
id: pathfinder
41+
shell: python
42+
run: |
43+
import os
44+
project_path = os.environ["TAG"].rsplit("-", maxsplit=1)[0]
45+
integration_name = project_path.split("/")[-1]
46+
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
47+
print(f'project_path={project_path}', file=f)
48+
print(f'integration_name={integration_name}', file=f)
49+
50+
- name: Generate API reference
51+
working-directory: ${{ steps.pathfinder.outputs.project_path }}
52+
53+
run: pydoc-markdown pydoc/config_docusaurus.yml
54+
55+
- name: Upload API reference artifact
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: ${{ steps.pathfinder.outputs.integration_name }}
59+
path: ${{ steps.pathfinder.outputs.project_path }}/${{ steps.pathfinder.outputs.integration_name }}.md
60+
if-no-files-found: error
61+
retention-days: 1
62+
overwrite: true
63+
64+
65+
sync-api-reference:
66+
runs-on: ubuntu-latest
67+
needs: generate-api-reference
68+
69+
steps:
70+
- name: Checkout Haystack repo
71+
uses: actions/checkout@v5
72+
with:
73+
repository: deepset-ai/haystack
74+
ref: main
75+
token: ${{ secrets.HAYSTACK_BOT_TOKEN }}
76+
77+
- name: Set up Python
78+
uses: actions/setup-python@v6
79+
with:
80+
python-version: "3.10"
81+
82+
- name: Download API reference artifact
83+
uses: actions/download-artifact@v5
84+
with:
85+
name: ${{ needs.generate-api-reference.outputs.integration_name }}
86+
87+
- name: Sync API reference
88+
shell: python
89+
env:
90+
INTEGRATION_NAME: ${{ needs.generate-api-reference.outputs.integration_name }}
91+
run: |
92+
import os
93+
import shutil
94+
95+
artifact_filename = os.environ['INTEGRATION_NAME']+'.md'
96+
97+
# Copy to main API reference
98+
shutil.copy(artifact_filename, "docs-website/reference/integrations-api/")
99+
100+
# Copy to versioned API reference
101+
for version_dir in os.scandir("docs-website/reference_versioned_docs"):
102+
if version_dir.is_dir():
103+
# example: docs-website/reference_versioned_docs/version-2.17/integrations-api
104+
integrations_api_ref_dir = os.path.join(version_dir.path, "integrations-api")
105+
shutil.copy(artifact_filename, integrations_api_ref_dir)
106+
107+
os.remove(artifact_filename)
108+
109+
- name: Create Pull Request
110+
uses: peter-evans/create-pull-request@v7
111+
env:
112+
INTEGRATION_NAME: ${{ needs.generate-api-reference.outputs.integration_name }}
113+
with:
114+
token: ${{ secrets.HAYSTACK_BOT_TOKEN }}
115+
commit-message: "Sync Core Integrations API reference (${{ env.INTEGRATION_NAME }}) on Docusaurus"
116+
branch: sync-docusaurus-api-reference-${{ env.INTEGRATION_NAME }}
117+
base: main
118+
title: "docs: sync Core Integrations API reference (${{ env.INTEGRATION_NAME }}) on Docusaurus"
119+
add-paths: |
120+
docs-website
121+
body: |
122+
This PR syncs the Core Integrations API reference (${{ env.INTEGRATION_NAME }}) on Docusaurus. Just approve and merge it.

0 commit comments

Comments
 (0)