File size: 944 Bytes
fd1b271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from langchain.agents import Tool
from langchain_core.tools import StructuredTool

from config import SanatanConfig
from push_notifications_helper import push
from serperdev_helper import search as search_web
from sanatan_assistant import format_scripture_answer, query

tool_push = Tool(
    name="push", description="Send a push notification to the user", func=push
)

allowed_collections = [s["collection_name"] for s in SanatanConfig.scriptures]

tool_search_db = StructuredTool.from_function(
    query,
    description=(
        "Search within a specific scripture collection. "
        f"The collection_name must be one of: {', '.join(allowed_collections)}."
        " Use this to find relevant scripture verses or explanations."
    ),
)

tool_search_web = Tool(
    name="search_web", description="Search the web for information", func=search_web
)

tool_format_scripture_answer = StructuredTool.from_function(format_scripture_answer)