Rework on-demand embedding config, drop CaVa tokenizer, migrate to oa-configurator 1.0 - #34
Draft
nicoloesch wants to merge 5 commits into
Draft
Rework on-demand embedding config, drop CaVa tokenizer, migrate to oa-configurator 1.0#34nicoloesch wants to merge 5 commits into
nicoloesch wants to merge 5 commits into
Conversation
This was referenced Aug 7, 2026
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.
Summary
KnowledgeGraphEmbeddingConfigurationreworked:-
backend: EmbeddingBackendandresolved_model: ResolvedModelboth required fields (not Optional)write: bool/compute_missing_embeddings: bool/faiss_cache_dir: str | None.model_name/provider_typeare now plain properties reading straight offresolved_model(.model/.provider.provider)__post_init__TypeErroron a read-only-configured KGget_embedding_writer_interface()(raises, for call sites that already guarantee write) from a newtry_get_embedding_writer_interface()(never raises, for opportunistic on-demand use).utils/text_utils.py,OMOPTextAnnotatorInterface'stokenizerparam)annotate_text()already grounds the whole text in one call rather than iterating spans.OmopGraphConfig:required_resources/owned_resourcescollapse into a singlecdm_db: RefTo(CDMDatabaseConfig)field, andOmopAlchemyConfig.embedding_model_name/vector_store_nameRefTofields (ModelConfig/VectorStoreConfig), meaning no configuration necessaryRelationship to open PRs and issues
Config resolution boundary, absorbs
omop-graph#30/#31(30-remove-config-reads)Absorbs Remove config calls from internal functions and expose only at interf… #31 rather than merged standalone. Its design is adopted here, taken further than the original PR did.
graph/paths.py:find_shortest_paths/find_shortest_paths_batch/find_standard_pathstake plainmax_depth: int = 6/max_paths: int = 20defaults.OmopGraphConfig.get_config()read; caller supplies the resolved value.reasoning/grounding.py:GroundingConstraints.max_depthis a plainint = 6, same fix,default_factoryremoved.graph/kg.py's.embproperty: no longer importsomop_emb.config/OmopEmbConfigat all.#31, which only updated theresolve_backend()call's parameters but kept theOmopEmbConfig.get_config()read forfaiss_cache_dir.KnowledgeGraphEmbeddingConfigurationnow accepts an already-constructedEmbeddingBackendas a parameter (plus, for the read-only path,faiss_cache_dir: str | None). The caller resolves the vector store itself via the newvector_storesdomain and passes the built backend in. omop-graph resolves nothing.oaklib_interface/omop_implementation.py:OMOPAlchemyImplementation.__init__'s silent no-argsomop_resource()fallback removed. RaisesValueErrornaming the explicit fix (resource=omop_resource()) when neitherengine_stringnorresourceis given.annotate_text()gains an explicitmax_depth: Optional[int] = Noneparameter, consistent with how this method already extends OAK's baseTextAnnotatorInterfacesignature withquery_embedding/annotations. Threaded intoGroundingConstraints(max_depth=...)when given. No config read inside this method; the caller resolves its own value.Docstring
Notessection added toOmopGraphConfig.RAG context
reasoning/grounding.py: new_query_text_with_context(query: str, context: Optional[str]) -> strhelperground_term()gainscontext: Optional[str] = None-> no effect when omitted or whenquery_embeddingis supplied directly.#29design's docstring rationale referencedomop-emb's embedding-error wrapping (EmbeddingClientError) as the reason no length guard is needed here.omop_llm-based worldany_llm.exceptions.ContextLengthExceededError(surfaced raw, uncaught, throughomop_emb/omop_llm) as what actually surfaces an oversized-input failure now.contextis a caller responsibility, not something this function can validate.Semver ranges