Wire _resolve_embeddings into _run_hybrid_search (sync + async) and plumb generator through dispatcher
Parent: 46729
Depends on: 46732
Goal
Make the new helper actually run on real queries. Also fail-fast when the gateway returns an embeddingParameterMap but no generator is configured.
Scope
azure/cosmos/_execution_context/execution_dispatcher.py :: _ProxyQueryExecutionContext._create_pipelined_execution_context – pass self._options through unchanged (already happens; just confirm embeddingGenerator survives).
_HybridSearchContextAggregator._run_hybrid_search:
- After the rewrite step (where
rewritten_query_infos are constructed)
- Before the per-partition document-producer fan-out
- call
self._resolve_embeddings().
- Mirror in
aio/hybrid_search_aggregator.py – await _resolve_embeddings_async() from the async _run_hybrid_search.
- Make sure the augmented
self._parameters is what _attach_parameters consumes when building per-component queries.
Backward compatibility
- If no plan field and no generator: zero behavior change.
- If plan has the field but generator is missing: clean
ValueError with a message that names the option (embedding_generator) — see 46732.
- If generator is configured but plan doesn't ask for embeddings: no-op (helper returns early).
Files touched
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/hybrid_search_aggregator.py
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/aio/hybrid_search_aggregator.py
- (Possibly)
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/execution_dispatcher.py if option propagation needs explicit hand-off.
Acceptance
- A hybrid-search query with
embedding_generator set, against a mock plan that returns one entry in embeddingParameterMap, produces per-component queries whose parameters list includes @documentdb-hybridsearchquery-embedding-0 with the mocked vector.
- Existing hybrid-search emulator tests still pass with no
embedding_generator set.
- Sync and async paths covered.
Wire
_resolve_embeddingsinto_run_hybrid_search(sync + async) and plumb generator through dispatcherParent: 46729
Depends on: 46732
Goal
Make the new helper actually run on real queries. Also fail-fast when the gateway returns an
embeddingParameterMapbut no generator is configured.Scope
azure/cosmos/_execution_context/execution_dispatcher.py :: _ProxyQueryExecutionContext._create_pipelined_execution_context– passself._optionsthrough unchanged (already happens; just confirmembeddingGeneratorsurvives)._HybridSearchContextAggregator._run_hybrid_search:rewritten_query_infosare constructed)self._resolve_embeddings().aio/hybrid_search_aggregator.py– await_resolve_embeddings_async()from the async_run_hybrid_search.self._parametersis what_attach_parametersconsumes when building per-component queries.Backward compatibility
ValueErrorwith a message that names the option (embedding_generator) — see 46732.Files touched
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/hybrid_search_aggregator.pysdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/aio/hybrid_search_aggregator.pysdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/execution_dispatcher.pyif option propagation needs explicit hand-off.Acceptance
embedding_generatorset, against a mock plan that returns one entry inembeddingParameterMap, produces per-component queries whoseparameterslist includes@documentdb-hybridsearchquery-embedding-0with the mocked vector.embedding_generatorset.