Skip to content

Index API - #953

Merged
Alonso Guevara (AlonsoGuevara) merged 12 commits into
mainfrom
indexing-api
Aug 20, 2024
Merged

Alonso Guevara (AlonsoGuevara) merged 12 commits into
mainfrom
indexing-api

Conversation

@dworthen

Copy link
Copy Markdown
Contributor

Description

This PR pulls out the core library logic from the CLI layer into a dedicated API layer, useful for programmatic use cases. The CLI now calls out to the API layer.

Checklist

  • I have tested these changes locally.
  • I have reviewed the code changes.
  • I have updated the documentation (if necessary).
  • I have added appropriate unit tests (if applicable).

Additional Notes

[Add any additional notes or context that may be helpful for the reviewer(s).]

- Implement main API entry point: build_index
- Rely on GraphRagConfig instead of PipelineConfig
    - This unifies the API signature with the
    promt_tune and query API entry points
- Derive cache settings, config, and resuming from
    the config and other arguments to
    simplify/reduce arguments to build_index
- Add preflight config file validations
- Add semver change
@gmile

Copy link
Copy Markdown

Would it be possible to import API module into a custom python script to use it directly? If yes, could you please provide a simple example of how to do this?

(asking as barely a python expert, but interested in embedding graphrag as part of my custom python webserver)

Comment thread graphrag/index/api.py Outdated
Comment thread graphrag/index/api.py Outdated
Comment thread graphrag/index/api.py Outdated
Comment thread graphrag/index/api.py Outdated
@caster-Q

Copy link
Copy Markdown

Is there a demo that can run this index API?

Abe Brandsma (Brandsma) pushed a commit to ThalamusLabs/MMGraphRAG that referenced this pull request Nov 6, 2025
* Initial Index API

- Implement main API entry point: build_index
- Rely on GraphRagConfig instead of PipelineConfig
    - This unifies the API signature with the
    promt_tune and query API entry points
- Derive cache settings, config, and resuming from
    the config and other arguments to
    simplify/reduce arguments to build_index
- Add preflight config file validations
- Add semver change

* fix smoke tests

* fix smoke tests

* Use asyncio

* Add e2e artifacts in GH actions

* Remove unnecessary E2E test, and add skip_validations flag to cli

* Nicer imports

* Reorganize API functions.

* Add license headers and module docstrings

* Fix ignored ruff rule

---------

Co-authored-by: Alonso Guevara <alonsog@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants