Skip to content

fix: update example notebooks to use current graphrag_llm API#2327

Open
octo-patch wants to merge 1 commit intomicrosoft:mainfrom
octo-patch:fix/issue-2301-update-example-notebooks
Open

fix: update example notebooks to use current graphrag_llm API#2327
octo-patch wants to merge 1 commit intomicrosoft:mainfrom
octo-patch:fix/issue-2301-update-example-notebooks

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #2301

Problem

The example notebooks (local_search.ipynb, global_search.ipynb, drift_search.ipynb, global_search_with_dynamic_community_selection.ipynb) use removed/renamed APIs that no longer exist in the current codebase:

  • from graphrag.config.enums import ModelTypeModelType was removed from enums.py
  • from graphrag.config.models.language_model_config import LanguageModelConfig → module does not exist
  • from graphrag.language_model.manager import ModelManager → module does not exist
  • from graphrag_vectors import LanceDBVectorStoreLanceDBVectorStore is not exported from the top-level graphrag_vectors package

These broken imports cause ImportError and NameError when users try to run the example notebooks.

Solution

Replace deprecated imports and model creation patterns with the current graphrag_llm API:

  • ModelType + LanguageModelConfigModelConfig from graphrag_llm.config
  • ModelManager().get_or_create_chat_model(...)create_completion(config) from graphrag_llm.completion
  • ModelManager().get_or_create_embedding_model(...)create_embedding(config) from graphrag_llm.embedding
  • get_tokenizer(config)chat_model.tokenizer (tokenizer is already available on the model object)
  • from graphrag_vectors import LanceDBVectorStorefrom graphrag_vectors.lancedb import LanceDBVectorStore

These replacements align the notebooks with how the query/factory.py internally constructs models.

Testing

Verified the corrected imports match what is actually exported by the current graphrag_llm and graphrag_vectors packages in the repository.

…icrosoft#2301)

Replace deprecated imports (ModelType, LanguageModelConfig, ModelManager)
with the current graphrag_llm equivalents (ModelConfig, create_completion,
create_embedding). Also fix LanceDBVectorStore import path in local_search.ipynb.
@octo-patch octo-patch requested a review from a team as a code owner April 18, 2026 01:45
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.

[Bug]: Example notebooks code is incorrect (not updated)

1 participant