Back to list
edangx100

routing

by edangx100

0🍴 0📅 Dec 22, 2025

SKILL.md


name: routing description: Routes queries to appropriate data sources (vectordb, web_search, direct_llm) and selects collections to search. Use when analyzing user queries, determining search strategy, or when the user mentions routing, collections, or data source selection.

Query Routing

Instructions

Route queries using route_query() in components/router.py. Returns routing decision with data source and collections to search.

Call once at pipeline start with the original query. Do NOT re-route during retries.

Default usage:

routing_decision = route_query(user_query)
route = routing_decision['route']  # "vectordb" | "web_search" | "direct_llm"

Route handling:

if route == 'vectordb':
    collections = routing_decision.get('collections', [])
    docs = query_specific_collections(query, collections)

elif route == 'web_search':
    docs = search_web(query, num_results=5)

elif route == 'direct_llm':
    docs = []  # Skip retrieval

Available collections (vectordb only):

  • catalog: Products, specs, pricing
  • faq: Policies, shipping, returns
  • troubleshooting: TechMart product support

Strategies (vectordb only):

  • single_collection: One clear match
  • multi_collection: 2-3 collections
  • comprehensive: All collections (vague queries)

Implementation: components/router.py, uses structured outputs to enforce valid routes.

Examples

Example 1: Product query → vectordb, catalog

# Input
result = route_query("What gaming laptops do you have?")

# Output
{
    "route": "vectordb",
    "strategy": "single_collection",
    "collections": ["catalog"],
    "reasoning": "Product inquiry about gaming laptops"
}

Example 2: Web search query

# Input
result = route_query("Windows 11 blue screen error 0x0000007E")

# Output
{
    "route": "web_search",
    "reasoning": "Current OS error requiring up-to-date information"
}

Example 3: Multi-collection query

# Input
result = route_query("Laptop not working, can I return it?")

# Output
{
    "route": "vectordb",
    "strategy": "multi_collection",
    "collections": ["troubleshooting", "faq"],
    "reasoning": "Combines technical issue with return policy question"
}

Example 4: Direct LLM (no retrieval)

# Input
result = route_query("Hello, thank you!")

# Output
{
    "route": "direct_llm",
    "reasoning": "Simple greeting, no retrieval needed"
}

Score

Total Score

50/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon