File size: 1,125 Bytes
5684a32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
RAG (Retrieval-Augmented Generation) module for Boston Public Library catalog search.

This package provides a modular RAG system for searching and discovering materials
in the Boston Public Library's Digital Commonwealth collection.

Main exports:
- RAG: Main pipeline function
- Models: QueryRewrite, CatalogResponse, MaterialType, SearchFilters
"""

from .pipeline import RAG
from .models import QueryRewrite, CatalogResponse, MaterialType, SearchFilters
from .query_enhancement import rephrase_and_expand_query
from .filters import extract_filters_with_llm, build_sql_filter
from .retrieval import retrieve_from_pg
from .reranking import rerank
from .response import generate_catalog_summary, parse_json_response

__all__ = [
    # Main pipeline
    "RAG",
    
    # Models
    "QueryRewrite",
    "CatalogResponse",
    "MaterialType",
    "SearchFilters",
    
    # Components (for testing/debugging)
    "rephrase_and_expand_query",
    "extract_filters_with_llm",
    "build_sql_filter",
    "retrieve_from_pg",
    "rerank",
    "generate_catalog_summary",
    "parse_json_response",
]