-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools.py
More file actions
36 lines (29 loc) · 1.17 KB
/
Copy pathtools.py
File metadata and controls
36 lines (29 loc) · 1.17 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
# # tools.py
# import streamlit as st
# from supabase.client import Client, create_client
# from langchain_community.embeddings import FakeEmbeddings
# from langchain_community.vectorstores import SupabaseVectorStore
# from langchain_community.tools import create_retriever_tool
# from langchain_community.tools import DuckDuckGoSearchRun
# from utils.snow_connect import SnowflakeConnection
# supabase_url = st.secrets["SUPABASE_URL"]
# supabase_key = st.secrets["SUPABASE_SERVICE_KEY"]
# client: Client = create_client(supabase_url, supabase_key)
# embeddings = FakeEmbeddings(size=768)
# vectorstore = SupabaseVectorStore(
# embedding=embeddings,
# client=client,
# table_name="documents",
# query_name="v_match_documents",
# )
# retriever_tool = create_retriever_tool(
# vectorstore.as_retriever(),
# name="Database_Schema",
# description="Search for database schema details",
# )
# search = DuckDuckGoSearchRun()
# def sql_executor_tool(query: str, use_cache: bool = True) -> str:
# conn = SnowflakeConnection()
# return conn.execute_query(query, use_cache)
# def retrieve_data(query: str) -> str:
# return sql_executor_tool(query, use_cache=True)