Skip to content

Commit 64df034

Browse files
feat(funasr): add FunASRTranscriber component (#3376)
Co-authored-by: Stefano Fiorucci <stefanofiorucci@gmail.com>
1 parent da49f93 commit 64df034

15 files changed

Lines changed: 1196 additions & 0 deletions

File tree

.github/labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ integration:firecrawl:
130130
- any-glob-to-any-file: "integrations/firecrawl/**/*"
131131
- any-glob-to-any-file: ".github/workflows/firecrawl.yml"
132132

133+
integration:funasr:
134+
- changed-files:
135+
- any-glob-to-any-file: "integrations/funasr/**/*"
136+
- any-glob-to-any-file: ".github/workflows/funasr.yml"
137+
133138
integration:github:
134139
- changed-files:
135140
- any-glob-to-any-file: "integrations/github/**/*"

.github/workflows/CI_coverage_comment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ on:
2727
- "Test / falkordb"
2828
- "Test / fastembed"
2929
- "Test / firecrawl"
30+
- "Test / funasr"
3031
- "Test / github"
3132
- "Test / google-genai"
3233
- "Test / hanlp"

.github/workflows/funasr.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# This workflow comes from https://github.com/ofek/hatch-mypyc
2+
# https://github.com/ofek/hatch-mypyc/blob/5a198c0ba8660494d02716cfc9d79ce4adfb1442/.github/workflows/test.yml
3+
name: Test / funasr
4+
5+
on:
6+
schedule:
7+
- cron: "0 0 * * *"
8+
pull_request:
9+
paths:
10+
- "integrations/funasr/**"
11+
- "!integrations/funasr/*.md"
12+
- ".github/workflows/funasr.yml"
13+
push:
14+
branches:
15+
- main
16+
paths:
17+
- "integrations/funasr/**"
18+
- "!integrations/funasr/*.md"
19+
- ".github/workflows/funasr.yml"
20+
21+
defaults:
22+
run:
23+
working-directory: integrations/funasr
24+
25+
concurrency:
26+
group: funasr-${{ github.head_ref || github.sha }}
27+
cancel-in-progress: true
28+
29+
env:
30+
PYTHONUNBUFFERED: "1"
31+
FORCE_COLOR: "1"
32+
TEST_MATRIX_OS: '["ubuntu-latest", "windows-latest", "macos-latest"]'
33+
TEST_MATRIX_PYTHON: '["3.10", "3.14"]'
34+
35+
jobs:
36+
compute-test-matrix:
37+
runs-on: ubuntu-slim
38+
defaults:
39+
run:
40+
working-directory: .
41+
outputs:
42+
os: ${{ steps.set.outputs.os }}
43+
python-version: ${{ steps.set.outputs.python-version }}
44+
steps:
45+
- id: set
46+
run: |
47+
echo 'os=${{ github.event_name == 'push' && '["ubuntu-latest"]' || env.TEST_MATRIX_OS }}' >> "$GITHUB_OUTPUT"
48+
echo 'python-version=${{ github.event_name == 'push' && '["3.14"]' || env.TEST_MATRIX_PYTHON }}' >> "$GITHUB_OUTPUT"
49+
50+
run:
51+
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
52+
needs: compute-test-matrix
53+
permissions:
54+
contents: write
55+
pull-requests: write
56+
runs-on: ${{ matrix.os }}
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
os: ${{ fromJSON(needs.compute-test-matrix.outputs.os) }}
61+
python-version: ${{ fromJSON(needs.compute-test-matrix.outputs.python-version) }}
62+
63+
steps:
64+
- name: Support longpaths
65+
if: matrix.os == 'windows-latest'
66+
working-directory: .
67+
run: git config --system core.longpaths true
68+
69+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
70+
71+
- name: Set up Python ${{ matrix.python-version }}
72+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
73+
with:
74+
python-version: ${{ matrix.python-version }}
75+
76+
- name: Install Hatch
77+
run: |
78+
python -m pip install --upgrade pip
79+
pip install hatch --uploaded-prior-to=P1D
80+
- name: Lint
81+
if: matrix.python-version == '3.10' && runner.os == 'Linux'
82+
run: hatch run fmt-check && hatch run test:types
83+
84+
- name: Run unit tests
85+
run: hatch run test:unit-cov-retry
86+
87+
# On PR: posts coverage comment (directly on same-repo PRs; via artifact for fork PRs). On push to main: stores coverage baseline on data branch.
88+
- name: Store unit tests coverage
89+
id: coverage_comment
90+
if: matrix.python-version == '3.14' && runner.os == 'Linux' && github.event_name != 'schedule'
91+
uses: py-cov-action/python-coverage-comment-action@63f52f4fbbffada6e8dee8ec432de7e01df9ba79 # v3.41
92+
with:
93+
GITHUB_TOKEN: ${{ github.token }}
94+
COVERAGE_PATH: integrations/funasr
95+
SUBPROJECT_ID: funasr
96+
MINIMUM_GREEN: 90
97+
MINIMUM_ORANGE: 60
98+
99+
- name: Upload coverage comment to be posted
100+
if: matrix.python-version == '3.14' && runner.os == 'Linux' && github.event_name == 'pull_request' && steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
101+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
102+
with:
103+
name: coverage-comment-funasr
104+
path: python-coverage-comment-action-funasr.txt
105+
106+
- name: Run integration tests
107+
run: hatch run test:integration-cov-append-retry
108+
109+
- name: Store combined coverage
110+
if: github.event_name == 'push'
111+
uses: py-cov-action/python-coverage-comment-action@63f52f4fbbffada6e8dee8ec432de7e01df9ba79 # v3.41
112+
with:
113+
GITHUB_TOKEN: ${{ github.token }}
114+
COVERAGE_PATH: integrations/funasr
115+
SUBPROJECT_ID: funasr-combined
116+
MINIMUM_GREEN: 90
117+
MINIMUM_ORANGE: 60
118+
119+
- name: Run unit tests with lowest direct dependencies
120+
if: github.event_name != 'push'
121+
run: |
122+
hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt
123+
hatch -e test env run -- uv pip install -r requirements_lowest_direct.txt
124+
hatch run test:unit
125+
126+
- name: Nightly - run unit tests with Haystack main branch
127+
if: github.event_name == 'schedule'
128+
run: |
129+
hatch env prune
130+
hatch -e test env run -- uv pip install git+https://github.com/deepset-ai/haystack.git@main
131+
hatch run test:unit
132+
133+
notify-slack-on-failure:
134+
needs: run
135+
if: failure() && github.event_name == 'schedule'
136+
runs-on: ubuntu-slim
137+
steps:
138+
- uses: deepset-ai/notify-slack-action@a65def0c8bf91d6520286ab34280151c76a5a008 # v1.1.0
139+
with:
140+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFICATIONS }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Please check out our [Contribution Guidelines](CONTRIBUTING.md) for all the deta
5151
| [falkordb-haystack](integrations/falkordb/) | Document Store | [![PyPI - Version](https://img.shields.io/pypi/v/falkordb-haystack.svg)](https://pypi.org/project/falkordb-haystack) | [![Test / falkordb](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/falkordb.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/falkordb.yml) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-falkordb/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-falkordb/htmlcov/index.html) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-falkordb-combined/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-falkordb-combined/htmlcov/index.html) |
5252
| [fastembed-haystack](integrations/fastembed/) | Embedder, Ranker | [![PyPI - Version](https://img.shields.io/pypi/v/fastembed-haystack.svg)](https://pypi.org/project/fastembed-haystack/) | [![Test / fastembed](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/fastembed.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/fastembed.yml) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-fastembed/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-fastembed/htmlcov/index.html) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-fastembed-combined/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-fastembed-combined/htmlcov/index.html) |
5353
| [firecrawl-haystack](integrations/firecrawl/) | Fetcher, Web Search | [![PyPI - Version](https://img.shields.io/pypi/v/firecrawl-haystack.svg)](https://pypi.org/project/firecrawl-haystack/) | [![Test / firecrawl](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/firecrawl.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/firecrawl.yml) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-firecrawl/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-firecrawl/htmlcov/index.html) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-firecrawl-combined/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-firecrawl-combined/htmlcov/index.html) |
54+
| [funasr-haystack](integrations/funasr/) | Audio | [![PyPI - Version](https://img.shields.io/pypi/v/funasr-haystack.svg)](https://pypi.org/project/funasr-haystack) | [![Test / funasr](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/funasr.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/funasr.yml) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-funasr/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-funasr/htmlcov/index.html) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-funasr-combined/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-funasr-combined/htmlcov/index.html) |
5455
| [github-haystack](integrations/github/) | Connector | [![PyPI - Version](https://img.shields.io/pypi/v/github-haystack.svg)](https://pypi.org/project/github-haystack) | [![Test / github](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/github.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/github.yml) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-github/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-github/htmlcov/index.html) | |
5556
| [google-ai-haystack](integrations/google_ai/) | Generator | [![PyPI - Version](https://img.shields.io/pypi/v/google-ai-haystack.svg)](https://pypi.org/project/google-ai-haystack) | **Archived** - use [google-genai-haystack](https://pypi.org/project/google-genai-haystack) instead | | |
5657
| [google-genai-haystack](integrations/google_genai/) | Embedder, Generator | [![PyPI - Version](https://img.shields.io/pypi/v/google-genai-haystack.svg)](https://pypi.org/project/google-genai-haystack) | [![Test / google-genai](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/google_genai.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/google_genai.yml) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-google_genai/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-google_genai/htmlcov/index.html) | [![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/python-coverage-comment-action-data-google_genai-combined/endpoint.json&label=)](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack-core-integrations/blob/python-coverage-comment-action-data-google_genai-combined/htmlcov/index.html) |

0 commit comments

Comments
 (0)