Spaces:
Sleeping
Sleeping
Nguyen Nhu Trung
commited on
Commit
·
c178473
1
Parent(s):
91764cb
add gemini
Browse files- agent.py +14 -3
- requirements.txt +2 -1
agent.py
CHANGED
|
@@ -14,6 +14,8 @@ from langchain_core.output_parsers import StrOutputParser
|
|
| 14 |
from langchain_core.tools import Tool
|
| 15 |
from langchain_tavily import TavilySearch
|
| 16 |
from langchain_tavily import TavilySearch, TavilyExtract
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# from langchain_community.tools.tavily_search import TavilySearchResults
|
| 19 |
|
|
@@ -120,15 +122,23 @@ sys_msg = SystemMessage(content=system_prompt)
|
|
| 120 |
|
| 121 |
tools = [
|
| 122 |
wiki_search,
|
| 123 |
-
tavily_search_tool,
|
| 124 |
-
tavily_extract_tool,
|
| 125 |
repl_tool,
|
| 126 |
read_excel_file,
|
| 127 |
transcribe_audio
|
| 128 |
]
|
| 129 |
|
| 130 |
|
| 131 |
-
llm = ChatGroq(model="qwen-qwq-32b", temperature=0.7)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
llm_with_tools = llm.bind_tools(tools)
|
| 133 |
|
| 134 |
def assistant(state: MessagesState):
|
|
@@ -161,6 +171,7 @@ if __name__ == "__main__":
|
|
| 161 |
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."
|
| 162 |
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?"
|
| 163 |
question = "Where were the Vietnamese specimens described by Kuznetzov in Nedoshivina's 2010 paper eventually deposited? Just give me the city name without abbreviations."
|
|
|
|
| 164 |
# getmessages = [HumanMessage(content=question)]
|
| 165 |
# messages = graph.invoke({"messages": messages})
|
| 166 |
# for m in messages["messages"]:
|
|
|
|
| 14 |
from langchain_core.tools import Tool
|
| 15 |
from langchain_tavily import TavilySearch
|
| 16 |
from langchain_tavily import TavilySearch, TavilyExtract
|
| 17 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 18 |
+
|
| 19 |
|
| 20 |
# from langchain_community.tools.tavily_search import TavilySearchResults
|
| 21 |
|
|
|
|
| 122 |
|
| 123 |
tools = [
|
| 124 |
wiki_search,
|
| 125 |
+
# tavily_search_tool,
|
| 126 |
+
# tavily_extract_tool,
|
| 127 |
repl_tool,
|
| 128 |
read_excel_file,
|
| 129 |
transcribe_audio
|
| 130 |
]
|
| 131 |
|
| 132 |
|
| 133 |
+
# llm = ChatGroq(model="qwen-qwq-32b", temperature=0.7)
|
| 134 |
+
llm = ChatGoogleGenerativeAI(
|
| 135 |
+
model="gemini-2.0-flash",
|
| 136 |
+
temperature=0.7,
|
| 137 |
+
max_tokens=None,
|
| 138 |
+
timeout=None,
|
| 139 |
+
max_retries=2,
|
| 140 |
+
# other params...
|
| 141 |
+
)
|
| 142 |
llm_with_tools = llm.bind_tools(tools)
|
| 143 |
|
| 144 |
def assistant(state: MessagesState):
|
|
|
|
| 171 |
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."
|
| 172 |
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?"
|
| 173 |
question = "Where were the Vietnamese specimens described by Kuznetzov in Nedoshivina's 2010 paper eventually deposited? Just give me the city name without abbreviations."
|
| 174 |
+
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."
|
| 175 |
# getmessages = [HumanMessage(content=question)]
|
| 176 |
# messages = graph.invoke({"messages": messages})
|
| 177 |
# for m in messages["messages"]:
|
requirements.txt
CHANGED
|
@@ -8,4 +8,5 @@ wikipedia
|
|
| 8 |
duckduckgo-search
|
| 9 |
langchain-experimental
|
| 10 |
assemblyai
|
| 11 |
-
langchain-tavily
|
|
|
|
|
|
| 8 |
duckduckgo-search
|
| 9 |
langchain-experimental
|
| 10 |
assemblyai
|
| 11 |
+
langchain-tavily
|
| 12 |
+
langchain-google-genai
|