Remove hidden foundation model initialization for byokg-graph (#183)#184
Open
mykola-pereyma wants to merge 6 commits intoawslabs:mainfrom
Open
Remove hidden foundation model initialization for byokg-graph (#183)#184mykola-pereyma wants to merge 6 commits intoawslabs:mainfrom
mykola-pereyma wants to merge 6 commits intoawslabs:mainfrom
Conversation
ByoKGQueryEngine.__init__() silently created a BedrockGenerator with hardcoded model/region when llm_generator was not provided, forcing a Bedrock dependency on users who bring their own KG without needing an LLM. - Remove hidden BedrockGenerator default creation - Gate AgenticRetriever and KGLinker auto-creation on llm_generator being provided - Add early return in query() when kg_linker is None - Add ValueError in generate_response() when llm_generator is None - Update test_initialization_with_defaults to reflect new behavior
Add llm_generator=llm_generator to all ByoKGQueryEngine constructor calls across 5 example notebooks. For the embeddings notebook, also add BedrockGenerator import and instantiation since it had no LLM setup.
- configuration.md: llm_generator default changed from Auto-created to None, triplet_retriever/kg_linker defaults clarified as conditional on llm_generator - overview.md: clarify LLM must be explicitly configured via BedrockGenerator - query-engine.md: all examples now include llm_generator, basic init shows full BedrockGenerator setup - faq.md: all ByoKGQueryEngine examples include llm_generator - multi-strategy-retrieval.md: all examples include llm_generator
Replace legacy anthropic.claude-3-7-sonnet-20250219-v1:0 with active anthropic.claude-sonnet-4-20250514-v1:0 as the default model_name.
…net 4 Replace us.anthropic.claude-3-7-sonnet-20250219-v1:0 with us.anthropic.claude-sonnet-4-20250514-v1:0 across all 5 byokg-rag example notebooks.
1d8d739 to
58991dd
Compare
Replace all legacy model IDs in configuration.md, faq.md, and query-engine.md with active equivalents: - Claude 3.5/3.7 Sonnet -> Claude Sonnet 4 - Claude 3 Opus -> Claude Opus 4.1 - Claude 3 Haiku -> Claude Haiku 4.5
58991dd to
61e036d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #183
Description
Resolves the issue where
ByoKGQueryEnginesilently creates aBedrockGeneratorwith a hardcoded model and region whenllm_generatoris not provided, forcing a Bedrock dependency on users who only need graph traversal.Changes
Core fix (
byokg_query_engine.py):BedrockGeneratordefault —llm_generatorstaysNoneif not providedAgenticRetrieverandKGLinkerare now only auto-created whenllm_generatoris explicitly providedquery()returns gracefully when no linker is configuredgenerate_response()raises a clearValueErrorwhen called withoutllm_generatorModel ID updates (
bedrock_llms.py, notebooks, docs):anthropic.claude-3-7-sonnet-20250219-v1:0→anthropic.claude-sonnet-4-20250514-v1:0Notebooks (5 files):
llm_generator=llm_generatorto allByoKGQueryEngineconstructor callsBedrockGeneratorsetup to the embeddings notebook which previously had noneDocumentation (5 files):
llm_generatormust be explicitly provided for LLM-powered featuresTesting
llm_generatorpath: query + generate works, ground-truth answer retrievedquery()returns empty list,generate_response()raisesValueErrorBackward compatibility
llm_generator— behavior is identicalBedrockGeneratorinitializationBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.