Eurico149 commited on
Commit
77b3d53
·
1 Parent(s): 4e15e58

fix: summarization removed, it caused a lot of latency

Browse files
app.py CHANGED
@@ -6,7 +6,6 @@ from langgraph.checkpoint.memory import InMemorySaver
6
  from dotenv import load_dotenv
7
  from agents import get_book_retriver_agent
8
  from tools import get_retrieve_book_context_rag_agent_tool
9
- from tools import get_summarization_tool
10
 
11
 
12
  class GradioAgent:
@@ -38,12 +37,12 @@ class GradioAgent:
38
  rag_agent = get_book_retriver_agent()
39
 
40
  tools = [
41
- get_retrieve_book_context_rag_agent_tool(rag_agent),
42
- get_summarization_tool()
43
  ]
44
 
45
  prompt = ("You are a helpful and usefull coordinator agent, you have access to a collection of tools and"
46
- " agents to help you with reliable data to your query's.")
 
47
 
48
  return create_agent(
49
  tools=tools,
 
6
  from dotenv import load_dotenv
7
  from agents import get_book_retriver_agent
8
  from tools import get_retrieve_book_context_rag_agent_tool
 
9
 
10
 
11
  class GradioAgent:
 
37
  rag_agent = get_book_retriver_agent()
38
 
39
  tools = [
40
+ get_retrieve_book_context_rag_agent_tool(rag_agent)
 
41
  ]
42
 
43
  prompt = ("You are a helpful and usefull coordinator agent, you have access to a collection of tools and"
44
+ " agents to help you with reliable data to your query's. "
45
+ "One of your main objectives is to generate user friendly answers based on the information you have.")
46
 
47
  return create_agent(
48
  tools=tools,
tools/RetriveBooksDataTool.py CHANGED
@@ -9,7 +9,6 @@ def get_retrieve_book_context_tool(vector_store):
9
  )
10
  def retrieve_book_context(query: str) -> str:
11
  """Search the books database for records matching the query.
12
-
13
  Args:
14
  query: Search terms to look for
15
  """
 
9
  )
10
  def retrieve_book_context(query: str) -> str:
11
  """Search the books database for records matching the query.
 
12
  Args:
13
  query: Search terms to look for
14
  """
tools/TextSummarizerTool.py DELETED
@@ -1,26 +0,0 @@
1
- from langchain_huggingface import HuggingFacePipeline
2
- from transformers import pipeline
3
- from langchain.tools import tool
4
-
5
-
6
- def get_summarization_tool():
7
-
8
- summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
9
- hf_summarizer = HuggingFacePipeline(pipeline=summarizer)
10
-
11
- @tool
12
- def summarize_tool(text: str) -> str:
13
- """ Summarize a giving text.
14
-
15
- Args:
16
- text: text to be summarized
17
- """
18
- sumirized_text = hf_summarizer.invoke(
19
- text,
20
- max_length=200,
21
- min_length=50,
22
- do_sample=False
23
- )
24
- return sumirized_text
25
-
26
- return summarize_tool
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/__init__.py CHANGED
@@ -1,3 +1,2 @@
1
  from .RetriveBooksDataTool import get_retrieve_book_context_tool
2
  from .BookRetriverRagAgent import get_retrieve_book_context_rag_agent_tool
3
- from .TextSummarizerTool import get_summarization_tool
 
1
  from .RetriveBooksDataTool import get_retrieve_book_context_tool
2
  from .BookRetriverRagAgent import get_retrieve_book_context_rag_agent_tool