Skip to content

fix: update example notebook imports to match v3 module structure (fixes #2356)#2387

Open
hanhan761 wants to merge 1 commit into
microsoft:mainfrom
hanhan761:fix-2356-notebook-imports
Open

fix: update example notebook imports to match v3 module structure (fixes #2356)#2387
hanhan761 wants to merge 1 commit into
microsoft:mainfrom
hanhan761:fix-2356-notebook-imports

Conversation

@hanhan761
Copy link
Copy Markdown

Summary

Fix the example notebook imports that were broken by the monorepo refactoring. The old graphrag.config.enums.ModelType, graphrag.config.models.language_model_config.LanguageModelConfig, and graphrag.language_model.manager.ModelManager no longer exist in v3.

Changes

Updated docs/examples_notebooks/local_search.ipynb:

  • Replaced LanguageModelConfig with ModelConfig from graphrag_llm.config
  • Replaced ModelManager().get_or_create_chat_model() with completion_factory.create() from graphrag_llm.completion.completion_factory
  • Replaced ModelManager().get_or_create_embedding_model() with embedding_factory.create() from graphrag_llm.embedding.embedding_factory
  • Removed now-unnecessary type field (provider is specified via model_provider string)

Issue

Fixes #2356

Notes

Other notebooks (global_search.ipynb, drift_search.ipynb, global_search_with_dynamic_community_selection.ipynb) have similar broken imports but require additional analysis of their API usage patterns.

@hanhan761 hanhan761 requested a review from a team as a code owner May 30, 2026 12: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.

[Bug]: <title> ImportError in v3.0.9 - cannot import name 'ModelType' from 'graphrag.config.enums'

1 participant