Skip to content

Commit ae1f5e1

Browse files
authored
Nov 2025 housekeeping (#2120)
* Remove gensim sideload * Split CI build/type checks from unit tests * Thorough review of docs to align with v3 * Format * Fix version * Fix type
1 parent 6033e4f commit ae1f5e1

28 files changed

+190
-141
lines changed

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permissions:
66
contents: write
77

88
env:
9-
PYTHON_VERSION: "3.11"
9+
PYTHON_VERSION: "3.12"
1010

1111
jobs:
1212
build:
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Python Build and Type Check
2+
on:
3+
push:
4+
branches:
5+
- "**/main" # match branches like feature/main
6+
- "main" # match the main branch
7+
pull_request:
8+
types:
9+
- opened
10+
- reopened
11+
- synchronize
12+
- ready_for_review
13+
branches:
14+
- "**/main"
15+
- "main"
16+
paths-ignore:
17+
- "**/*.md"
18+
- ".semversioner/**"
19+
20+
permissions:
21+
contents: read
22+
pull-requests: read
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
26+
# Only run the for the latest commit
27+
cancel-in-progress: true
28+
29+
jobs:
30+
python-ci:
31+
# skip draft PRs
32+
if: github.event.pull_request.draft == false
33+
strategy:
34+
matrix:
35+
python-version: ["3.11", "3.12"]
36+
os: [ubuntu-latest, windows-latest]
37+
fail-fast: false # Continue running all jobs even if one fails
38+
env:
39+
DEBUG: 1
40+
41+
runs-on: ${{ matrix.os }}
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- uses: dorny/paths-filter@v3
46+
id: changes
47+
with:
48+
filters: |
49+
python:
50+
- 'graphrag/**/*'
51+
- 'uv.lock'
52+
- 'pyproject.toml'
53+
- '**/*.py'
54+
- '**/*.toml'
55+
- '**/*.ipynb'
56+
- '.github/workflows/python*.yml'
57+
- 'tests/**/*'
58+
59+
- name: Set up Python ${{ matrix.python-version }}
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: ${{ matrix.python-version }}
63+
64+
- name: Install uv
65+
uses: astral-sh/setup-uv@v6
66+
67+
- name: Install dependencies
68+
shell: bash
69+
run: |
70+
uv sync --all-packages
71+
72+
- name: Check
73+
run: |
74+
uv run poe check
75+
76+
- name: Build
77+
run: |
78+
uv build --all-packages

.github/workflows/python-integration-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
if: github.event.pull_request.draft == false
3333
strategy:
3434
matrix:
35-
python-version: ["3.10"]
35+
python-version: ["3.12"]
3636
os: [ubuntu-latest, windows-latest]
3737
fail-fast: false # continue running all jobs even if one fails
3838
env:
@@ -68,7 +68,6 @@ jobs:
6868
shell: bash
6969
run: |
7070
uv sync --all-packages
71-
uv pip install gensim
7271
7372
- name: Build
7473
run: |

.github/workflows/python-notebook-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
if: github.event.pull_request.draft == false
3333
strategy:
3434
matrix:
35-
python-version: ["3.10"]
35+
python-version: ["3.12"]
3636
os: [ubuntu-latest, windows-latest]
3737
fail-fast: false # Continue running all jobs even if one fails
3838
env:
@@ -68,7 +68,6 @@ jobs:
6868
shell: bash
6969
run: |
7070
uv sync --all-packages
71-
uv pip install gensim
7271
7372
- name: Notebook Test
7473
run: |

.github/workflows/python-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
branches: [main]
77

88
env:
9-
PYTHON_VERSION: "3.10"
9+
PYTHON_VERSION: "3.12"
1010

1111
jobs:
1212
publish:

.github/workflows/python-smoke-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
if: github.event.pull_request.draft == false
3333
strategy:
3434
matrix:
35-
python-version: ["3.10"]
35+
python-version: ["3.12"]
3636
os: [ubuntu-latest, windows-latest]
3737
fail-fast: false # Continue running all jobs even if one fails
3838
env:
@@ -73,7 +73,6 @@ jobs:
7373
shell: bash
7474
run: |
7575
uv sync --all-packages
76-
uv pip install gensim
7776
7877
- name: Build
7978
run: |
Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Python CI
1+
name: Python Unit Tests
22
on:
33
push:
44
branches:
@@ -32,7 +32,7 @@ jobs:
3232
if: github.event.pull_request.draft == false
3333
strategy:
3434
matrix:
35-
python-version: ["3.10", "3.11"] # add 3.12 once gensim supports it. TODO: watch this issue - https://github.com/piskvorky/gensim/issues/3510
35+
python-version: ["3.12"]
3636
os: [ubuntu-latest, windows-latest]
3737
fail-fast: false # Continue running all jobs even if one fails
3838
env:
@@ -68,15 +68,6 @@ jobs:
6868
shell: bash
6969
run: |
7070
uv sync --all-packages
71-
uv pip install gensim
72-
73-
- name: Check
74-
run: |
75-
uv run poe check
76-
77-
- name: Build
78-
run: |
79-
uv build --all-packages
8071
8172
- name: Unit Test
8273
run: |

docs/config/models.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ This page contains information on selecting a model to use and options to supply
66

77
GraphRAG was built and tested using OpenAI models, so this is the default model set we support. This is not intended to be a limiter or statement of quality or fitness for your use case, only that it's the set we are most familiar with for prompting, tuning, and debugging.
88

9-
Starting with version 2.6.0, GraphRAG supports using [LiteLLM](https://docs.litellm.ai/) for calling language models. LiteLLM provides support for 100+ models though it is important to note that when choosing a model it must support returning [structured outputs](https://openai.com/index/introducing-structured-outputs-in-the-api/) adhering to a [JSON schema](https://docs.litellm.ai/docs/completion/json_mode).
9+
GraphRAG uses [LiteLLM](https://docs.litellm.ai/) for calling language models. LiteLLM provides support for 100+ models though it is important to note that when choosing a model it must support returning [structured outputs](https://openai.com/index/introducing-structured-outputs-in-the-api/) adhering to a [JSON schema](https://docs.litellm.ai/docs/completion/json_mode).
1010

11-
Example using LiteLLm as the language model tool for GraphRAG:
11+
Example using LiteLLM as the language model manager for GraphRAG:
1212

1313
```yaml
1414
models:
@@ -37,7 +37,7 @@ See [Detailed Configuration](yaml.md) for more details on configuration. [View L
3737

3838
## Model Selection Considerations
3939

40-
GraphRAG has been most thoroughly tested with the gpt-4 series of models from OpenAI, including gpt-4 gpt-4-turbo, gpt-4o, and gpt-4o-mini. Our [arXiv paper](https://arxiv.org/abs/2404.16130), for example, performed quality evaluation using gpt-4-turbo. As stated above, non-OpenAI models are now supported with GraphRAG 2.6.0 and onwards through the use of LiteLLM but the suite of gpt-4 series of models from OpenAI remain the most tested and supported suite of models for GraphRAG.
40+
GraphRAG has been most thoroughly tested with the gpt-4 series of models from OpenAI, including gpt-4 gpt-4-turbo, gpt-4o, and gpt-4o-mini. Our [arXiv paper](https://arxiv.org/abs/2404.16130), for example, performed quality evaluation using gpt-4-turbo. As stated above, non-OpenAI models are supported through the use of LiteLLM but the suite of gpt-4 series of models from OpenAI remain the most tested and supported suite of models for GraphRAG – in other words, these are the models we know best and can help resolve issues with.
4141

4242
Versions of GraphRAG before 2.2.0 made extensive use of `max_tokens` and `logit_bias` to control generated response length or content. The introduction of the o-series of models added new, non-compatible parameters because these models include a reasoning component that has different consumption patterns and response generation attributes than non-reasoning models. GraphRAG 2.2.0 now supports these models, but there are important differences that need to be understood before you switch.
4343

@@ -85,30 +85,30 @@ global_search:
8585

8686
Another option would be to avoid using a language model at all for the graph extraction, instead using the `fast` [indexing method](../index/methods.md) that uses NLP for portions of the indexing phase in lieu of LLM APIs.
8787

88-
## Using Non-OpenAI Models
88+
## Using Custom Models
8989

90-
As shown above, non-OpenAI models may be used via LiteLLM starting with GraphRAG version 2.6.0 but cases may still exist in which some users wish to use models not supported by LiteLLM. There are two approaches one can use to connect to unsupported models:
90+
LiteLLM supports hundreds of models, but cases may still exist in which some users wish to use models not supported by LiteLLM. There are two approaches one can use to connect to unsupported models:
9191

9292
### Proxy APIs
9393

9494
Many users have used platforms such as [ollama](https://ollama.com/) and [LiteLLM Proxy Server](https://docs.litellm.ai/docs/simple_proxy) to proxy the underlying model HTTP calls to a different model provider. This seems to work reasonably well, but we frequently see issues with malformed responses (especially JSON), so if you do this please understand that your model needs to reliably return the specific response formats that GraphRAG expects. If you're having trouble with a model, you may need to try prompting to coax the format, or intercepting the response within your proxy to try and handle malformed responses.
9595

9696
### Model Protocol
9797

98-
As of GraphRAG 2.0.0, we support model injection through the use of a standard chat and embedding Protocol and an accompanying factories that you can use to register your model implementation. This is not supported with the CLI, so you'll need to use GraphRAG as a library.
98+
We support model injection through the use of a standard chat and embedding Protocol and accompanying factories that you can use to register your model implementation. This is not supported with the CLI, so you'll need to use GraphRAG as a library.
9999

100100
- Our Protocol is [defined here](https://github.com/microsoft/graphrag/blob/main/graphrag/language_model/protocol/base.py)
101101
- We have a simple mock implementation in our tests that you can [reference here](https://github.com/microsoft/graphrag/blob/main/tests/mock_provider.py)
102102

103103
Once you have a model implementation, you need to register it with our ChatModelFactory or EmbeddingModelFactory:
104104

105105
```python
106-
class MyCustomModel:
106+
class MyCustomChatModel:
107107
...
108108
# implementation
109109
110110
# elsewhere...
111-
ChatModelFactory.register("my-custom-chat-model", lambda **kwargs: MyCustomModel(**kwargs))
111+
ChatModelFactory.register("my-custom-chat-model", MyCustomChatModel)
112112
```
113113

114114
Then in your config you can reference the type name you used:

docs/config/yaml.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ default_chat_model:
2121

2222
### models
2323

24-
This is a dict of model configurations. The dict key is used to reference this configuration elsewhere when a model instance is desired. In this way, you can specify as many different models as you need, and reference them differentially in the workflow steps.
24+
This is a dict of model configurations. The dict key is used to reference this configuration elsewhere when a model instance is desired. In this way, you can specify as many different models as you need, and reference them independently in the workflow steps.
2525

2626
For example:
2727
```yml
@@ -173,7 +173,7 @@ Where to put all vectors for the system. Configured for lancedb by default. This
173173
- `audience` **str** (only for AI Search) - Audience for managed identity token if managed identity authentication is used.
174174
- `index_prefix` **str** - (optional) A prefix for the indexes you will create for embeddings. This stores all indexes (tables) for a given dataset ingest.
175175
- `database_name` **str** - (cosmosdb only) Name of the database.
176-
- `embeddings_schema` **list[dict[str, str]]** (optional) - Enables customization for each of your embeddings.
176+
- `embeddings_schema` **dict[str, dict[str, str]]** (optional) - Enables customization for each of your embeddings.
177177
- `<supported_embedding>`:
178178
- `index_name` **str**: (optional) - Name for the specific embedding index table.
179179
- `id_field` **str**: (optional) - Field name to be used as id. Default=`id`
@@ -332,7 +332,7 @@ These are the settings used for Leiden hierarchical clustering of the graph to c
332332
#### Fields
333333

334334
- `embeddings` **bool** - Export embeddings snapshots to parquet.
335-
- `graphml` **bool** - Export graph snapshots to GraphML.
335+
- `graphml` **bool** - Export graph snapshot to GraphML.
336336

337337
## Query
338338

docs/developing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
```sh
1515
# install python dependencies
16-
uv sync
16+
uv sync --all-packages
1717
```
1818

1919
## Execute the Indexing Engine

0 commit comments

Comments
 (0)