@@ -440,6 +440,7 @@ async def test_user_facing_ids_translated_to_internal_ids(
440440 byok_rag_mock .rag_id = "my-kb"
441441 byok_rag_mock .vector_db_id = "vs-internal-001"
442442 config_mock .configuration .byok_rag = [byok_rag_mock ]
443+ config_mock .configuration .rag .inline = ["my-kb" ]
443444 config_mock .score_multiplier_mapping = {"vs-internal-001" : 1.0 }
444445 config_mock .rag_id_mapping = {"vs-internal-001" : "my-kb" }
445446 mocker .patch ("utils.vector_search.configuration" , config_mock )
@@ -479,6 +480,7 @@ async def test_multiple_user_facing_ids_each_translated(
479480 byok_rag_2 .rag_id = "kb-part2"
480481 byok_rag_2 .vector_db_id = "vs-bbb-222"
481482 config_mock .configuration .byok_rag = [byok_rag_1 , byok_rag_2 ]
483+ config_mock .configuration .rag .inline = ["kb-part1" , "kb-part2" ]
482484 config_mock .score_multiplier_mapping = {"vs-aaa-111" : 1.0 , "vs-bbb-222" : 1.0 }
483485 config_mock .rag_id_mapping = {
484486 "vs-aaa-111" : "kb-part1" ,
@@ -513,6 +515,46 @@ async def test_multiple_user_facing_ids_each_translated(
513515 assert "kb-part1" not in call_args
514516 assert "kb-part2" not in call_args
515517
518+ @pytest .mark .asyncio
519+ async def test_no_inline_rag_configured_skips_byok (
520+ self , mocker : MockerFixture
521+ ) -> None :
522+ """Test that BYOK inline RAG is skipped when rag.inline is empty."""
523+ config_mock = mocker .Mock (spec = AppConfig )
524+ config_mock .configuration .rag .inline = []
525+ config_mock .configuration .byok_rag = []
526+ mocker .patch ("utils.vector_search.configuration" , config_mock )
527+
528+ client_mock = mocker .AsyncMock ()
529+
530+ rag_chunks , referenced_docs = await _fetch_byok_rag (
531+ client_mock , "test query" , vector_store_ids = ["some-id" ]
532+ )
533+
534+ assert rag_chunks == []
535+ assert referenced_docs == []
536+ client_mock .vector_io .query .assert_not_called ()
537+
538+ @pytest .mark .asyncio
539+ async def test_request_id_not_in_inline_config_skips_byok (
540+ self , mocker : MockerFixture
541+ ) -> None :
542+ """Test that a request vector_store_id not registered in rag.inline is filtered out."""
543+ config_mock = mocker .Mock (spec = AppConfig )
544+ config_mock .configuration .rag .inline = ["registered-id" ]
545+ config_mock .configuration .byok_rag = []
546+ mocker .patch ("utils.vector_search.configuration" , config_mock )
547+
548+ client_mock = mocker .AsyncMock ()
549+
550+ rag_chunks , referenced_docs = await _fetch_byok_rag (
551+ client_mock , "test query" , vector_store_ids = ["unregistered-id" ]
552+ )
553+
554+ assert rag_chunks == []
555+ assert referenced_docs == []
556+ client_mock .vector_io .query .assert_not_called ()
557+
516558
517559class TestFetchSolrRag :
518560 """Tests for _fetch_solr_rag async function."""
0 commit comments