ws-bom-robot-app 0.0.58__tar.gz → 0.0.60__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. {ws_bom_robot_app-0.0.58/ws_bom_robot_app.egg-info → ws_bom_robot_app-0.0.60}/PKG-INFO +4 -1
  2. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/requirements.txt +3 -0
  3. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/setup.py +1 -1
  4. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/tools/models/main.py +2 -0
  5. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/tools/tool_manager.py +71 -1
  6. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/tools/utils.py +16 -0
  7. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60/ws_bom_robot_app.egg-info}/PKG-INFO +4 -1
  8. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app.egg-info/requires.txt +3 -0
  9. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/MANIFEST.in +0 -0
  10. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/README.md +0 -0
  11. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/pyproject.toml +0 -0
  12. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/setup.cfg +0 -0
  13. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/__init__.py +0 -0
  14. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/auth.py +0 -0
  15. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/config.py +0 -0
  16. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/cron_manager.py +0 -0
  17. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/__init__.py +0 -0
  18. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/agent_context.py +0 -0
  19. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/agent_description.py +0 -0
  20. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/agent_handler.py +0 -0
  21. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/agent_lcel.py +0 -0
  22. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/api.py +0 -0
  23. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/defaut_prompt.py +0 -0
  24. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/feedbacks/__init__.py +0 -0
  25. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/feedbacks/feedback_manager.py +0 -0
  26. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/main.py +0 -0
  27. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/models/__init__.py +0 -0
  28. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/models/api.py +0 -0
  29. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/models/base.py +0 -0
  30. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/models/feedback.py +0 -0
  31. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/models/kb.py +0 -0
  32. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/nebuly_handler.py +0 -0
  33. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/providers/__init__.py +0 -0
  34. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/providers/llm_manager.py +0 -0
  35. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/settings.py +0 -0
  36. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/tools/__init__.py +0 -0
  37. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/tools/models/__init__.py +0 -0
  38. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/tools/tool_builder.py +0 -0
  39. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/utils/__init__.py +0 -0
  40. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/utils/agent.py +0 -0
  41. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/utils/chunker.py +0 -0
  42. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/utils/download.py +0 -0
  43. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/utils/kb.py +0 -0
  44. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/utils/print.py +0 -0
  45. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/utils/secrets.py +0 -0
  46. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/utils/webhooks.py +0 -0
  47. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/__init__.py +0 -0
  48. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/db/__init__.py +0 -0
  49. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/db/base.py +0 -0
  50. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/db/chroma.py +0 -0
  51. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/db/faiss.py +0 -0
  52. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/db/manager.py +0 -0
  53. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/db/qdrant.py +0 -0
  54. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/generator.py +0 -0
  55. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/__init__.py +0 -0
  56. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/azure.py +0 -0
  57. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/base.py +0 -0
  58. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/confluence.py +0 -0
  59. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/dropbox.py +0 -0
  60. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/gcs.py +0 -0
  61. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/github.py +0 -0
  62. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/googledrive.py +0 -0
  63. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/jira.py +0 -0
  64. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/manager.py +0 -0
  65. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/s3.py +0 -0
  66. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/sftp.py +0 -0
  67. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/sharepoint.py +0 -0
  68. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/sitemap.py +0 -0
  69. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/integration/slack.py +0 -0
  70. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/loader/__init__.py +0 -0
  71. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/loader/base.py +0 -0
  72. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/loader/docling.py +0 -0
  73. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/llm/vector_store/loader/json_loader.py +0 -0
  74. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/main.py +0 -0
  75. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/task_manager.py +0 -0
  76. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app/util.py +0 -0
  77. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app.egg-info/SOURCES.txt +0 -0
  78. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app.egg-info/dependency_links.txt +0 -0
  79. {ws_bom_robot_app-0.0.58 → ws_bom_robot_app-0.0.60}/ws_bom_robot_app.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ws_bom_robot_app
3
- Version: 0.0.58
3
+ Version: 0.0.60
4
4
  Summary: A FastAPI application serving ws bom/robot/llm platform ai.
5
5
  Home-page: https://github.com/websolutespa/bom
6
6
  Author: Websolute Spa
@@ -17,6 +17,7 @@ Requires-Dist: pydantic==2.10.6
17
17
  Requires-Dist: pydantic-settings==2.7.1
18
18
  Requires-Dist: fastapi[standard]==0.115.8
19
19
  Requires-Dist: chevron==0.14.0
20
+ Requires-Dist: trafilatura==2.0.0
20
21
  Requires-Dist: langchain==0.3.25
21
22
  Requires-Dist: langchain-community==0.3.24
22
23
  Requires-Dist: langchain-core==0.3.59
@@ -48,6 +49,8 @@ Requires-Dist: unstructured-ingest[sharepoint]
48
49
  Requires-Dist: unstructured-ingest[slack]
49
50
  Requires-Dist: html5lib==1.1
50
51
  Requires-Dist: markdownify==0.14.1
52
+ Requires-Dist: duckduckgo-search==8.0.4
53
+ Requires-Dist: langchain_google_community==2.0.7
51
54
  Dynamic: author
52
55
  Dynamic: author-email
53
56
  Dynamic: classifier
@@ -6,6 +6,7 @@ pydantic==2.10.6
6
6
  pydantic-settings==2.7.1
7
7
  fastapi[standard]==0.115.8
8
8
  chevron==0.14.0
9
+ trafilatura==2.0.0
9
10
 
10
11
  #framework
11
12
  langchain==0.3.25
@@ -46,3 +47,5 @@ html5lib==1.1 #beautifulsoup4 parser
46
47
 
47
48
  #integrations
48
49
  markdownify==0.14.1 #sitemap
50
+ duckduckgo-search==8.0.4
51
+ langchain_google_community==2.0.7
@@ -4,7 +4,7 @@ _requirements = [line.split('#')[0].strip() for line in open("requirements.txt")
4
4
 
5
5
  setup(
6
6
  name="ws_bom_robot_app",
7
- version="0.0.58",
7
+ version="0.0.60",
8
8
  description="A FastAPI application serving ws bom/robot/llm platform ai.",
9
9
  long_description=open("README.md", encoding='utf-8').read(),
10
10
  long_description_content_type="text/markdown",
@@ -9,3 +9,5 @@ class ImageGeneratorInput(BaseModel):
9
9
  language: str = Field(description="Language of the query. Default is 'it'", default="it")
10
10
  class LlmChainInput(BaseModel):
11
11
  input: str = Field(description="Input to the LLM chain")
12
+ class SearchOnlineInput(BaseModel):
13
+ query: str = Field(description="The search query string")
@@ -4,7 +4,7 @@ from ws_bom_robot_app.llm.models.api import LlmAppTool
4
4
  from ws_bom_robot_app.llm.providers.llm_manager import LlmInterface
5
5
  from ws_bom_robot_app.llm.vector_store.db.manager import VectorDbManager
6
6
  from ws_bom_robot_app.llm.tools.utils import getRandomWaitingMessage, translate_text
7
- from ws_bom_robot_app.llm.tools.models.main import NoopInput,DocumentRetrieverInput,ImageGeneratorInput,LlmChainInput
7
+ from ws_bom_robot_app.llm.tools.models.main import NoopInput,DocumentRetrieverInput,ImageGeneratorInput,LlmChainInput,SearchOnlineInput
8
8
  from pydantic import BaseModel, ConfigDict
9
9
 
10
10
  class ToolConfig(BaseModel):
@@ -143,6 +143,74 @@ class ToolManager:
143
143
  return result
144
144
 
145
145
 
146
+ async def search_online(self, query: str):
147
+ from ws_bom_robot_app.llm.tools.utils import fetch_page, extract_content_with_trafilatura
148
+ from langchain_community.utilities import DuckDuckGoSearchAPIWrapper
149
+ import aiohttp, asyncio, ast
150
+ # Wrapper DuckDuckGo
151
+ search = DuckDuckGoSearchAPIWrapper(max_results=10)
152
+ try:
153
+ raw_results = search.results(query, max_results=10)
154
+ except Exception as e:
155
+ print(f"[!] Errore ricerca: {e}")
156
+ urls = [r["link"] for r in raw_results]
157
+ async with aiohttp.ClientSession() as session:
158
+ tasks = [fetch_page(session, url) for url in urls]
159
+ responses = await asyncio.gather(*tasks)
160
+ final_results = []
161
+ for item in responses:
162
+ url = item["url"]
163
+ html = item["html"]
164
+ if html:
165
+ content = await extract_content_with_trafilatura(html)
166
+ if content:
167
+ final_results.append({"url": url, "content": content})
168
+ else:
169
+ final_results.append({"url": url, "content": "No content found"})
170
+ else:
171
+ final_results.append({"url": url, "content": "Page not found"})
172
+ return final_results
173
+
174
+ async def search_online_google(self, query: str):
175
+ from langchain_google_community import GoogleSearchAPIWrapper
176
+ from ws_bom_robot_app.llm.tools.utils import fetch_page, extract_content_with_trafilatura
177
+ import aiohttp, asyncio
178
+ secrets = {}
179
+ for d in self.app_tool.secrets:
180
+ secrets[d.get("secretId")] = d.get("secretValue")
181
+ search_type = secrets.get("searchType")
182
+ if search_type:
183
+ search_kwargs = {"searchType" : search_type}
184
+ search = GoogleSearchAPIWrapper(
185
+ google_api_key=secrets.get("GOOGLE_API_KEY"),
186
+ google_cse_id=secrets.get("GOOGLE_CSE_ID"),
187
+ )
188
+ if search_type:
189
+ raw_results = search.results(query=query,
190
+ num_results=secrets.get("num_results", 5),
191
+ search_params=search_kwargs)
192
+ return raw_results
193
+ raw_results = search.results(
194
+ query=query,
195
+ num_results=secrets.get("num_results", 5)
196
+ )
197
+ urls = [r["link"] for r in raw_results]
198
+ async with aiohttp.ClientSession() as session:
199
+ tasks = [fetch_page(session, url) for url in urls]
200
+ responses = await asyncio.gather(*tasks)
201
+ final_results = []
202
+ for item in responses:
203
+ url = item["url"]
204
+ html = item["html"]
205
+ if html:
206
+ content = await extract_content_with_trafilatura(html)
207
+ if content:
208
+ final_results.append({"url": url, "content": content, "type": "web"})
209
+ else:
210
+ final_results.append({"url": url, "content": "No content found", "type": "web"})
211
+ else:
212
+ final_results.append({"url": url, "content": "Page not found", "type": "web"})
213
+ return final_results
146
214
  #endregion
147
215
 
148
216
  #class variables (static)
@@ -150,6 +218,8 @@ class ToolManager:
150
218
  "document_retriever": ToolConfig(function=document_retriever, model=DocumentRetrieverInput),
151
219
  "image_generator": ToolConfig(function=image_generator, model=ImageGeneratorInput),
152
220
  "llm_chain": ToolConfig(function=llm_chain, model=LlmChainInput),
221
+ "search_online": ToolConfig(function=search_online, model=SearchOnlineInput),
222
+ "search_online_google": ToolConfig(function=search_online_google, model=SearchOnlineInput),
153
223
  }
154
224
 
155
225
  #instance methods
@@ -23,3 +23,19 @@ async def translate_text(llm: LlmInterface, language, text: str, callbacks: list
23
23
  prompt = PromptTemplate.from_template(sys_message)
24
24
  chain = prompt | llm.get_llm()
25
25
  await chain.ainvoke({"language":language, "testo_da_tradurre": text}, {"callbacks": callbacks})
26
+
27
+ async def fetch_page(session, url):
28
+ try:
29
+ async with session.get(url, timeout=10, ssl=False) as response:
30
+ if response.status == 200:
31
+ text = await response.text()
32
+ return {"url": url, "html": text}
33
+ else:
34
+ return {"url": url, "html": None}
35
+ except Exception as e:
36
+ return {"url": url, "html": None}
37
+
38
+ async def extract_content_with_trafilatura(html):
39
+ """Estrae solo il testo principale usando trafilatura"""
40
+ import trafilatura
41
+ return trafilatura.extract(html)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ws_bom_robot_app
3
- Version: 0.0.58
3
+ Version: 0.0.60
4
4
  Summary: A FastAPI application serving ws bom/robot/llm platform ai.
5
5
  Home-page: https://github.com/websolutespa/bom
6
6
  Author: Websolute Spa
@@ -17,6 +17,7 @@ Requires-Dist: pydantic==2.10.6
17
17
  Requires-Dist: pydantic-settings==2.7.1
18
18
  Requires-Dist: fastapi[standard]==0.115.8
19
19
  Requires-Dist: chevron==0.14.0
20
+ Requires-Dist: trafilatura==2.0.0
20
21
  Requires-Dist: langchain==0.3.25
21
22
  Requires-Dist: langchain-community==0.3.24
22
23
  Requires-Dist: langchain-core==0.3.59
@@ -48,6 +49,8 @@ Requires-Dist: unstructured-ingest[sharepoint]
48
49
  Requires-Dist: unstructured-ingest[slack]
49
50
  Requires-Dist: html5lib==1.1
50
51
  Requires-Dist: markdownify==0.14.1
52
+ Requires-Dist: duckduckgo-search==8.0.4
53
+ Requires-Dist: langchain_google_community==2.0.7
51
54
  Dynamic: author
52
55
  Dynamic: author-email
53
56
  Dynamic: classifier
@@ -5,6 +5,7 @@ pydantic==2.10.6
5
5
  pydantic-settings==2.7.1
6
6
  fastapi[standard]==0.115.8
7
7
  chevron==0.14.0
8
+ trafilatura==2.0.0
8
9
  langchain==0.3.25
9
10
  langchain-community==0.3.24
10
11
  langchain-core==0.3.59
@@ -36,3 +37,5 @@ unstructured-ingest[sharepoint]
36
37
  unstructured-ingest[slack]
37
38
  html5lib==1.1
38
39
  markdownify==0.14.1
40
+ duckduckgo-search==8.0.4
41
+ langchain_google_community==2.0.7