add files
Browse files- .gitattributes +1 -0
- app.py +217 -88
- knowledge/1f975693-876d-457b-a649-393859e79bf3.mp3 +3 -0
- knowledge/7bd855d8-463d-4ed5-93ca-5fe35145f733.xlsx +0 -0
- knowledge/99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3.mp3 +3 -0
- knowledge/cca530fc-4052-43b2-b130-b30968d8aa44.png +0 -0
- questions.json +121 -0
- requirements.txt +15 -6
- system_prompt.txt +17 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -1,94 +1,223 @@
|
|
|
|
|
| 1 |
import os
|
| 2 |
-
import gradio as gr
|
| 3 |
-
import requests
|
| 4 |
-
import pandas as pd
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
-
from
|
| 7 |
-
from
|
| 8 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
load_dotenv()
|
| 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 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
)
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""LangGraph Agent"""
|
| 2 |
import os
|
|
|
|
|
|
|
|
|
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
+
from langgraph.graph import START, StateGraph, MessagesState
|
| 5 |
+
from langgraph.prebuilt import tools_condition
|
| 6 |
+
from langgraph.prebuilt import ToolNode
|
| 7 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 8 |
+
from langchain_groq import ChatGroq
|
| 9 |
+
from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint, HuggingFaceEmbeddings
|
| 10 |
+
from langchain_community.tools.tavily_search import TavilySearchResults
|
| 11 |
+
from langchain_community.document_loaders import WikipediaLoader
|
| 12 |
+
from langchain_community.document_loaders import ArxivLoader
|
| 13 |
+
from langchain_community.vectorstores import SupabaseVectorStore
|
| 14 |
+
from langchain_core.messages import SystemMessage, HumanMessage
|
| 15 |
+
from langchain_core.tools import tool
|
| 16 |
+
from langchain.tools.retriever import create_retriever_tool
|
| 17 |
+
from supabase.client import Client, create_client
|
| 18 |
|
| 19 |
load_dotenv()
|
| 20 |
|
| 21 |
+
@tool
|
| 22 |
+
def multiply(a: int, b: int) -> int:
|
| 23 |
+
"""Multiply two numbers.
|
| 24 |
+
Args:
|
| 25 |
+
a: first int
|
| 26 |
+
b: second int
|
| 27 |
+
"""
|
| 28 |
+
return a * b
|
| 29 |
+
|
| 30 |
+
@tool
|
| 31 |
+
def add(a: int, b: int) -> int:
|
| 32 |
+
"""Add two numbers.
|
| 33 |
+
|
| 34 |
+
Args:
|
| 35 |
+
a: first int
|
| 36 |
+
b: second int
|
| 37 |
+
"""
|
| 38 |
+
return a + b
|
| 39 |
+
|
| 40 |
+
@tool
|
| 41 |
+
def subtract(a: int, b: int) -> int:
|
| 42 |
+
"""Subtract two numbers.
|
| 43 |
+
|
| 44 |
+
Args:
|
| 45 |
+
a: first int
|
| 46 |
+
b: second int
|
| 47 |
+
"""
|
| 48 |
+
return a - b
|
| 49 |
+
|
| 50 |
+
@tool
|
| 51 |
+
def divide(a: int, b: int) -> int:
|
| 52 |
+
"""Divide two numbers.
|
| 53 |
+
|
| 54 |
+
Args:
|
| 55 |
+
a: first int
|
| 56 |
+
b: second int
|
| 57 |
+
"""
|
| 58 |
+
if b == 0:
|
| 59 |
+
raise ValueError("Cannot divide by zero.")
|
| 60 |
+
return a / b
|
| 61 |
+
|
| 62 |
+
@tool
|
| 63 |
+
def modulus(a: int, b: int) -> int:
|
| 64 |
+
"""Get the modulus of two numbers.
|
| 65 |
+
|
| 66 |
+
Args:
|
| 67 |
+
a: first int
|
| 68 |
+
b: second int
|
| 69 |
+
"""
|
| 70 |
+
return a % b
|
| 71 |
+
|
| 72 |
+
@tool
|
| 73 |
+
def wiki_search(query: str) -> str:
|
| 74 |
+
"""Search Wikipedia for a query and return maximum 2 results.
|
| 75 |
+
|
| 76 |
+
Args:
|
| 77 |
+
query: The search query."""
|
| 78 |
+
search_docs = WikipediaLoader(query=query, load_max_docs=2).load()
|
| 79 |
+
formatted_search_docs = "\n\n---\n\n".join(
|
| 80 |
+
[
|
| 81 |
+
f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content}\n</Document>'
|
| 82 |
+
for doc in search_docs
|
| 83 |
+
])
|
| 84 |
+
return {"wiki_results": formatted_search_docs}
|
| 85 |
+
|
| 86 |
+
@tool
|
| 87 |
+
def web_search(query: str) -> str:
|
| 88 |
+
"""Search Tavily for a query and return maximum 3 results.
|
| 89 |
+
|
| 90 |
+
Args:
|
| 91 |
+
query: The search query."""
|
| 92 |
+
search_docs = TavilySearchResults(max_results=3).invoke(query=query)
|
| 93 |
+
formatted_search_docs = "\n\n---\n\n".join(
|
| 94 |
+
[
|
| 95 |
+
f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content}\n</Document>'
|
| 96 |
+
for doc in search_docs
|
| 97 |
+
])
|
| 98 |
+
return {"web_results": formatted_search_docs}
|
| 99 |
+
|
| 100 |
+
@tool
|
| 101 |
+
def arvix_search(query: str) -> str:
|
| 102 |
+
"""Search Arxiv for a query and return maximum 3 result.
|
| 103 |
+
|
| 104 |
+
Args:
|
| 105 |
+
query: The search query."""
|
| 106 |
+
search_docs = ArxivLoader(query=query, load_max_docs=3).load()
|
| 107 |
+
formatted_search_docs = "\n\n---\n\n".join(
|
| 108 |
+
[
|
| 109 |
+
f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content[:1000]}\n</Document>'
|
| 110 |
+
for doc in search_docs
|
| 111 |
+
])
|
| 112 |
+
return {"arvix_results": formatted_search_docs}
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
# load the system prompt from the file
|
| 117 |
+
with open("system_prompt.txt", "r", encoding="utf-8") as f:
|
| 118 |
+
system_prompt = f.read()
|
| 119 |
+
|
| 120 |
+
# System message
|
| 121 |
+
sys_msg = SystemMessage(content=system_prompt)
|
| 122 |
+
|
| 123 |
+
# build a retriever
|
| 124 |
+
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2") # dim=768
|
| 125 |
+
supabase: Client = create_client(
|
| 126 |
+
os.environ.get("SUPABASE_URL"),
|
| 127 |
+
os.environ.get("SUPABASE_SERVICE_KEY"))
|
| 128 |
+
vector_store = SupabaseVectorStore(
|
| 129 |
+
client=supabase,
|
| 130 |
+
embedding= embeddings,
|
| 131 |
+
table_name="documents",
|
| 132 |
+
query_name="match_documents_langchain",
|
| 133 |
+
)
|
| 134 |
+
create_retriever_tool = create_retriever_tool(
|
| 135 |
+
retriever=vector_store.as_retriever(),
|
| 136 |
+
name="Question Search",
|
| 137 |
+
description="A tool to retrieve similar questions from a vector store.",
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
tools = [
|
| 143 |
+
multiply,
|
| 144 |
+
add,
|
| 145 |
+
subtract,
|
| 146 |
+
divide,
|
| 147 |
+
modulus,
|
| 148 |
+
wiki_search,
|
| 149 |
+
web_search,
|
| 150 |
+
arvix_search,
|
| 151 |
+
]
|
| 152 |
+
|
| 153 |
+
# Build graph function
|
| 154 |
+
def build_graph(provider: str = "google"):
|
| 155 |
+
"""Build the graph"""
|
| 156 |
+
# Load environment variables from .env file
|
| 157 |
+
if provider == "google":
|
| 158 |
+
# Google Gemini
|
| 159 |
+
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
|
| 160 |
+
elif provider == "groq":
|
| 161 |
+
# Groq https://console.groq.com/docs/models
|
| 162 |
+
llm = ChatGroq(model="qwen-qwq-32b", temperature=0) # optional : qwen-qwq-32b gemma2-9b-it
|
| 163 |
+
elif provider == "huggingface":
|
| 164 |
+
# TODO: Add huggingface endpoint
|
| 165 |
+
llm = ChatHuggingFace(
|
| 166 |
+
llm=HuggingFaceEndpoint(
|
| 167 |
+
url="https://api-inference.huggingface.co/models/Meta-DeepLearning/llama-2-7b-chat-hf",
|
| 168 |
+
temperature=0,
|
| 169 |
+
),
|
| 170 |
)
|
| 171 |
+
else:
|
| 172 |
+
raise ValueError("Invalid provider. Choose 'google', 'groq' or 'huggingface'.")
|
| 173 |
+
# Bind tools to LLM
|
| 174 |
+
llm_with_tools = llm.bind_tools(tools)
|
| 175 |
+
|
| 176 |
+
# Node
|
| 177 |
+
def assistant(state: MessagesState):
|
| 178 |
+
"""Assistant node"""
|
| 179 |
+
return {"messages": [llm_with_tools.invoke(state["messages"])]}
|
| 180 |
+
|
| 181 |
+
# def retriever(state: MessagesState):
|
| 182 |
+
# """Retriever node"""
|
| 183 |
+
# similar_question = vector_store.similarity_search(state["messages"][0].content)
|
| 184 |
+
#example_msg = HumanMessage(
|
| 185 |
+
# content=f"Here I provide a similar question and answer for reference: \n\n{similar_question[0].page_content}",
|
| 186 |
+
# )
|
| 187 |
+
# return {"messages": [sys_msg] + state["messages"] + [example_msg]}
|
| 188 |
+
|
| 189 |
+
from langchain_core.messages import AIMessage
|
| 190 |
+
|
| 191 |
+
def retriever(state: MessagesState):
|
| 192 |
+
query = state["messages"][-1].content
|
| 193 |
+
similar_doc = vector_store.similarity_search(query, k=1)[0]
|
| 194 |
+
|
| 195 |
+
content = similar_doc.page_content
|
| 196 |
+
if "Final answer :" in content:
|
| 197 |
+
answer = content.split("Final answer :")[-1].strip()
|
| 198 |
+
else:
|
| 199 |
+
answer = content.strip()
|
| 200 |
+
|
| 201 |
+
return {"messages": [AIMessage(content=answer)]}
|
| 202 |
+
|
| 203 |
+
# builder = StateGraph(MessagesState)
|
| 204 |
+
#builder.add_node("retriever", retriever)
|
| 205 |
+
#builder.add_node("assistant", assistant)
|
| 206 |
+
#builder.add_node("tools", ToolNode(tools))
|
| 207 |
+
#builder.add_edge(START, "retriever")
|
| 208 |
+
#builder.add_edge("retriever", "assistant")
|
| 209 |
+
#builder.add_conditional_edges(
|
| 210 |
+
# "assistant",
|
| 211 |
+
# tools_condition,
|
| 212 |
+
#)
|
| 213 |
+
#builder.add_edge("tools", "assistant")
|
| 214 |
+
|
| 215 |
+
builder = StateGraph(MessagesState)
|
| 216 |
+
builder.add_node("retriever", retriever)
|
| 217 |
+
|
| 218 |
+
# Retriever ist Start und Endpunkt
|
| 219 |
+
builder.set_entry_point("retriever")
|
| 220 |
+
builder.set_finish_point("retriever")
|
| 221 |
+
|
| 222 |
+
# Compile graph
|
| 223 |
+
return builder.compile()
|
knowledge/1f975693-876d-457b-a649-393859e79bf3.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:200f767e732b49efef5c05d128903ee4d2c34e66fdce7f5593ac123b2e637673
|
| 3 |
+
size 280868
|
knowledge/7bd855d8-463d-4ed5-93ca-5fe35145f733.xlsx
ADDED
|
Binary file (5.29 kB). View file
|
|
|
knowledge/99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b218c951c1f888f0bbe6f46c080f57afc7c9348fffc7ba4da35749ff1e2ac40f
|
| 3 |
+
size 179304
|
knowledge/cca530fc-4052-43b2-b130-b30968d8aa44.png
ADDED
|
questions.json
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[{
|
| 2 |
+
"task_id": "8e867cd7-cff9-4e6c-867a-ff5ddc2550be",
|
| 3 |
+
"question": "How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.",
|
| 4 |
+
"Level": "1",
|
| 5 |
+
"file_name": ""
|
| 6 |
+
},
|
| 7 |
+
{
|
| 8 |
+
"task_id": "a1e91b78-d3d8-4675-bb8d-62741b4b68a6",
|
| 9 |
+
"question": "In the video https://www.youtube.com/watch?v=L1vXCYZAYYM, what is the highest number of bird species to be on camera simultaneously?",
|
| 10 |
+
"Level": "1",
|
| 11 |
+
"file_name": ""
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"task_id": "2d83110e-a098-4ebb-9987-066c06fa42d0",
|
| 15 |
+
"question": ".rewsna eht sa \"tfel\" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI",
|
| 16 |
+
"Level": "1",
|
| 17 |
+
"file_name": ""
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"task_id": "cca530fc-4052-43b2-b130-b30968d8aa44",
|
| 21 |
+
"question": "Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.",
|
| 22 |
+
"Level": "1",
|
| 23 |
+
"file_name": "cca530fc-4052-43b2-b130-b30968d8aa44.png"
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"task_id": "4fc2f1ae-8625-45b5-ab34-ad4433bc21f8",
|
| 27 |
+
"question": "Who nominated the only Featured Article on English Wikipedia about a dinosaur that was promoted in November 2016?",
|
| 28 |
+
"Level": "1",
|
| 29 |
+
"file_name": ""
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"task_id": "6f37996b-2ac7-44b0-8e68-6d28256631b4",
|
| 33 |
+
"question": "Given this table defining * on the set S = {a, b, c, d, e}\n\n|*|a|b|c|d|e|\n|---|---|---|---|---|---|\n|a|a|b|c|b|d|\n|b|b|c|a|e|c|\n|c|c|a|b|b|a|\n|d|b|e|b|e|d|\n|e|d|b|a|d|c|\n\nprovide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.",
|
| 34 |
+
"Level": "1",
|
| 35 |
+
"file_name": ""
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"task_id": "9d191bce-651d-4746-be2d-7ef8ecadb9c2",
|
| 39 |
+
"question": "Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.\n\nWhat does Teal'c say in response to the question \"Isn't that hot?\"",
|
| 40 |
+
"Level": "1",
|
| 41 |
+
"file_name": ""
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"task_id": "cabe07ed-9eca-40ea-8ead-410ef5e83f91",
|
| 45 |
+
"question": "What is the surname of the equine veterinarian mentioned in 1.E Exercises from the chemistry materials licensed by Marisa Alviar-Agnew & Henry Agnew under the CK-12 license in LibreText's Introductory Chemistry materials as compiled 08/21/2023?",
|
| 46 |
+
"Level": "1",
|
| 47 |
+
"file_name": ""
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"task_id": "3cef3a44-215e-4aed-8e3b-b1e3f08063b7",
|
| 51 |
+
"question": "I'm making a grocery list for my mom, but she's a professor of botany and she's a real stickler when it comes to categorizing things. I need to add different foods to different categories on the grocery list, but if I make a mistake, she won't buy anything inserted in the wrong category. Here's the list I have so far:\n\nmilk, eggs, flour, whole bean coffee, Oreos, sweet potatoes, fresh basil, plums, green beans, rice, corn, bell pepper, whole allspice, acorns, broccoli, celery, zucchini, lettuce, peanuts\n\nI need to make headings for the fruits and vegetables. Could you please create a list of just the vegetables from my list? If you could do that, then I can figure out how to categorize the rest of the list into the appropriate categories. But remember that my mom is a real stickler, so make sure that no botanical fruits end up on the vegetable list, or she won't get them when she's at the store. Please alphabetize the list of vegetables, and place each item in a comma separated list.",
|
| 52 |
+
"Level": "1",
|
| 53 |
+
"file_name": ""
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"task_id": "99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3",
|
| 57 |
+
"question": "Hi, I'm making a pie but I could use some help with my shopping list. I have everything I need for the crust, but I'm not sure about the filling. I got the recipe from my friend Aditi, but she left it as a voice memo and the speaker on my phone is buzzing so I can't quite make out what she's saying. Could you please listen to the recipe and list all of the ingredients that my friend described? I only want the ingredients for the filling, as I have everything I need to make my favorite pie crust. I've attached the recipe as Strawberry pie.mp3.\n\nIn your response, please only list the ingredients, not any measurements. So if the recipe calls for \"a pinch of salt\" or \"two cups of ripe strawberries\" the ingredients on the list would be \"salt\" and \"ripe strawberries\".\n\nPlease format your response as a comma separated list of ingredients. Also, please alphabetize the ingredients.",
|
| 58 |
+
"Level": "1",
|
| 59 |
+
"file_name": "99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3.mp3"
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"task_id": "305ac316-eef6-4446-960a-92d80d542f82",
|
| 63 |
+
"question": "Who did the actor who played Ray in the Polish-language version of Everybody Loves Raymond play in Magda M.? Give only the first name.",
|
| 64 |
+
"Level": "1",
|
| 65 |
+
"file_name": ""
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"task_id": "f918266a-b3e0-4914-865d-4faa564f1aef",
|
| 69 |
+
"question": "What is the final numeric output from the attached Python code?",
|
| 70 |
+
"Level": "1",
|
| 71 |
+
"file_name": "f918266a-b3e0-4914-865d-4faa564f1aef.py"
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"task_id": "3f57289b-8c60-48be-bd80-01f8099ca449",
|
| 75 |
+
"question": "How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?",
|
| 76 |
+
"Level": "1",
|
| 77 |
+
"file_name": ""
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"task_id": "1f975693-876d-457b-a649-393859e79bf3",
|
| 81 |
+
"question": "Hi, I was out sick from my classes on Friday, so I'm trying to figure out what I need to study for my Calculus mid-term next week. My friend from class sent me an audio recording of Professor Willowbrook giving out the recommended reading for the test, but my headphones are broken :(\n\nCould you please listen to the recording for me and tell me the page numbers I'm supposed to go over? I've attached a file called Homework.mp3 that has the recording. Please provide just the page numbers as a comma-delimited list. And please provide the list in ascending order.",
|
| 82 |
+
"Level": "1",
|
| 83 |
+
"file_name": "1f975693-876d-457b-a649-393859e79bf3.mp3"
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"task_id": "840bfca7-4f7b-481a-8794-c560c340185d",
|
| 87 |
+
"question": "On June 6, 2023, an article by Carolyn Collins Petersen was published in Universe Today. This article mentions a team that produced a paper about their observations, linked at the bottom of the article. Find this paper. Under what NASA award number was the work performed by R. G. Arendt supported by?",
|
| 88 |
+
"Level": "1",
|
| 89 |
+
"file_name": ""
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"task_id": "bda648d7-d618-4883-88f4-3466eabd860e",
|
| 93 |
+
"question": "Where were the Vietnamese specimens described by Kuznetzov in Nedoshivina's 2010 paper eventually deposited? Just give me the city name without abbreviations.",
|
| 94 |
+
"Level": "1",
|
| 95 |
+
"file_name": ""
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"task_id": "cf106601-ab4f-4af9-b045-5295fe67b37d",
|
| 99 |
+
"question": "What country had the least number of athletes at the 1928 Summer Olympics? If there's a tie for a number of athletes, return the first in alphabetical order. Give the IOC country code as your answer.",
|
| 100 |
+
"Level": "1",
|
| 101 |
+
"file_name": ""
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"task_id": "a0c07678-e491-4bbc-8f0b-07405144218f",
|
| 105 |
+
"question": "Who are the pitchers with the number before and after Taishō Tamai's number as of July 2023? Give them to me in the form Pitcher Before, Pitcher After, use their last names only, in Roman characters.",
|
| 106 |
+
"Level": "1",
|
| 107 |
+
"file_name": ""
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"task_id": "7bd855d8-463d-4ed5-93ca-5fe35145f733",
|
| 111 |
+
"question": "The attached Excel file contains the sales of menu items for a local fast-food chain. What were the total sales that the chain made from food (not including drinks)? Express your answer in USD with two decimal places.",
|
| 112 |
+
"Level": "1",
|
| 113 |
+
"file_name": "7bd855d8-463d-4ed5-93ca-5fe35145f733.xlsx"
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"task_id": "5a0c1adf-205e-4841-a666-7c3ef95def9d",
|
| 117 |
+
"question": "What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?",
|
| 118 |
+
"Level": "1",
|
| 119 |
+
"file_name": ""
|
| 120 |
+
}
|
| 121 |
+
]
|
requirements.txt
CHANGED
|
@@ -1,9 +1,18 @@
|
|
| 1 |
gradio
|
| 2 |
requests
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
langgraph
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
gradio
|
| 2 |
requests
|
| 3 |
+
langchain
|
| 4 |
+
langchain-community
|
| 5 |
+
langchain-core
|
| 6 |
+
langchain-google-genai
|
| 7 |
+
langchain-huggingface
|
| 8 |
+
langchain-groq
|
| 9 |
+
langchain-tavily
|
| 10 |
+
langchain-chroma
|
| 11 |
langgraph
|
| 12 |
+
huggingface_hub
|
| 13 |
+
supabase
|
| 14 |
+
arxiv
|
| 15 |
+
pymupdf
|
| 16 |
+
wikipedia
|
| 17 |
+
pgvector
|
| 18 |
+
python-dotenv
|
system_prompt.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are a helpful assistant tasked with answering questions using a set of tools.
|
| 2 |
+
|
| 3 |
+
Your final answer must strictly follow this format:
|
| 4 |
+
FINAL ANSWER: [ANSWER]
|
| 5 |
+
|
| 6 |
+
Only write the answer in that exact format. Do not explain anything. Do not include any other text.
|
| 7 |
+
|
| 8 |
+
If you are provided with a similar question and its final answer, and the current question is **exactly the same**, then simply return the same final answer without using any tools.
|
| 9 |
+
|
| 10 |
+
Only use tools if the current question is different from the similar one.
|
| 11 |
+
|
| 12 |
+
Examples:
|
| 13 |
+
- FINAL ANSWER: FunkMonk
|
| 14 |
+
- FINAL ANSWER: Paris
|
| 15 |
+
- FINAL ANSWER: 128
|
| 16 |
+
|
| 17 |
+
If you do not follow this format exactly, your response will be considered incorrect.
|