GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [Bug]: RAGMiddleware drops all knowledge-base context when one knowledge base cannot embed an attachment · Issue #3975 · agentscope-ai/agentscope Closed Labels triage/confirmedVerified: the reported defect exists DescriptionPrerequisites
Related: #3649 and #3656 cover sibling vector queries inside one Background / Description
For example, take a support agent with a text knowledge base of store policies and an image knowledge base of product photos. A customer attaches an invoice PDF and asks about returns. The agent answers without the return policy, and the only trace is an ERROR log line. The same coupling applies when one knowledge base fails for any other reason, such as an unavailable embedding provider or vector store. In agentic mode the queries are text only, but there too one failing knowledge base makes the Expected behavior: a knowledge base whose search fails is logged and skipped, and the others still contribute, much as a failing reranker already falls back to the vector order (source). When every knowledge base fails, the current behavior can stay. Error Messages / Observed BehaviorThe reproduction below prints: The first line is the control: the same message with only the text knowledge base. In the second run the middleware logs: Steps to Reproduce
"""RAGMiddleware static mode: one knowledge base that cannot embed an attachment drops the context of every knowledge base. Runs offline: the DashScope multimodal model rejects the PDF block while building the request, before any API call. """ import asyncio from types import SimpleNamespace import dashscope from agentscope.credential import DashScopeCredential from agentscope.embedding import DashScopeEmbeddingModel, EmbeddingResponse from agentscope.message import ( Base64Source, DataBlock, HintBlock, Msg, TextBlock, ) from agentscope.middleware import RAGMiddleware from agentscope.rag import Chunk, KnowledgeBase, QdrantStore, VectorRecord api_calls = [] dashscope.MultiModalEmbedding.call = lambda **kw: api_calls.append(kw) class TextEmbedding: """Offline stand-in for a text-only embedding model.""" supports_multimodal = False dimensions = 3 async def __call__(self, inputs): return EmbeddingResponse(embeddings=[[1.0, 0.0, 0.0]] * len(inputs)) async def hints_seen(knowledge_bases, msg): """Run one static-mode reply; return the hints the model would see.""" middleware = RAGMiddleware( knowledge_bases=knowledge_bases, parameters=RAGMiddleware.Parameters(mode="static"), ) context, seen = [], [] def append_context(name, blocks): carrier = Msg(name=name, role="assistant", content=blocks) carrier.id = "reply-1" context.append(carrier) state = SimpleNamespace(context=context, reply_id="reply-1", session_id="s-1", cur_iter=0, append_context=append_context) agent = SimpleNamespace(name="assistant", state=state) async def reasoning(**_): seen.extend(b.hint for m in context for b in m.content if isinstance(b, HintBlock)) yield "reasoning" async def reply(**_): async for evt in middleware.on_reasoning( agent=agent, input_kwargs={}, next_handler=reasoning, ): yield evt async for _ in middleware.on_reply( agent=agent, input_kwargs={"inputs": msg}, next_handler=reply, ): pass return seen async def main(): async with QdrantStore(location=":memory:") as store: await store.create_collection("policies", dimensions=3) await store.insert("policies", [VectorRecord( vector=[1.0, 0.0, 0.0], document_id="returns", chunk=Chunk( content=TextBlock(text="Items can be returned within 30 days."), source="returns.md", chunk_index=0, total_chunks=1, ), )]) policies = KnowledgeBase( name="policies", description="Store policies.", embedding_model=TextEmbedding(), vector_store=store, collection="policies", ) catalog = KnowledgeBase( name="catalog", description="Product photos.", embedding_model=DashScopeEmbeddingModel( credential=DashScopeCredential(api_key="sk-offline"), model="multimodal-embedding-v1", dimensions=1024, ), vector_store=store, collection="catalog", ) question = TextBlock(text="How long do I have to return this order?") invoice = DataBlock(source=Base64Source( media_type="application/pdf", data="JVBERi0xLjQK", )) msg = Msg(name="user", role="user", content=[question, invoice]) for kbs in ([policies], [policies, catalog]): hints = await hints_seen(kbs, msg) print(f"{'+'.join(kb.name for kb in kbs):<17}: " f"{len(hints)} hint(s), " f"has the return policy: {any('30 days' in h for h in hints)}") try: await catalog.search([question, invoice]) except ValueError as e: print(f"catalog.search : ValueError: {e}") print(f"DashScope API calls: {len(api_calls)}") asyncio.run(main())
python -m pip install -e ".[vdb-qdrant]"
python repro_rag_kb_failure.pyNo network access or credentials are needed. The API key is a placeholder, and the script replaces the DashScope SDK call with a counter, which stays at 0. Environment
Proposed ScopeWould it fit for A single multimodal knowledge base would still lose the text part of such a turn, because all inputs go into one embedding call. Skipping blocks outside the model card's Claude Code assisted with source inspection, duplicate searches, and the offline reproduction. I have not started a fix. Activity
MetadataMetadataAssigneesLabelstriage/confirmedVerified: the reported defect exists TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |