Skip to content

Feat/additional context #2021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 8, 2025
Merged

Feat/additional context #2021

merged 5 commits into from
Aug 8, 2025

Conversation

AlonsoGuevara
Copy link
Collaborator

Description

Add additional_context dictionary bag at api level for custom workflows support

Related Issues

[Reference any related issues or tasks that this pull request addresses.]

Proposed Changes

[List the specific changes made in this pull request.]

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).]

snehitgajjar and others added 2 commits August 7, 2025 14:45
* Add support for additional context for PipelineState

* Clean up

* Clean up

* Clean up

* Nit

---------

Co-authored-by: Snehit Gajjar <[email protected]>
@AlonsoGuevara AlonsoGuevara requested a review from a team as a code owner August 7, 2025 20:54
@AlonsoGuevara AlonsoGuevara requested a review from Copilot August 7, 2025 20:57
Copilot

This comment was marked as outdated.

@natoverse
Copy link
Collaborator

Given that this is essentially just providing a way to pre-set some values in the context.json if it doesn't already exist, what would you think about naming it init_context or something like that, and then if present it just becomes the state from context.json instead of trying to read it?

@AlonsoGuevara
Copy link
Collaborator Author

Given that this is essentially just providing a way to pre-set some values in the context.json if it doesn't already exist, what would you think about naming it init_context or something like that, and then if present it just becomes the state from context.json instead of trying to read it?

Thanks for the suggestion, @natoverse.

  • Why I kept additional_context: We will be using that bag to pass non-serializable / runtime-only objects (e.g., open DB connections, in-memory caches) that we don’t want written to context.json.

  • Why I left context.json as-is: That file persists essential, serializable state between runs so our core workflows can pick it up the next time.

Because those two buckets serve different purposes (ephemeral vs. persisted), renaming to init_context and overriding the whole JSON file would conflate them.

If we still feel the name is confusing, I’m open to alternatives—maybe something like runtime_context or volatile_context to emphasise its non-persistent nature. Let me know what you think!

@natoverse
Copy link
Collaborator

Ok, that makes sense. I had thought you may be planning to allow non-serializable objects, but don't see where we exclude it when context.json is dumped.

@AlonsoGuevara AlonsoGuevara requested a review from Copilot August 7, 2025 23:02
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for passing additional context to GraphRAG pipeline runs through a new additional_context parameter. This enables custom workflows to access user-defined parameters during pipeline execution.

  • Adds additional_context parameter to both API and pipeline execution layers
  • Stores additional context in pipeline state under additional_context key
  • Excludes additional context from persisted state to avoid potential serialization issues

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
graphrag/api/index.py Adds additional_context parameter to build_index API function with documentation
graphrag/index/run/run_pipeline.py Implements additional context storage in pipeline state and excludes it from JSON serialization
.semversioner/next-release/minor-20250807204918927024.json Version bump configuration for minor release

@AlonsoGuevara AlonsoGuevara merged commit 5713205 into main Aug 8, 2025
16 checks passed
@AlonsoGuevara AlonsoGuevara deleted the feat/additional_context branch August 8, 2025 22:59
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.

4 participants