Asaad Almutareb commited on
Commit
3b643b9
1 Parent(s): 3dfd099

fixed circular imports

Browse files
None DELETED
Binary file (12.3 kB)
 
rag_app/agents/kb_retriever_agent.py CHANGED
@@ -12,7 +12,7 @@ from rag_app.structured_tools.structured_tools import (
12
  )
13
 
14
  from langchain.prompts import PromptTemplate
15
- from rag_app.templates.react_json_with_memory import template_system
16
  # from innovation_pathfinder_ai.utils import logger
17
  # from langchain.globals import set_llm_cache
18
  # from langchain.cache import SQLiteCache
@@ -62,7 +62,7 @@ agent = (
62
  )
63
 
64
  # instantiate AgentExecutor
65
- agent_executor = AgentExecutor(
66
  agent=agent,
67
  tools=tools,
68
  verbose=True,
 
12
  )
13
 
14
  from langchain.prompts import PromptTemplate
15
+ from rag_app.templates.react_json_ger import template_system
16
  # from innovation_pathfinder_ai.utils import logger
17
  # from langchain.globals import set_llm_cache
18
  # from langchain.cache import SQLiteCache
 
62
  )
63
 
64
  # instantiate AgentExecutor
65
+ agent_worker = AgentExecutor(
66
  agent=agent,
67
  tools=tools,
68
  verbose=True,
rag_app/agents/react_agent.py CHANGED
@@ -7,8 +7,7 @@ from langchain.agents.output_parsers import ReActJsonSingleInputOutputParser
7
  from langchain.tools.render import render_text_description
8
  import os
9
  from dotenv import load_dotenv
10
- from rag_app.structured_tools.structured_tools import (
11
- #google_search, knowledgeBase_search,
12
  web_research
13
  )
14
 
 
7
  from langchain.tools.render import render_text_description
8
  import os
9
  from dotenv import load_dotenv
10
+ from rag_app.structured_tools.agent_tools import (
 
11
  web_research
12
  )
13
 
rag_app/structured_tools/agent_tools.py CHANGED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.tools import BaseTool, StructuredTool, tool
2
+ from rag_app.agents.kb_retriever_agent import agent_worker
3
+
4
+ @tool
5
+ def web_research(query: str) -> str:
6
+ """Verbessere die Ergebnisse durch eine Suche über die Webseite der Versicherung. Erstelle eine neue Suchanfrage, um die Erfolgschancen zu verbesseren."""
7
+
8
+ result = agent_worker.invoke(
9
+ {
10
+ "input": query
11
+ }
12
+ )
13
+ print(result)
14
+ return result.__str__()
rag_app/structured_tools/structured_tools.py CHANGED
@@ -17,7 +17,6 @@ from rag_app.utils.utils import (
17
  from rag_app.database.db_handler import (
18
  add_many
19
  )
20
- from rag_app.agents.kb_retriever_agent import agent_executor
21
 
22
  import os
23
  # from innovation_pathfinder_ai.utils import create_wikipedia_urls_from_text
@@ -95,16 +94,4 @@ def google_search(query: str) -> str:
95
  else:
96
  cleaner_sources = search_results
97
 
98
- return cleaner_sources.__str__()
99
-
100
- @tool
101
- def web_research(query: str) -> str:
102
- """Verbessere die Ergebnisse durch eine Suche über die Webseite der Versicherung. Erstelle eine neue Suchanfrage, um die Erfolgschancen zu verbesseren."""
103
-
104
- result = agent_executor.invoke(
105
- {
106
- "input": query
107
- }
108
- )
109
- print(result)
110
- return result.__str__()
 
17
  from rag_app.database.db_handler import (
18
  add_many
19
  )
 
20
 
21
  import os
22
  # from innovation_pathfinder_ai.utils import create_wikipedia_urls_from_text
 
94
  else:
95
  cleaner_sources = search_results
96
 
97
+ return cleaner_sources.__str__()
 
 
 
 
 
 
 
 
 
 
 
 
rag_app/templates/react_json_ger.py CHANGED
@@ -34,11 +34,6 @@ Final Answer: the final answer to the original input question
34
 
35
  Begin! Reminder to always use the exact characters `Final Answer` when responding.
36
 
37
- Previous conversation history:
38
- <CONVERSATION_HISTORY>
39
- {chat_history}
40
- </CONVERSATION_HISTORY>
41
-
42
  <NEW_INPUT>
43
  {input}
44
  </NEW_INPUT>
 
34
 
35
  Begin! Reminder to always use the exact characters `Final Answer` when responding.
36
 
 
 
 
 
 
37
  <NEW_INPUT>
38
  {input}
39
  </NEW_INPUT>