Skip to content

Add user-provided entity types to prompt tuning#2422

Open
YingzuoLiu wants to merge 1 commit into
microsoft:mainfrom
YingzuoLiu:feature-1802-entity-types
Open

Add user-provided entity types to prompt tuning#2422
YingzuoLiu wants to merge 1 commit into
microsoft:mainfrom
YingzuoLiu:feature-1802-entity-types

Conversation

@YingzuoLiu

Copy link
Copy Markdown

Description

Adds support for user-provided entity types during prompt tuning.

Prompt tuning previously supported automatic entity type discovery via --discover-entity-types, but there was no direct way for users to seed the prompt tuning flow with entity types they already care about. This PR adds an --entity-types CLI option and passes those values through the prompt tuning API.

When entity discovery is enabled, user-provided entity types are merged with discovered entity types while preserving user-provided order and deduplicating repeated values. When discovery is disabled, the provided entity types are used directly.

Related Issues

Fixes #1802

Proposed Changes

  • Add an entity_types parameter to generate_indexing_prompts().
  • Add --entity-types to the prompt-tune CLI.
  • Parse comma-separated entity types from the CLI.
  • Normalize and deduplicate user-provided and generated entity types.
  • Add unit tests for parsing, normalization, and merge behavior.
  • Add a semversioner minor change entry.

Validation

Ran locally:

uv run ruff check \
  packages/graphrag/graphrag/api/prompt_tune.py \
  packages/graphrag/graphrag/cli/prompt_tune.py \
  packages/graphrag/graphrag/cli/main.py \
  tests/unit/graphrag/prompt_tune/test_entity_types.py \
  tests/unit/graphrag/prompt_tune/__init__.py

uv run pytest tests/unit/graphrag/prompt_tune/test_entity_types.py

Result:

All checks passed
6 passed

Checklist

  • I have tested these changes locally.
  • I have reviewed the code changes.
  • I have updated the documentation if necessary. CLI help text was updated for the new option.
  • I have added appropriate unit tests.

@YingzuoLiu YingzuoLiu requested a review from a team as a code owner July 5, 2026 14:12
@YingzuoLiu

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

[Feature Request]: Specify the entity types of interest during auto tuning

1 participant