참고소스 수정본

This commit is contained in:
LASTA_DEV01\lasta
2026-05-12 19:40:31 +09:00
parent 0f34a451fc
commit 2e9204243d
8708 changed files with 3259488 additions and 869 deletions

View File

@@ -0,0 +1,36 @@
---
name: Bug Report
about: Report a bug in the Neo4j GraphRAG library
labels: "bug"
---
<!--
If you are an Enterprise customer, you might want to head over to our
[Customer Support Portal](https://support.neo4j.com/).
-->
<!--
If you are unsure about the usage of the library, this issue tracker is not
the right place to ask. Please use one of the following channels instead:
- Neo4j Online Community: https://community.neo4j.com/
- StackOverflow: https://stackoverflow.com/questions/tagged/neo4j+python
- Discord: https://discord.gg/neo4j
- Neo4j Support Portal if you are an enterprise customer:
https://support.neo4j.com/
-->
<!--
Make sure you've searched the issue tracker for similar issues first.
-->
# Bug Report
<!-- description of the found bug -->
# My Environment
Python Version: <!-- output of `python -VV` -->
Driver Version: <!-- can be found with `python -m pip show neo4j` -->
Server Version and Edition: <!-- e.g., Neo4j 4.4.3 enterprise cluster -->
Operating System: <!-- e.g., Windows 10, Ubuntu 18.04, macOS 10.15 -->

View File

@@ -0,0 +1,31 @@
---
name: Feature Request
about: Suggest an idea for the Neo4j GraphRAG library
labels: "feature request"
---
<!--
If you are an Enterprise customer, you might want to head over to our
[Customer Support Portal](https://support.neo4j.com/).
-->
<!--
If you are unsure about the usage of this library, this issue tracker is not
the right place to ask. Please use one of the following channels instead:
- Neo4j Online Community: https://community.neo4j.com/
- StackOverflow: https://stackoverflow.com/questions/tagged/neo4j+python
- Discord: https://discord.gg/neo4j
- Neo4j Support Portal if you are an enterprise customer:
https://support.neo4j.com/
-->
<!--
Make sure you've searched the issue tracker for similar issues first.
-->
# Feature Request
<!-- a brief description of what's requested -->
# Pitch
<!-- elaborate on the feature request and why it would be beneficial -->

View File

@@ -0,0 +1,32 @@
name: "CLA Check"
on:
pull_request_target:
branches:
- main
jobs:
cla-check:
if: github.event.pull_request.user.login != 'renovate[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: neo-technology/whitelist-check
token: ${{ secrets.CLA_CHECK_TOKEN }}
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
with:
python-version: 3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- run: |
owner=$(echo "$GITHUB_REPOSITORY" | cut -d/ -f1)
repository=$(echo "$GITHUB_REPOSITORY" | cut -d/ -f2)
./bin/examine-pull-request "$owner" "$repository" "${{ secrets.CLA_CHECK_TOKEN }}" "$PULL_REQUEST_NUMBER" cla-database.csv
env:
PULL_REQUEST_NUMBER: ${{ github.event.number }}

View File

@@ -0,0 +1,41 @@
name: Publish a new major release 🚀
on:
workflow_dispatch:
jobs:
bump-version:
outputs:
version: ${{ steps.get-version.outputs.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GIT_PUSH_PAT }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Set up uv
uses: astral-sh/setup-uv@v3
- name: Bump version
run: uv version --bump major --frozen
- name: Get version
id: get-version
run: echo version=`uv version --short` >> "$GITHUB_OUTPUT"
- name: Print version
run: |
echo Version: ${{ steps.get-version.outputs.version }}
- name: Update CHANGELOG.md (cross platform supported)
run: |
sed -i.bak -e 's/## Next/## Next\n\n## ${{ steps.get-version.outputs.version }}/' CHANGELOG.md && rm CHANGELOG.md.bak
- uses: EndBug/add-and-commit@v9
with:
author_name: 'Neo4j-GraphRAG GitHub Action'
author_email: 'team-gen-ai@neo4j.com'
message: 'Bump version to ${{ steps.get-version.outputs.version }}'
add: "['pyproject.toml', 'CHANGELOG.md']"
tag: '${{ steps.get-version.outputs.version }}'

View File

@@ -0,0 +1,41 @@
name: Publish a new minor release 🚀
on:
workflow_dispatch:
jobs:
bump-version:
outputs:
version: ${{ steps.get-version.outputs.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GIT_PUSH_PAT }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Set up uv
uses: astral-sh/setup-uv@v3
- name: Bump version
run: uv version --bump minor --frozen
- name: Get version
id: get-version
run: echo version=`uv version --short` >> "$GITHUB_OUTPUT"
- name: Print version
run: |
echo Version: ${{ steps.get-version.outputs.version }}
- name: Update CHANGELOG.md (cross platform supported)
run: |
sed -i.bak -e 's/## Next/## Next\n\n## ${{ steps.get-version.outputs.version }}/' CHANGELOG.md && rm CHANGELOG.md.bak
- uses: EndBug/add-and-commit@v9
with:
author_name: 'Neo4j-GraphRAG GitHub Action'
author_email: 'team-gen-ai@neo4j.com'
message: 'Bump version to ${{ steps.get-version.outputs.version }}'
add: "['pyproject.toml', 'CHANGELOG.md']"
tag: '${{ steps.get-version.outputs.version }}'

View File

@@ -0,0 +1,41 @@
name: Publish a new patch release 🚀
on:
workflow_dispatch:
jobs:
bump-version:
outputs:
version: ${{ steps.get-version.outputs.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GIT_PUSH_PAT }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Set up uv
uses: astral-sh/setup-uv@v3
- name: Bump version
run: uv version --bump patch --frozen
- name: Get version
id: get-version
run: echo version=`uv version --short` >> "$GITHUB_OUTPUT"
- name: Print version
run: |
echo Version: ${{ steps.get-version.outputs.version }}
- name: Update CHANGELOG.md (cross platform supported)
run: |
sed -i.bak -e 's/## Next/## Next\n\n## ${{ steps.get-version.outputs.version }}/' CHANGELOG.md && rm CHANGELOG.md.bak
- uses: EndBug/add-and-commit@v9
with:
author_name: 'Neo4j-GraphRAG GitHub Action'
author_email: 'team-gen-ai@neo4j.com'
message: 'Bump version to ${{ steps.get-version.outputs.version }}'
add: "['pyproject.toml', 'CHANGELOG.md']"
tag: '${{ steps.get-version.outputs.version }}'

View File

@@ -0,0 +1,137 @@
name: 'Neo4j-GraphRAG PR E2E Tests'
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
e2e-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.14']
neo4j-tag:
- '5-enterprise'
- 'latest'
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Free up disk space (ubuntu-latest)
run: |
sudo rm -rf /usr/local/lib/android \
/usr/share/dotnet \
/opt/ghc \
/opt/hostedtoolcache
docker system prune -af || true
docker volume prune -f || true
docker builder prune -af || true
sudo apt-get clean || true
df -h
- name: Create Docker network
run: docker network create test-network
- name: Start t2v-transformers
run: |
for i in 1 2 3; do
docker pull cr.weaviate.io/semitechnologies/transformers-inference:sentence-transformers-all-MiniLM-L6-v2 \
&& break || sleep $((30 + RANDOM % 30))
done
docker run -d --name t2v-transformers \
--network test-network \
-e ENABLE_CUDA=0 \
cr.weaviate.io/semitechnologies/transformers-inference:sentence-transformers-all-MiniLM-L6-v2
- name: Start Weaviate
run: |
for i in 1 2 3; do
docker pull cr.weaviate.io/semitechnologies/weaviate:1.27.0 \
&& break || sleep $((30 + RANDOM % 30))
done
docker run -d --name weaviate \
--network test-network \
-p 8080:8080 -p 50051:50051 \
-e TRANSFORMERS_INFERENCE_API='http://t2v-transformers:8080' \
-e AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED='true' \
-e DEFAULT_VECTORIZER_MODULE='text2vec-transformers' \
-e ENABLE_MODULES='text2vec-transformers' \
-e CLUSTER_HOSTNAME='node1' \
cr.weaviate.io/semitechnologies/weaviate:1.27.0
- name: Start Neo4j
run: |
for i in 1 2 3; do
docker pull neo4j:${{ matrix.neo4j-tag }} \
&& break || sleep $((30 + RANDOM % 30))
done
docker run -d --name neo4j \
--network test-network \
-p 7687:7687 -p 7474:7474 \
-e NEO4J_AUTH=neo4j/password \
-e NEO4J_ACCEPT_LICENSE_AGREEMENT=eval \
-e NEO4J_PLUGINS='["apoc"]' \
neo4j:${{ matrix.neo4j-tag }}
- name: Start Qdrant
run: |
for i in 1 2 3; do
docker pull qdrant/qdrant \
&& break || sleep $((30 + RANDOM % 30))
done
docker run -d --name qdrant \
--network test-network \
-p 6333:6333 \
qdrant/qdrant
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v3
- name: Load cached venv
id: cached-venv
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('**/uv.lock') }}
- name: Install dependencies
if: steps.cached-venv.outputs.cache-hit != 'true'
run: uv sync --frozen --all-extras --group dev
- name: Show disk usage after dependency installation
run: |
df -h
- name: Wait for Weaviate to start
shell: bash
run: |
set +e
count=0; until curl -s --fail localhost:8080/v1/.well-known/ready; do ((count++)); [ $count -ge 10 ] && echo "Reached maximum retry limit" && exit 1; sleep 15; done
- name: Wait for Neo4j to be ready
shell: bash
run: |
echo "Waiting for Neo4j to be ready..."
count=0
until curl -s --fail http://localhost:7474 > /dev/null 2>&1; do
((count++))
if [ $count -ge 30 ]; then
echo "Neo4j failed to start within timeout"
docker logs neo4j
exit 1
fi
echo "Waiting for Neo4j... (attempt $count/30)"
sleep 5
done
echo "Neo4j is ready!"
- name: Run tests
shell: bash
run: |
if [[ "${{ matrix.neo4j-tag }}" == "latest" || "${{ matrix.neo4j-tag }}" == "community" ]]; then
uv run pytest -m 'not enterprise_only' ./tests/e2e
elif [[ "${{ matrix.neo4j-tag }}" == "5-enterprise" ]]; then
uv run pytest -m 'not search_clause' ./tests/e2e
else
uv run pytest ./tests/e2e
fi
- name: Prune uv cache
if: always()
run: uv cache prune --ci

View File

@@ -0,0 +1,45 @@
name: neo4j_graphrag PR
on: pull_request
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
steps:
- name: Free up disk space (ubuntu-latest)
run: |
sudo rm -rf /usr/local/lib/android \
/usr/share/dotnet \
/opt/ghc \
/opt/hostedtoolcache
sudo apt-get clean || true
df -h
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v3
- name: Load cached venv
id: cached-venv
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/uv.lock') }}
- name: Install dependencies
if: steps.cached-venv.outputs.cache-hit != 'true'
run: uv sync --frozen --all-extras --group dev
- name: Check format and linting
run: |
uv run ruff check .
uv run ruff format --check .
- name: Run strict mypy check
run: uv run mypy .
- name: Run unit tests and check coverage
run: |
uv run coverage run -m pytest tests/unit
uv run coverage report --fail-under=90

View File

@@ -0,0 +1,41 @@
name: Publish a new Alpha release (x.y.0a0 -> x.y.0a1) 🚀
on:
workflow_dispatch:
jobs:
bump-version:
outputs:
version: ${{ steps.get-version.outputs.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GIT_PUSH_PAT }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Set up uv
uses: astral-sh/setup-uv@v3
- name: Bump version
run: uv version --bump alpha --frozen
- name: Get version
id: get-version
run: echo version=`uv version --short` >> "$GITHUB_OUTPUT"
- name: Print version
run: |
echo Version: ${{ steps.get-version.outputs.version }}
- name: Update CHANGELOG.md (cross platform supported)
run: |
sed -i.bak -e 's/## Next/## Next\n\n## ${{ steps.get-version.outputs.version }}/' CHANGELOG.md && rm CHANGELOG.md.bak
- uses: EndBug/add-and-commit@v9
with:
author_name: 'Neo4j-GraphRAG GitHub Action'
author_email: 'team-gen-ai@neo4j.com'
message: 'Bump version to ${{ steps.get-version.outputs.version }}'
add: "['pyproject.toml', 'CHANGELOG.md']"
tag: '${{ steps.get-version.outputs.version }}'

View File

@@ -0,0 +1,41 @@
name: Publish a new Alpha Major release (0.4.0 -> 1.0.0a0) 🚀
on:
workflow_dispatch:
jobs:
bump-version:
outputs:
version: ${{ steps.get-version.outputs.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GIT_PUSH_PAT }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Set up uv
uses: astral-sh/setup-uv@v3
- name: Bump version
run: uv version --bump major --bump alpha --frozen
- name: Get version
id: get-version
run: echo version=`uv version --short` >> "$GITHUB_OUTPUT"
- name: Print version
run: |
echo Version: ${{ steps.get-version.outputs.version }}
- name: Update CHANGELOG.md (cross platform supported)
run: |
sed -i.bak -e 's/## Next/## Next\n\n## ${{ steps.get-version.outputs.version }}/' CHANGELOG.md && rm CHANGELOG.md.bak
- uses: EndBug/add-and-commit@v9
with:
author_name: 'Neo4j-GraphRAG GitHub Action'
author_email: 'team-gen-ai@neo4j.com'
message: 'Bump version to ${{ steps.get-version.outputs.version }}'
add: "['pyproject.toml', 'CHANGELOG.md']"
tag: '${{ steps.get-version.outputs.version }}'

View File

@@ -0,0 +1,48 @@
name: Publish Python 🐍 distribution 📦
on: push
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: PyPI
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/neo4j-graphrag
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

View File

@@ -0,0 +1,138 @@
name: 'Neo4j-GraphRAG Scheduled E2E Tests'
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * 1,4' # Mon, Thu
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
e2e-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14']
neo4j-tag:
- 'community'
- 'enterprise'
- 'latest'
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Free up disk space (ubuntu-latest)
run: |
sudo rm -rf /usr/local/lib/android \
/usr/share/dotnet \
/opt/ghc \
/opt/hostedtoolcache
docker system prune -af || true
docker volume prune -f || true
docker builder prune -af || true
sudo apt-get clean || true
df -h
- name: Create Docker network
run: docker network create test-network
- name: Start t2v-transformers
run: |
for i in 1 2 3; do
docker pull cr.weaviate.io/semitechnologies/transformers-inference:sentence-transformers-all-MiniLM-L6-v2 \
&& break || sleep $((30 + RANDOM % 30))
done
docker run -d --name t2v-transformers \
--network test-network \
-e ENABLE_CUDA=0 \
cr.weaviate.io/semitechnologies/transformers-inference:sentence-transformers-all-MiniLM-L6-v2
- name: Start Weaviate
run: |
for i in 1 2 3; do
docker pull cr.weaviate.io/semitechnologies/weaviate:1.27.0 \
&& break || sleep $((30 + RANDOM % 30))
done
docker run -d --name weaviate \
--network test-network \
-p 8080:8080 -p 50051:50051 \
-e TRANSFORMERS_INFERENCE_API='http://t2v-transformers:8080' \
-e AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED='true' \
-e DEFAULT_VECTORIZER_MODULE='text2vec-transformers' \
-e ENABLE_MODULES='text2vec-transformers' \
-e CLUSTER_HOSTNAME='node1' \
cr.weaviate.io/semitechnologies/weaviate:1.27.0
- name: Start Neo4j
run: |
for i in 1 2 3; do
docker pull neo4j:${{ matrix.neo4j-tag }} \
&& break || sleep $((30 + RANDOM % 30))
done
docker run -d --name neo4j \
--network test-network \
-p 7687:7687 -p 7474:7474 \
-e NEO4J_AUTH=neo4j/password \
-e NEO4J_ACCEPT_LICENSE_AGREEMENT=eval \
-e NEO4J_PLUGINS='["apoc"]' \
neo4j:${{ matrix.neo4j-tag }}
- name: Start Qdrant
run: |
for i in 1 2 3; do
docker pull qdrant/qdrant \
&& break || sleep $((30 + RANDOM % 30))
done
docker run -d --name qdrant \
--network test-network \
-p 6333:6333 \
qdrant/qdrant
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v3
- name: Load cached venv
id: cached-venv
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('**/uv.lock') }}
- name: Install dependencies
if: steps.cached-venv.outputs.cache-hit != 'true'
run: uv sync --frozen --all-extras --group dev
- name: Show disk usage after dependency installation
run: |
df -h
- name: Wait for Weaviate to start
shell: bash
run: |
set +e
count=0; until curl -s --fail localhost:8080/v1/.well-known/ready; do ((count++)); [ $count -ge 10 ] && echo "Reached maximum retry limit" && exit 1; sleep 15; done
- name: Wait for Neo4j to be ready
shell: bash
run: |
echo "Waiting for Neo4j to be ready..."
count=0
until curl -s --fail http://localhost:7474 > /dev/null 2>&1; do
((count++))
if [ $count -ge 30 ]; then
echo "Neo4j failed to start within timeout"
docker logs neo4j
exit 1
fi
echo "Waiting for Neo4j... (attempt $count/30)"
sleep 5
done
echo "Neo4j is ready!"
- name: Run tests
shell: bash
run: |
if [[ "${{ matrix.neo4j-tag }}" == "latest" || "${{ matrix.neo4j-tag }}" == "community" ]]; then
uv run pytest -m 'not enterprise_only' ./tests/e2e
else
uv run pytest ./tests/e2e
fi
- name: Prune uv cache
if: always()
run: uv cache prune --ci