Dynamically select different knowledge bases

I need the agent to query different collections or databases. The vector database I’m using is Milvus. However, I noticed that when building Milvus, only one collection can be specified and the database is always the default “default”. So I customized the knowledge_retriever and selected the database and collection, and everything worked well. But I hope the database name and collection name can be dynamically passed in through the agent. I haven’t found a proper way to receive any parameters passed when calling the Post /agents/{agent_id}/runs interface in the customized knowledge_retriever. When I try to print **kwargs, it’s always empty. Here is my code:
def search_for_jfr(
agent: Agent,
query: str,
num_documents: Optional[int] = 5,
**kwargs) → Optional[list[dict]] :
print(f"kwargs:{kwargs}")
connect_milvus()
db.using_database(“default”)

coll = Collection("jfr_goods")
coll.load()

vec = ollama_embed(\[query\])\[0\]
q = l2_normalize(vec)

res = coll.search(
    data=\[q\],
    anns_field="text_vector",
    param={"metric_type": "COSINE", "params": {"nprobe": 16}},
    limit=num_documents,
    output_fields=\["\*"\]
)

results = \[\]
for hit in res\[0\]:
    content = {
        "productID": hit.entity.get("id"),
        "productName": hit.entity.get("goods_name"),
        "price": f"¥{hit.entity.get('price')}",
        "store": hit.entity.get("store_name"),
        "status": hit.entity.get("market_enable"),
        "inventory": hit.entity.get("quantity"),
        "productType": hit.entity.get("goods_type"),
        "sales_volume": hit.entity.get("buy_count"),
        "originalImage": hit.entity.get("original_image"),
        "whether_it_is_self_operated": "yse" if hit.entity.get("self_operated") else "no",
        "similarityScore": round(float(hit.distance), 4)
    }
    results.append(content)
print(f"format_the_search_results:{results}")
return results

def get_jfr_agent():
jfr_product = Milvus(
uri = f"http://{config.MILVUS_HOST}:{config.MILVUS_PORT}",
collection = “jfr_goods”,
embedder = embedder
)
jfr_product_knowledge = Knowledge(vector_db=jfr_product)

assistant = Agent(
    name = "jfr_assistant",
    role="answer_the_questions_based_on_the_knowledge_base",
    model = OpenAILike(
        id = "qwen-plus",
        api_key = "sk-7ff2d2d2ee5b41a99c59e381c72aa75e",
        base_url = "https://dashscope.aliyuncs.com/compatible-mode/v1",
    ),
    knowledge_retriever=search_for_jfr,
    add_history_to_context = True,
    db = pg_db,
    add_knowledge_to_context = True,
    knowledge = jfr_product_knowledge,
    markdown = True
)
return assistant

Hey @LBWhite55, thanks for reaching out and supporting Agno. I’ve shared this with the team, we’re working through all requests one by one and will get back to you soon.If it’s urgent, please let us know. We appreciate your patience!

hi @Monali
How is the situation developing?

Hi @LBWhite55, Apologies this must have slipped through. Our engineer, @anuragphi will be here to help you out

Hi,i m waitting for you reply

Hi @LBWhite55, we are very sorry for the delay here. I was OOO this whole week and this must have slipped through somehow. We will get back to you today, we promise.

Again I am extremely sorry

Hi @LBWhite55, We are actively working on this and will hopefully get it out sometime next week. This is a big feature request and will require lots of refactor in knowledge. We are making sure we test it well and release a polish piece