-
Notifications
You must be signed in to change notification settings - Fork 414
Expand file tree
/
Copy pathhybrid.yaml
More file actions
63 lines (61 loc) · 2.97 KB
/
Copy pathhybrid.yaml
File metadata and controls
63 lines (61 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# This example demonstrates:
# 1. Running multiple retrieval strategies in a single RAG source
# 2. Shared docs across all strategies
# 3. Strategy-specific additional docs
# 4. Per-strategy limits for fusion input
# 5. Final limit after fusion
# 6. Full hybrid retrieval with RRF
agents:
root:
model: openai/gpt-5-mini
description: assistant with hybrid search
instruction: |
You are a helpful assistant with access to hybrid retrieval
combining semantic and keyword search for comprehensive results.
toolsets:
- type: rag
ref: knowledge_base
rag:
knowledge_base:
tool:
description: to be used to search for information about blorks
docs:
- ./blork_field_guide.txt # Shared across both strategies
strategies:
# Chunked embeddings strategy for semantic search
- type: chunked-embeddings
embedding_model: openai/text-embedding-3-small
docs:
- ./docs # Additional docs for chunked-embeddings strategy only
database: ./chunked_embeddings.db # chunked-embeddings database to use; path to local sqlite database
similarity_metric: cosine_similarity # similarity metric (default: cosine_similarity)
threshold: 0.5 # cosine similarity threshold (0-1, default: 0.5)
limit: 20 # Chunked embeddings retrieves top 20 candidates
batch_size: 100 # chunks per embedding API call (default: 50, max: 2048 for OpenAI)
max_embedding_concurrency: 5 # concurrent embedding batch requests (default: 5)
vector_dimensions: 1536 # vector dimensions of the model in use
chunking:
size: 1000
overlap: 100
respect_word_boundaries: true
# BM25 strategy for keyword matching
- type: bm25
docs:
- ./docs # Additional docs for BM25 strategy only
database: ./bm25.db # where to store the BM25 database (path to local sqlite database)
k1: 1.5 # term frequency saturation (default: 1.5)
b: 0.75 # length normalization (default: 0.75)
threshold: 0.3 # BM25 score threshold (default: 0.0)
limit: 15 # Get the top 15 candidates
chunking:
size: 1000
overlap: 100
respect_word_boundaries: true
# Results fusion and limiting
results:
fusion: # Configures how to combine the results from the different strategies
strategy: rrf # Fuses up to 20+15=35 total candidates with RRF (Reciprocal Rank Fusion)
k: 60 # RRF smoothing parameter
deduplicate: true # remove duplicates from the results
limit: 5 # Final: return top 5 after fusion
# return_full_content: true # Return full document instead of chunks (default: false)