-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path__init__.py
41 lines (30 loc) · 1.12 KB
/
__init__.py
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
SEARCH_TARGETS = ["courtlistener"]
"""
List of of "tools" this RAG pipeline can use to pull information from.
See details in `README.md` under "Adding new tools".
"""
class SearchTarget:
"""
Base class for all search targets.
Inherit this class to let OLAW use a new tool.
"""
RESULTS_DATA_FORMAT = {
"text": "", # Full text
"prompt_text": "", # Line of text used as part of the RAG prompt to introduce this source.
"ui_text": "", # Line of text used as part of the UI to introduce this source.
"ui_url": "", # URL used to let users explore this source.
}
@staticmethod
def search(search_statement: str) -> list:
raise NotImplementedError
from .courtlistener import CourtListener # noqa
def route_search(search_target: str, search_statement: str):
"""
Routes a search to the right handler.
"""
if search_target not in SEARCH_TARGETS:
raise Exception("Invalid search target")
search_results = []
if search_target == "courtlistener":
search_results = CourtListener.search(search_statement)
return search_results