Spaces:
Running
Running
Luong Huu Thanh
commited on
Commit
·
9ff46a6
1
Parent(s):
88bc423
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -692,7 +692,7 @@ embeddings = HuggingFaceEmbeddings(
|
|
| 692 |
model_name="sentence-transformers/all-mpnet-base-v2"
|
| 693 |
) # dim=768
|
| 694 |
supabase: Client = create_client(
|
| 695 |
-
os.environ.get("SUPABASE_URL"), os.environ.get("
|
| 696 |
)
|
| 697 |
vector_store = SupabaseVectorStore(
|
| 698 |
client=supabase,
|
|
@@ -707,40 +707,31 @@ create_retriever_tool = create_retriever_tool(
|
|
| 707 |
)
|
| 708 |
|
| 709 |
|
| 710 |
-
# tools = [
|
| 711 |
-
# web_search,
|
| 712 |
-
# wiki_search,
|
| 713 |
-
# arxiv_search,
|
| 714 |
-
# multiply,
|
| 715 |
-
# add,
|
| 716 |
-
# subtract,
|
| 717 |
-
# divide,
|
| 718 |
-
# modulus,
|
| 719 |
-
# power,
|
| 720 |
-
# square_root,
|
| 721 |
-
# save_and_read_file,
|
| 722 |
-
# download_file_from_url,
|
| 723 |
-
# extract_text_from_image,
|
| 724 |
-
# analyze_csv_file,
|
| 725 |
-
# analyze_excel_file,
|
| 726 |
-
# execute_code_multilang,
|
| 727 |
-
# analyze_image,
|
| 728 |
-
# transform_image,
|
| 729 |
-
# draw_on_image,
|
| 730 |
-
# generate_simple_image,
|
| 731 |
-
# combine_images,
|
| 732 |
-
# ]
|
| 733 |
tools = [
|
|
|
|
|
|
|
|
|
|
| 734 |
multiply,
|
| 735 |
add,
|
| 736 |
subtract,
|
| 737 |
divide,
|
| 738 |
modulus,
|
| 739 |
-
|
| 740 |
-
|
| 741 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 742 |
]
|
| 743 |
|
|
|
|
| 744 |
# Build graph function
|
| 745 |
def build_graph(provider: str = "groq"):
|
| 746 |
"""Build the graph"""
|
|
@@ -802,7 +793,7 @@ def build_graph(provider: str = "groq"):
|
|
| 802 |
|
| 803 |
# test
|
| 804 |
if __name__ == "__main__":
|
| 805 |
-
question = ".
|
| 806 |
graph = build_graph(provider="groq")
|
| 807 |
messages = [HumanMessage(content=question)]
|
| 808 |
messages = graph.invoke({"messages": messages})
|
|
|
|
| 692 |
model_name="sentence-transformers/all-mpnet-base-v2"
|
| 693 |
) # dim=768
|
| 694 |
supabase: Client = create_client(
|
| 695 |
+
os.environ.get("SUPABASE_URL"), os.environ.get("SUPABASE_SERVICE_ROLE_KEY")
|
| 696 |
)
|
| 697 |
vector_store = SupabaseVectorStore(
|
| 698 |
client=supabase,
|
|
|
|
| 707 |
)
|
| 708 |
|
| 709 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 710 |
tools = [
|
| 711 |
+
web_search,
|
| 712 |
+
wiki_search,
|
| 713 |
+
arxiv_search,
|
| 714 |
multiply,
|
| 715 |
add,
|
| 716 |
subtract,
|
| 717 |
divide,
|
| 718 |
modulus,
|
| 719 |
+
power,
|
| 720 |
+
square_root,
|
| 721 |
+
save_and_read_file,
|
| 722 |
+
download_file_from_url,
|
| 723 |
+
extract_text_from_image,
|
| 724 |
+
analyze_csv_file,
|
| 725 |
+
analyze_excel_file,
|
| 726 |
+
execute_code_multilang,
|
| 727 |
+
analyze_image,
|
| 728 |
+
transform_image,
|
| 729 |
+
draw_on_image,
|
| 730 |
+
generate_simple_image,
|
| 731 |
+
combine_images,
|
| 732 |
]
|
| 733 |
|
| 734 |
+
|
| 735 |
# Build graph function
|
| 736 |
def build_graph(provider: str = "groq"):
|
| 737 |
"""Build the graph"""
|
|
|
|
| 793 |
|
| 794 |
# test
|
| 795 |
if __name__ == "__main__":
|
| 796 |
+
question = "When was a picture of St. Thomas Aquinas first added to the Wikipedia page on the Principle of double effect?"
|
| 797 |
graph = build_graph(provider="groq")
|
| 798 |
messages = [HumanMessage(content=question)]
|
| 799 |
messages = graph.invoke({"messages": messages})
|