webscout 6.3__py3-none-any.whl → 6.5__py3-none-any.whl
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.
Potentially problematic release.
This version of webscout might be problematic. Click here for more details.
- webscout/AIauto.py +191 -176
- webscout/AIbase.py +0 -197
- webscout/AIutel.py +441 -1130
- webscout/DWEBS.py +189 -35
- webscout/{YTdownloader.py → Extra/YTToolkit/YTdownloader.py} +990 -1103
- webscout/Extra/YTToolkit/__init__.py +3 -0
- webscout/{transcriber.py → Extra/YTToolkit/transcriber.py} +479 -551
- webscout/Extra/YTToolkit/ytapi/__init__.py +6 -0
- webscout/Extra/YTToolkit/ytapi/channel.py +307 -0
- webscout/Extra/YTToolkit/ytapi/errors.py +13 -0
- webscout/Extra/YTToolkit/ytapi/extras.py +45 -0
- webscout/Extra/YTToolkit/ytapi/https.py +88 -0
- webscout/Extra/YTToolkit/ytapi/patterns.py +61 -0
- webscout/Extra/YTToolkit/ytapi/playlist.py +59 -0
- webscout/Extra/YTToolkit/ytapi/pool.py +8 -0
- webscout/Extra/YTToolkit/ytapi/query.py +37 -0
- webscout/Extra/YTToolkit/ytapi/stream.py +60 -0
- webscout/Extra/YTToolkit/ytapi/utils.py +62 -0
- webscout/Extra/YTToolkit/ytapi/video.py +102 -0
- webscout/Extra/__init__.py +3 -1
- webscout/Extra/autocoder/__init__.py +9 -0
- webscout/Extra/autocoder/autocoder_utiles.py +121 -0
- webscout/Extra/autocoder/rawdog.py +680 -0
- webscout/Extra/autollama.py +246 -195
- webscout/Extra/gguf.py +81 -56
- webscout/Extra/markdownlite/__init__.py +862 -0
- webscout/Extra/weather_ascii.py +2 -2
- webscout/LLM.py +206 -43
- webscout/Litlogger/__init__.py +681 -0
- webscout/Provider/DARKAI.py +1 -1
- webscout/Provider/EDITEE.py +1 -1
- webscout/Provider/NinjaChat.py +1 -1
- webscout/Provider/PI.py +120 -35
- webscout/Provider/Perplexity.py +590 -598
- webscout/Provider/Reka.py +0 -1
- webscout/Provider/RoboCoders.py +206 -0
- webscout/Provider/TTI/AiForce/__init__.py +22 -0
- webscout/Provider/TTI/AiForce/async_aiforce.py +257 -0
- webscout/Provider/TTI/AiForce/sync_aiforce.py +242 -0
- webscout/Provider/TTI/Nexra/__init__.py +22 -0
- webscout/Provider/TTI/Nexra/async_nexra.py +286 -0
- webscout/Provider/TTI/Nexra/sync_nexra.py +258 -0
- webscout/Provider/TTI/PollinationsAI/__init__.py +23 -0
- webscout/Provider/TTI/PollinationsAI/async_pollinations.py +330 -0
- webscout/Provider/TTI/PollinationsAI/sync_pollinations.py +285 -0
- webscout/Provider/TTI/__init__.py +2 -4
- webscout/Provider/TTI/artbit/__init__.py +22 -0
- webscout/Provider/TTI/artbit/async_artbit.py +184 -0
- webscout/Provider/TTI/artbit/sync_artbit.py +176 -0
- webscout/Provider/TTI/blackbox/__init__.py +4 -0
- webscout/Provider/TTI/blackbox/async_blackbox.py +212 -0
- webscout/Provider/TTI/{blackboximage.py → blackbox/sync_blackbox.py} +199 -153
- webscout/Provider/TTI/deepinfra/__init__.py +4 -0
- webscout/Provider/TTI/deepinfra/async_deepinfra.py +227 -0
- webscout/Provider/TTI/deepinfra/sync_deepinfra.py +199 -0
- webscout/Provider/TTI/huggingface/__init__.py +22 -0
- webscout/Provider/TTI/huggingface/async_huggingface.py +199 -0
- webscout/Provider/TTI/huggingface/sync_huggingface.py +195 -0
- webscout/Provider/TTI/imgninza/__init__.py +4 -0
- webscout/Provider/TTI/imgninza/async_ninza.py +214 -0
- webscout/Provider/TTI/{imgninza.py → imgninza/sync_ninza.py} +209 -136
- webscout/Provider/TTI/talkai/__init__.py +4 -0
- webscout/Provider/TTI/talkai/async_talkai.py +229 -0
- webscout/Provider/TTI/talkai/sync_talkai.py +207 -0
- webscout/Provider/TTS/__init__.py +5 -1
- webscout/Provider/TTS/deepgram.py +183 -0
- webscout/Provider/TTS/elevenlabs.py +137 -0
- webscout/Provider/TTS/gesserit.py +151 -0
- webscout/Provider/TTS/murfai.py +139 -0
- webscout/Provider/TTS/parler.py +134 -107
- webscout/Provider/TTS/streamElements.py +360 -275
- webscout/Provider/TTS/utils.py +280 -0
- webscout/Provider/TTS/voicepod.py +116 -116
- webscout/Provider/__init__.py +8 -1
- webscout/Provider/askmyai.py +2 -2
- webscout/Provider/cerebras.py +227 -219
- webscout/Provider/llama3mitril.py +0 -1
- webscout/Provider/meta.py +794 -779
- webscout/Provider/mhystical.py +176 -0
- webscout/Provider/perplexitylabs.py +265 -0
- webscout/Provider/twitterclone.py +251 -245
- webscout/Provider/typegpt.py +358 -0
- webscout/__init__.py +9 -8
- webscout/__main__.py +5 -5
- webscout/cli.py +252 -280
- webscout/conversation.py +227 -0
- webscout/exceptions.py +161 -29
- webscout/litagent/__init__.py +172 -0
- webscout/litprinter/__init__.py +832 -0
- webscout/optimizers.py +270 -0
- webscout/prompt_manager.py +279 -0
- webscout/scout/__init__.py +11 -0
- webscout/scout/core.py +884 -0
- webscout/scout/element.py +459 -0
- webscout/scout/parsers/__init__.py +69 -0
- webscout/scout/parsers/html5lib_parser.py +172 -0
- webscout/scout/parsers/html_parser.py +236 -0
- webscout/scout/parsers/lxml_parser.py +178 -0
- webscout/scout/utils.py +38 -0
- webscout/swiftcli/__init__.py +810 -0
- webscout/update_checker.py +125 -0
- webscout/version.py +1 -1
- webscout/zeroart/__init__.py +55 -0
- webscout/zeroart/base.py +61 -0
- webscout/zeroart/effects.py +99 -0
- webscout/zeroart/fonts.py +816 -0
- webscout/zerodir/__init__.py +225 -0
- {webscout-6.3.dist-info → webscout-6.5.dist-info}/METADATA +37 -112
- webscout-6.5.dist-info/RECORD +179 -0
- webscout/Agents/Onlinesearcher.py +0 -182
- webscout/Agents/__init__.py +0 -2
- webscout/Agents/functioncall.py +0 -248
- webscout/Bing_search.py +0 -154
- webscout/Provider/TTI/AIuncensoredimage.py +0 -103
- webscout/Provider/TTI/Nexra.py +0 -120
- webscout/Provider/TTI/PollinationsAI.py +0 -138
- webscout/Provider/TTI/WebSimAI.py +0 -142
- webscout/Provider/TTI/aiforce.py +0 -160
- webscout/Provider/TTI/artbit.py +0 -141
- webscout/Provider/TTI/deepinfra.py +0 -148
- webscout/Provider/TTI/huggingface.py +0 -155
- webscout/Provider/TTI/talkai.py +0 -116
- webscout/g4f.py +0 -666
- webscout/models.py +0 -23
- webscout/requestsHTMLfix.py +0 -775
- webscout/webai.py +0 -2590
- webscout-6.3.dist-info/RECORD +0 -124
- {webscout-6.3.dist-info → webscout-6.5.dist-info}/LICENSE.md +0 -0
- {webscout-6.3.dist-info → webscout-6.5.dist-info}/WHEEL +0 -0
- {webscout-6.3.dist-info → webscout-6.5.dist-info}/entry_points.txt +0 -0
- {webscout-6.3.dist-info → webscout-6.5.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
webscout/AIauto.py,sha256=vmTVbtxtYG2lIye67poeDEJg86y75TZ0_uYR8EQV6To,6994
|
|
2
|
+
webscout/AIbase.py,sha256=CV7YNdRH0SRQTPYtVqVGOQirSXIQW86Fqxl3DcrHwns,3405
|
|
3
|
+
webscout/AIutel.py,sha256=gsV08e3F6aH4j7wH5V9X3N9T5Ea5MAIQq4M47vNofuI,12020
|
|
4
|
+
webscout/Bard.py,sha256=CmDhKC67Ki2xA8Rkme6EC-gLmq3PhAAAGd5tcpJ0KJo,13234
|
|
5
|
+
webscout/DWEBS.py,sha256=GsKbaVgcxDC5eHtNjxr6r5uk3_8NhtxVG2dqJJVGqaI,18543
|
|
6
|
+
webscout/LLM.py,sha256=essCz1nakJfmoKLJFguyJnba0HR4AfY6BVU0CEGDCcQ,16336
|
|
7
|
+
webscout/__init__.py,sha256=IMDl0kRpLtNMi1HOW6HXoBp0CevEpLPkol8GJhorMno,657
|
|
8
|
+
webscout/__main__.py,sha256=pBm2E3ZZiMcCH37b1YCz7qKdKdX_i_S5En6fZDeJKFw,103
|
|
9
|
+
webscout/cli.py,sha256=bLaSGs24wxfZlK37_WPPr1jjfbv50nfbxkeSkED0jX0,12456
|
|
10
|
+
webscout/conversation.py,sha256=fWWrBwhZztasvW7aLSLsTLpHzuTeuV4jGXPWzXukNj8,8088
|
|
11
|
+
webscout/exceptions.py,sha256=qdyWoLV1nEPffb5vz9cu9EfBwIwZ4nmcCinqeJDBWTo,5182
|
|
12
|
+
webscout/optimizers.py,sha256=gMZqYA7Slw7F9e_Gp4umkpMYKtdVFJBn-yDrlFYP4Wo,9168
|
|
13
|
+
webscout/prompt_manager.py,sha256=Jc0demWN6M6QcwRp14aHZR05r_PVPOaG8PnQkO7pDZ4,9806
|
|
14
|
+
webscout/tempid.py,sha256=7ZTN2eAYqUO2deSdzzhZfgDRxE65OOhGuTBD7f8bTCM,5004
|
|
15
|
+
webscout/update_checker.py,sha256=mw4XOEhGpe68nXuo6yXIQqA_Vt5sJhY_-5iUWsiF0oo,4179
|
|
16
|
+
webscout/utils.py,sha256=LVW7U0XcGYqigqxV6D5YXeGMrc_mt7PnNG_YnKf9bBM,3059
|
|
17
|
+
webscout/version.py,sha256=K8NenkGw5y4bDvKGg-xeUewcUgMDcrcEPUuhVqQbUw8,44
|
|
18
|
+
webscout/webscout_search.py,sha256=HHdO9XLToC_9nIMM_SaTOKKfzdhrKjb7o8Zi3ZD1O7Y,44744
|
|
19
|
+
webscout/webscout_search_async.py,sha256=2-RCa9Deahhw3Bti78kXfVaX8y3Aygy4L7HeCaITk9M,14519
|
|
20
|
+
webscout/Extra/__init__.py,sha256=FbDnwI3zZdoQFosA5Q2bIYpJlHUKFWiFmFKvnk9xWKY,153
|
|
21
|
+
webscout/Extra/autollama.py,sha256=Mcj7YT8mYL5J7Rg_Wmi3Ppcfh1WK6UWcrbUZySetwuU,8198
|
|
22
|
+
webscout/Extra/gguf.py,sha256=u_HQ00hiKCcF4GiVabUnFTXEPTmUpa2ADjBNHxtR7bw,16053
|
|
23
|
+
webscout/Extra/weather.py,sha256=q-h5UXL2XEBEgoqvEeLRut-ThieNzH_GNfOEIeghKLM,6000
|
|
24
|
+
webscout/Extra/weather_ascii.py,sha256=AsSJT6OCpg9vxzW5h7h0s0PEMq_m_ixvcc7VDtNERdw,793
|
|
25
|
+
webscout/Extra/YTToolkit/YTdownloader.py,sha256=NfbukCKdyWycl9RzJBXzqSPKW6FwWe7EQxhfLf_dJj8,34793
|
|
26
|
+
webscout/Extra/YTToolkit/__init__.py,sha256=Wn1K-f6OjZ4GuWvL3FTM4zlTaF3xdb4v_K60YDxKdXg,75
|
|
27
|
+
webscout/Extra/YTToolkit/transcriber.py,sha256=jAcjpz2ywKxod6ZDMpcXlOliZg5Vj-AY4xB0YJTApCo,19193
|
|
28
|
+
webscout/Extra/YTToolkit/ytapi/__init__.py,sha256=9VHO8BkkhIZhfQ-bOm2soq1C7WblGS8VJPFSq9bsde4,166
|
|
29
|
+
webscout/Extra/YTToolkit/ytapi/channel.py,sha256=JzqDEx9VvHCilfLwlT7dJZSn55_asHWIcB-7l_HBBE8,9750
|
|
30
|
+
webscout/Extra/YTToolkit/ytapi/errors.py,sha256=MOlIMUmQzlgL08VgllbIayg6lURqdGRlycUC5A7553c,303
|
|
31
|
+
webscout/Extra/YTToolkit/ytapi/extras.py,sha256=MkN-8ZUvUGnpihb4grvOLF4DP0LSXhwmrcJVmWKU1wU,1417
|
|
32
|
+
webscout/Extra/YTToolkit/ytapi/https.py,sha256=APsIeyE430T685q2coPRW1N82O1as1crdK_730u_wqM,2201
|
|
33
|
+
webscout/Extra/YTToolkit/ytapi/patterns.py,sha256=RXL6Rr5hfki9HlpFR12qPV_ELvM6SGqUqOtjy3KwxPc,3053
|
|
34
|
+
webscout/Extra/YTToolkit/ytapi/playlist.py,sha256=y1NhzXFwfVMTgSoJr9RYanVIq8qSIowywAzvkzUs-Xs,1735
|
|
35
|
+
webscout/Extra/YTToolkit/ytapi/pool.py,sha256=G38wIbDlLx8GE00eBHKbssb8dUDo6hcOnPCon_JAU2I,267
|
|
36
|
+
webscout/Extra/YTToolkit/ytapi/query.py,sha256=d4MCTVMXSE6WcCk3HEhvzGa3NNNeYZ5YcL7VeXc11e0,1483
|
|
37
|
+
webscout/Extra/YTToolkit/ytapi/stream.py,sha256=7VscCVBwLx_Lz8qFOQdKCSyeAiv_A3aUQNBAb2tL9s0,1999
|
|
38
|
+
webscout/Extra/YTToolkit/ytapi/utils.py,sha256=ENjmAjlOTLib0ANxysuSb2kgDl3NtDTvW60b18H-Rzc,1966
|
|
39
|
+
webscout/Extra/YTToolkit/ytapi/video.py,sha256=OzX1XJJ4qRjti0VOlrsOC8kDvZihMVgUFTyrT-AYYms,3877
|
|
40
|
+
webscout/Extra/autocoder/__init__.py,sha256=jcDJEXVde_ATffVNjV4vQMvvWH0UDW-HRz5OKNoZ7cg,218
|
|
41
|
+
webscout/Extra/autocoder/autocoder_utiles.py,sha256=hGAnOWJISuHm0UOKSWwre9_wCqJqDGYVbvyKJ6GrnuQ,4268
|
|
42
|
+
webscout/Extra/autocoder/rawdog.py,sha256=o2lMY4Fwvl3GawBzwGXuqu-5dPFzDyX3ZZL1xmQV7Ls,25806
|
|
43
|
+
webscout/Extra/markdownlite/__init__.py,sha256=IJQ5SOs4nxmAdhZk8JylNdD6SsKJPZgvnzGqu6v4qWc,32339
|
|
44
|
+
webscout/Litlogger/__init__.py,sha256=Q5FPfGKktfFyvqa6kMbye9LLzuy6VXGOgE3Q-uBGD2E,23928
|
|
45
|
+
webscout/Local/__init__.py,sha256=Mte7RYlelBND2yof_HJ3MMZYBVeTISNFU2-LiFKSbU4,228
|
|
46
|
+
webscout/Local/_version.py,sha256=jk6j7Rb0VWezDG1ZFhgYJpZiyL5rCivaiA86_jJecmk,139
|
|
47
|
+
webscout/Local/formats.py,sha256=yJJW2VoN27u6oGiPNa8PrhVuX0Aol9VExHjJ0AeTnLw,26687
|
|
48
|
+
webscout/Local/model.py,sha256=49k61kfzGhBbA38ul2yqdrmFd6YPOipJ37vCXOWIxaM,50987
|
|
49
|
+
webscout/Local/samplers.py,sha256=6khEmMiMqIRO-qssjv8PEVomNG2yoLhDM6Wa9YBRbuI,6769
|
|
50
|
+
webscout/Local/thread.py,sha256=ctnoJtkOpKbpdlqCjsnyM2sI-3_AKg9PzNwS3QAIifQ,23603
|
|
51
|
+
webscout/Local/ui.py,sha256=FhqBcC7SVHwRfvrnTduoa7gpQNWYzrSc7OGm89ErNPY,15064
|
|
52
|
+
webscout/Local/utils.py,sha256=kYXfR9h4JFojkiKQhF1XHclqX0vB0qPKOkfYKjrgwuc,13216
|
|
53
|
+
webscout/Provider/AI21.py,sha256=JBh-xnspxTZNMcl-Gd0Cgseqht9gTM64TUv9I4Imc9k,6218
|
|
54
|
+
webscout/Provider/Amigo.py,sha256=bs5M-HzfKIcdCfS_50JMsX5DpS0eBWwtHNyOrTR7lAo,12304
|
|
55
|
+
webscout/Provider/Andi.py,sha256=-vqXWlJcHzhfZ-iW4qJy9yxzctPKp2RdmdW02hf4XLs,8863
|
|
56
|
+
webscout/Provider/Bing.py,sha256=zxIzq7dlqaLskx9LsYppbMJuwfGtYid3Uh0gIhZ0hps,9001
|
|
57
|
+
webscout/Provider/Blackboxai.py,sha256=KntNTWHHEmXegKFxm79_2tX_FLQF-_7xssrB6T0nCgM,8841
|
|
58
|
+
webscout/Provider/ChatGPTES.py,sha256=t_Qjn1ShNX0uYp5dJzv6Y7DPQM8HUTgvcBauhFz0-Io,8815
|
|
59
|
+
webscout/Provider/Chatify.py,sha256=QYgZAEmhLkEnR7oyr-qUs6OSHoNJm2BgMr41f84Ntbg,6370
|
|
60
|
+
webscout/Provider/Cloudflare.py,sha256=KZ2aZj-K5se_Xn8GPozJ3xRx2lJhf36uIu0Tyx-jH54,10801
|
|
61
|
+
webscout/Provider/Cohere.py,sha256=oL9kAv--RSkEQxwkPTq1Wi57Wkgg0WNvL82CpTj22YY,8264
|
|
62
|
+
webscout/Provider/DARKAI.py,sha256=Bn2p5yU1MMiaS-meQySCVPjtc0uOfjJyxXA0kSaO_P0,9041
|
|
63
|
+
webscout/Provider/Deepinfra.py,sha256=djm8LSDj6aummNSym4HrJHZD2CCVJ_er1oxiFLiq1N4,6389
|
|
64
|
+
webscout/Provider/Deepseek.py,sha256=axBNDR_5N_Ge9iDopLHhR0kCAD0meq787UNh8oLqqGI,9142
|
|
65
|
+
webscout/Provider/DiscordRocks.py,sha256=fRkVBCyDMZf0SoaNPK7KXAsh8mQj0JWDb7ifYpL9PQQ,11372
|
|
66
|
+
webscout/Provider/EDITEE.py,sha256=9rq7c84XoIoRBqd0qgW-Ebu3lyffhicSOtUvMtAjO0s,7742
|
|
67
|
+
webscout/Provider/Farfalle.py,sha256=eVmSB4Dq6P2epo8dd6CyCtyxvOMFwvk6f0Ikb9nZ2d0,9017
|
|
68
|
+
webscout/Provider/Free2GPT.py,sha256=Lf8dd9iacry_GRr6CT86Cjcp-oNzLyw1O_TWIPDFDxk,9037
|
|
69
|
+
webscout/Provider/GPTWeb.py,sha256=xh_mnBko6RDyz2v3KhMux-yIipipkZfVVVoUJWkbzcQ,7466
|
|
70
|
+
webscout/Provider/Gemini.py,sha256=Vg2MLqQ_qxHkcN7Zikife1dyVK-y94ik8y6MAu-VzUI,7801
|
|
71
|
+
webscout/Provider/Groq.py,sha256=iqyewnxWwN7fMG-dqAR_SyUqImfyZS880lO5iaXso9c,28636
|
|
72
|
+
webscout/Provider/Koboldai.py,sha256=gpRgyDe4OQWwNqT7MWnNrJx4dnFmCW23KUx0Ezjgchk,15185
|
|
73
|
+
webscout/Provider/Llama.py,sha256=N01p3ZVD1HgRnNNxhjRhBVD4m_qiextdyF1KDfJlqbE,7703
|
|
74
|
+
webscout/Provider/Llama3.py,sha256=fU1iyKflFHDeSqa32M6UE2JtADZB0B7rcG5HYj5MWSQ,7581
|
|
75
|
+
webscout/Provider/Marcus.py,sha256=6LvBYnAcbwVYiXoQ8ZrprefJ6zS2KdveiEZauClNtSE,5045
|
|
76
|
+
webscout/Provider/NinjaChat.py,sha256=tMja5xItus6WoKJm_fhILLoGyPdplikqr-nxtuUziNU,8617
|
|
77
|
+
webscout/Provider/OLLAMA.py,sha256=RQXJt-PJYnA15_IXhUy4mM9qwm4PcBMfINaZm2KG6zE,7018
|
|
78
|
+
webscout/Provider/Openai.py,sha256=32uxZmZOovzshMQmqDcJ39If7N_UW4B3EeYmaxP_GwE,19983
|
|
79
|
+
webscout/Provider/PI.py,sha256=dMUpd1hLg72W7rnsza3k9QHBLmAi3GHSPRCkzmH-Ags,12860
|
|
80
|
+
webscout/Provider/Perplexity.py,sha256=BC4ZbVAjumNhw4_wNbs1Y4lwshEpJF5lanTmSqkXVG8,20476
|
|
81
|
+
webscout/Provider/Phind.py,sha256=NA_b3B4h-kutX6wdoEg4THPfZggl2UeXPbramzZ6oiU,19297
|
|
82
|
+
webscout/Provider/PizzaGPT.py,sha256=tEuEJAGbv-mTd479i3EgaqHd4NwgkrmMW0fpSsGm_N0,7207
|
|
83
|
+
webscout/Provider/RUBIKSAI.py,sha256=fHCOAFWGXIESA05Bmuqtx6ZChnWomHOMwndfTLv1Hg8,8517
|
|
84
|
+
webscout/Provider/Reka.py,sha256=dWw4vX91nJhAn-X1SXK72gttRaTqWNGUBFaeRJobTJg,8519
|
|
85
|
+
webscout/Provider/RoboCoders.py,sha256=vH1B0cKzQW6fU1TWwpUlnuQFW3uirzIWj0WIpiPal1s,7957
|
|
86
|
+
webscout/Provider/TeachAnything.py,sha256=u5HxlVdOnRWXzA-cRSRhhdnvdsfafJ_4wr9qKIuW45s,6743
|
|
87
|
+
webscout/Provider/Youchat.py,sha256=G6I4TqjZuX3refFF3SkOgl_YXY57hjsMg_wRjPgqWIE,9014
|
|
88
|
+
webscout/Provider/__init__.py,sha256=lPzcVlyGtXFb9WJWOv0-jLdHRNXqIANpjqx-8SAGTYU,3191
|
|
89
|
+
webscout/Provider/ai4chat.py,sha256=av96iS4QPt9IzhcswowmDY2F8IUSLl1YVHZ4bAbfO-s,8140
|
|
90
|
+
webscout/Provider/aimathgpt.py,sha256=BdXNxEHQP11p6m0wl2Q-uben46A6lMKOg89utV1S7aI,7320
|
|
91
|
+
webscout/Provider/askmyai.py,sha256=XDxLQfIztI-jwergalUfNiMOwNEw62jGTN4yTlar8Po,5895
|
|
92
|
+
webscout/Provider/bagoodex.py,sha256=OdYIyvypX-Vkok9zAr6F5NwFQx_z0bKhiw8U4tTFw5o,5023
|
|
93
|
+
webscout/Provider/cerebras.py,sha256=cyUIgGdVMAmBgTifwuPW-XGC2SKGL2CbTKxY8al9ji4,7986
|
|
94
|
+
webscout/Provider/cleeai.py,sha256=tXs_XuYZ2ZGmSOSTS0yJ59qbvFCJusE7yZkIqALwUbE,8064
|
|
95
|
+
webscout/Provider/elmo.py,sha256=6C-j8xLfgyMjmv8jdjey0BPzl_UwEFpMEbBtYobfPd0,9387
|
|
96
|
+
webscout/Provider/felo_search.py,sha256=q_Mc4SgSnkCm5vu-CMmn9kVO3k0YCZqq_uMUrVUXInU,6888
|
|
97
|
+
webscout/Provider/gaurish.py,sha256=yKV4MvOvjMEsXY2fQXDc0YHyFBtW2sh-pA4YNdY--wE,8472
|
|
98
|
+
webscout/Provider/geminiapi.py,sha256=c2zvwqkRgscI8vU1FU4qb_4fPe374LIQJ_uHNM9lmF8,8297
|
|
99
|
+
webscout/Provider/geminiprorealtime.py,sha256=unQRqHkDt_gkZ_Ls0qBb73d6YTtqYwd1uhYW0RrXKI0,5845
|
|
100
|
+
webscout/Provider/genspark.py,sha256=zKg0nWNzi38Mai_ShBISnmRSpfrBXAIZcTYyf8iX9h8,8764
|
|
101
|
+
webscout/Provider/julius.py,sha256=unD3UUnW8-Bie4o0__Vn7cXfqnaVvlE3MWI-LYGb5VE,8576
|
|
102
|
+
webscout/Provider/koala.py,sha256=qBtqjTvhoMQdDE8qUH0XuNa_x2bic77d7CUjIVboask,10106
|
|
103
|
+
webscout/Provider/learnfastai.py,sha256=xANWSHF3e6kTKgwbAHYdjNWIwYvr5Bin0NDENmJvruE,9763
|
|
104
|
+
webscout/Provider/lepton.py,sha256=4RiQ4YNJljX558yhSUqws6pf1Yhf7pWIesa4SRQCry8,7590
|
|
105
|
+
webscout/Provider/llama3mitril.py,sha256=3Ur3GMkmSSTmyxJh1u9fF0xlZ7ssFF6Jxuoi587N1lw,6501
|
|
106
|
+
webscout/Provider/llamatutor.py,sha256=DijA4Y1CVDz-Ks8pACTSb6hnOxdQD2IHw-_ztRqhyPQ,8871
|
|
107
|
+
webscout/Provider/llmchat.py,sha256=gr7ewEPWWIfjhmpQXTOZJxQffol8MA1yWAIXdG3VZZo,7944
|
|
108
|
+
webscout/Provider/meta.py,sha256=N1Ia1iDADfk1QJUHb10Vq5UvObiybQsi5QlUoNVaY-M,30456
|
|
109
|
+
webscout/Provider/mhystical.py,sha256=W3j28XOnVGlRPCSYrjA5N7okYEdTVeOw41HdocfvzqE,6555
|
|
110
|
+
webscout/Provider/perplexitylabs.py,sha256=3_qnAoh0nsp6uhqFqzwUyXBezAzmRFs4YSRxVIokYF8,9651
|
|
111
|
+
webscout/Provider/prefind.py,sha256=msw_kXO59Xz-xG5f72O3WIww-HVyUAj-WpByeLiCB1U,9306
|
|
112
|
+
webscout/Provider/promptrefine.py,sha256=NbRdvCsiiLIDwU39wzxch5yGwmLvbauljAl9vC73nR4,7714
|
|
113
|
+
webscout/Provider/talkai.py,sha256=UZNiuQm5IPX_VFPOIVc1SJNPTKAcbvaOVO9fsVDVXNY,7434
|
|
114
|
+
webscout/Provider/turboseek.py,sha256=yDOZcS3UqHcas_pH1AcB-XLD6C2FRzZxLp8rJOhUZGQ,8521
|
|
115
|
+
webscout/Provider/tutorai.py,sha256=ov-gRPAh22n8v7TWjeLdPnuHgCcaAsdpc2IfxfuSIEk,14716
|
|
116
|
+
webscout/Provider/twitterclone.py,sha256=SsLFZ-PansLdhw0HHBrqZtrjI4ItiHvoHfQBroXHORw,9509
|
|
117
|
+
webscout/Provider/typegpt.py,sha256=6_i06EYXlJyqIMlZ_NwG4w9D96C6yfIMvAfHW-R9P6Q,12732
|
|
118
|
+
webscout/Provider/upstage.py,sha256=rdH94hIwR98HKfar576WzVmgdB1DU2H8qaChUmJFtPc,9237
|
|
119
|
+
webscout/Provider/x0gpt.py,sha256=Z8U4MQIRfhHpdarHO6_BZ27veXMDEAneguJ7uFSD_HU,6478
|
|
120
|
+
webscout/Provider/yep.py,sha256=ge7a3cK02G6tbT0_q9glH7ujCx3QlgrqwBuHasQVYfQ,20581
|
|
121
|
+
webscout/Provider/TTI/__init__.py,sha256=9Hu_y-z6Ev2SQL5-IF_B4UDetoOl7hVclka1RatQ6_M,225
|
|
122
|
+
webscout/Provider/TTI/AiForce/__init__.py,sha256=Ukeas_Ny6VQBwCDEWuBMlWbeTki82ir1MtZdR2vNJPc,663
|
|
123
|
+
webscout/Provider/TTI/AiForce/async_aiforce.py,sha256=7Gpgu__TPNLZwxayqfOOkRcKpIdAfE1x8wE-RoylEAY,9647
|
|
124
|
+
webscout/Provider/TTI/AiForce/sync_aiforce.py,sha256=0SeeoCmKkqo1u6jGo5QzpPhdnn9BMABXImATfR-opqM,8674
|
|
125
|
+
webscout/Provider/TTI/Nexra/__init__.py,sha256=dg1B7OXmqYTDvAsprViJN5_KbMYOrqFcIm1wyOOxsxE,641
|
|
126
|
+
webscout/Provider/TTI/Nexra/async_nexra.py,sha256=ki07w-emMkleNftjhckMyU7JJ9WjjzsOLj-XL-JQns0,11011
|
|
127
|
+
webscout/Provider/TTI/Nexra/sync_nexra.py,sha256=TS2KXynQFDxVlOHHpPLK-q5ER5fWka9AZmSzUDISJQQ,9369
|
|
128
|
+
webscout/Provider/TTI/PollinationsAI/__init__.py,sha256=VO3fWVyZ_Cu3Ld9CnGTc1_5DnBmhmS-bAUj1jnYvwD0,801
|
|
129
|
+
webscout/Provider/TTI/PollinationsAI/async_pollinations.py,sha256=Z6mp2nO_MWXhNJhP_y-tKXC2lkG8JsU-mXD4MQNO-DY,12074
|
|
130
|
+
webscout/Provider/TTI/PollinationsAI/sync_pollinations.py,sha256=XLdiD1lKYJq3XjRo54OEE7l78pWW6Zo2Mk9zPgJYJec,10065
|
|
131
|
+
webscout/Provider/TTI/artbit/__init__.py,sha256=oqzoscH77DbVe2F9LPYFSjJmYrabyvw5Dk36TZAxatk,686
|
|
132
|
+
webscout/Provider/TTI/artbit/async_artbit.py,sha256=Xh3XSWAcIRW7A5MHLJBtA0_wZpU559G5vjDmursyVcE,6701
|
|
133
|
+
webscout/Provider/TTI/artbit/sync_artbit.py,sha256=hwWoxGOCMNqwdjJXwrzakiCMOAeg5XyVkM6BiDokRc0,6107
|
|
134
|
+
webscout/Provider/TTI/blackbox/__init__.py,sha256=mCyj_qNo37FVwopWXfrgvyissM2wtfgEEr5rMsvzVnI,151
|
|
135
|
+
webscout/Provider/TTI/blackbox/async_blackbox.py,sha256=VyE3zQbrGA7NlsKdU-86gwq0zk-esEu2I3Q0WL_6rT8,8354
|
|
136
|
+
webscout/Provider/TTI/blackbox/sync_blackbox.py,sha256=8KrnKAGpmcYn2IIwgQ9gzGmbQE5s8v03BGdb8ao4-UU,7450
|
|
137
|
+
webscout/Provider/TTI/deepinfra/__init__.py,sha256=YF6z3vLd6Ffo_o_SnfZq5LUDv1oOexJ3I-LChC8YGKs,149
|
|
138
|
+
webscout/Provider/TTI/deepinfra/async_deepinfra.py,sha256=PqzYhNLFzKKqxKpqGuTAzKgijCkbQUMOHgh2l3p_KgY,9008
|
|
139
|
+
webscout/Provider/TTI/deepinfra/sync_deepinfra.py,sha256=NJDxnqrISdkq_uM27GOMMPLBL5iTqGCugHgGy6mgHw0,7497
|
|
140
|
+
webscout/Provider/TTI/huggingface/__init__.py,sha256=SIrgnCvZx9r14UF8_SGuoXZo840dletfI-XkfHQuLg0,695
|
|
141
|
+
webscout/Provider/TTI/huggingface/async_huggingface.py,sha256=KzMsVi7-1s7sShgvbr31RGFu0ehlT8lnYQwTnhffabY,7691
|
|
142
|
+
webscout/Provider/TTI/huggingface/sync_huggingface.py,sha256=P5DZqSXfjwMsZAMZU1X_XZIYDEAFeY1YAGhnatECjzM,7325
|
|
143
|
+
webscout/Provider/TTI/imgninza/__init__.py,sha256=t5D_Y2JKf26UQG3kjzYY7nqGK1a8wsnsMt0-RXaWYPE,125
|
|
144
|
+
webscout/Provider/TTI/imgninza/async_ninza.py,sha256=iq87298sfVj986jpYxK1tUoWJOOuQxVKgb5za3z6HRw,8349
|
|
145
|
+
webscout/Provider/TTI/imgninza/sync_ninza.py,sha256=hTwLKaDhweYa3MDDCy627JQq0DHu3FT4jzFFBTjyjDM,8240
|
|
146
|
+
webscout/Provider/TTI/talkai/__init__.py,sha256=aHr_1M9Aq9MUgmIeUJaMdnvR0KPy48XHPrehf1s5udQ,131
|
|
147
|
+
webscout/Provider/TTI/talkai/async_talkai.py,sha256=go4uDXBEyGTtH4xSm9YI9hnLhIhSjGhQp0wpMhGl8Xk,9188
|
|
148
|
+
webscout/Provider/TTI/talkai/sync_talkai.py,sha256=D13sccDCecdGvG6-oKO-6y2aboTz2ztcotgC6T263GQ,8099
|
|
149
|
+
webscout/Provider/TTS/__init__.py,sha256=kUEgod65aN2PKC9sSQmq0BeRY_Y_GFG7AgkAi1prXkg,177
|
|
150
|
+
webscout/Provider/TTS/deepgram.py,sha256=cdeFB_BQBG534xQTiDWzXJjRikpyydKhv4bQtmEgL_4,7212
|
|
151
|
+
webscout/Provider/TTS/elevenlabs.py,sha256=pm04R45Ws-WcnHsHerzI86TKPoPGPap6ia8mMiiWfqw,6267
|
|
152
|
+
webscout/Provider/TTS/gesserit.py,sha256=K8FeekO2hoDuqnvhkHqNN0DiXhZ7gPGKOjtbK6VTKLc,6271
|
|
153
|
+
webscout/Provider/TTS/murfai.py,sha256=wkVCZ72ajC2hpw0hTjuzz7lxNv6zd2H9FjrXK2-CKek,5749
|
|
154
|
+
webscout/Provider/TTS/parler.py,sha256=FRvRk2WFxJVkdmYqsDSX11bR6bxzyIaYRQ-m_6GMXc8,4911
|
|
155
|
+
webscout/Provider/TTS/streamElements.py,sha256=0cfayE1eQYQj4ILF9tmHdodIcw9WknTKsrgJWbK1hWg,11003
|
|
156
|
+
webscout/Provider/TTS/utils.py,sha256=-2sXcGG1lDBIr32fssI1Tf9yxl7gMWZRM0xzUFebeko,10599
|
|
157
|
+
webscout/Provider/TTS/voicepod.py,sha256=cMF7k88cP-RMqkqcoT8cu1o-eehxd2tqiq8laJeuMJw,4227
|
|
158
|
+
webscout/litagent/__init__.py,sha256=V-hXEmMp3UH1qKmJDtL0j6_mazmbyyRrIqKqt__oIRw,6091
|
|
159
|
+
webscout/litprinter/__init__.py,sha256=eMGF91G3l8qMHDwwCnL-8-fGGGMLTSsdd9GfIRviJCA,31565
|
|
160
|
+
webscout/scout/__init__.py,sha256=fhN3P47AmrK2dINYc_lXqPbrITtMO5Gnnqs5PmoZqLY,241
|
|
161
|
+
webscout/scout/core.py,sha256=Joiw1RTPse2VQOjF5y6Uksa_ixsUSIO58RLWnyx6gbU,28761
|
|
162
|
+
webscout/scout/element.py,sha256=PZ-Hd5eyhUtqfPNY5wAPm-gNLOdPD3_y0H94mFrqBw4,14787
|
|
163
|
+
webscout/scout/utils.py,sha256=a9QJnsJ6LyYRRrjJYGUrvFfkBsynTcIgXR86t4tgaM4,979
|
|
164
|
+
webscout/scout/parsers/__init__.py,sha256=a0gysttcAnIxfY8UBbkNJdmMHEhfeI9VmfnQGZVYKPk,1762
|
|
165
|
+
webscout/scout/parsers/html5lib_parser.py,sha256=VRCQIDh7Z9XbS8-zSOsmRtR2Oyx_DEz85hjRvabBQ2Y,5627
|
|
166
|
+
webscout/scout/parsers/html_parser.py,sha256=pHCKl-n_9uNt2ld09nY6hiyFuCi4azT7Be8Rzlo1GQQ,6820
|
|
167
|
+
webscout/scout/parsers/lxml_parser.py,sha256=fDaxFuBSlU9x5hH5nDj5BHd72r9XHZ24Z5lt6FYPt_8,6053
|
|
168
|
+
webscout/swiftcli/__init__.py,sha256=Yr_bsL1E3FaUh-xqWK_2ecG91IC2mSiP7eBa3en0mHc,27758
|
|
169
|
+
webscout/zeroart/__init__.py,sha256=WKB5gM0VY-trL0rWmMwYiStFyoMGe9ivx0DQ-IJe0W8,1308
|
|
170
|
+
webscout/zeroart/base.py,sha256=7Z5I5qFm11g5R8PktltDze8zF2VAIXswNrb5Z-jlRvw,1821
|
|
171
|
+
webscout/zeroart/effects.py,sha256=_UWmnxlTlf1gnT90nAXmgj-0j7_GAK7yX5KTNj34728,2932
|
|
172
|
+
webscout/zeroart/fonts.py,sha256=nBwIMxuXTJiZq2C654tPEiHt0KwyuO6iYnuBjQIf_O0,24842
|
|
173
|
+
webscout/zerodir/__init__.py,sha256=NHDON7WoN26G80uRXxPHH3jeTQhvz25Zx0yA7qq81fw,8396
|
|
174
|
+
webscout-6.5.dist-info/LICENSE.md,sha256=5mkWS6cgjGxJClmN7n--h0beF3uFAOV_Ngr1YTK33Tk,9203
|
|
175
|
+
webscout-6.5.dist-info/METADATA,sha256=phd5n2QatIQPBHY2hnEiY3z7LTiq0kkfSiRA-6PBDlI,46144
|
|
176
|
+
webscout-6.5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
177
|
+
webscout-6.5.dist-info/entry_points.txt,sha256=Hh4YIIjvkqB9SVxZ2ri4DZUkgEu_WF_5_r_nZDIvfG8,73
|
|
178
|
+
webscout-6.5.dist-info/top_level.txt,sha256=nYIw7OKBQDr_Z33IzZUKidRD3zQEo8jOJYkMVMeN334,9
|
|
179
|
+
webscout-6.5.dist-info/RECORD,,
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import httpx
|
|
3
|
-
from bs4 import BeautifulSoup
|
|
4
|
-
from typing import List, Dict
|
|
5
|
-
from webscout import GoogleS, GEMINIAPI
|
|
6
|
-
import re
|
|
7
|
-
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class WebSearchAgent:
|
|
11
|
-
def __init__(self):
|
|
12
|
-
self.webs = GoogleS()
|
|
13
|
-
self.ai = GEMINIAPI(is_conversation=False, api_key='AIzaSyAYlT5-V0MXZwaLYpXCF1Z-Yvy_tx1jylA')
|
|
14
|
-
|
|
15
|
-
def generate_search_queries(self, information: str, num_queries: int = 10) -> List[str]:
|
|
16
|
-
prompt = f""" Task: Generate exactly {num_queries} optimal search queries based on the given information.
|
|
17
|
-
Instructions:
|
|
18
|
-
1. Analyze the provided information thoroughly.
|
|
19
|
-
2. Identify key concepts, entities, and relationships.
|
|
20
|
-
3. Formulate {num_queries} concise and specific search queries that will yield relevant and diverse results.
|
|
21
|
-
4. Each query should focus on a different aspect or angle of the information.
|
|
22
|
-
5. The queries should be in natural language, not in the form of keywords.
|
|
23
|
-
6. Avoid unnecessary words or phrases that might limit the search results.
|
|
24
|
-
7. **Important**: Return the response **ONLY** in JSON format without any additional text or code blocks.
|
|
25
|
-
Your response must be in the following JSON format: {{
|
|
26
|
-
"search_queries": [
|
|
27
|
-
"Your first search query here",
|
|
28
|
-
"Your second search query here",
|
|
29
|
-
"...",
|
|
30
|
-
"Your last search query here"
|
|
31
|
-
]
|
|
32
|
-
}}
|
|
33
|
-
Ensure that:
|
|
34
|
-
- You provide exactly {num_queries} search queries.
|
|
35
|
-
- Each query is unique and focuses on a different aspect of the information.
|
|
36
|
-
- The queries are in plain text, suitable for a web search engine.
|
|
37
|
-
|
|
38
|
-
Information to base the search queries on:
|
|
39
|
-
{information}
|
|
40
|
-
|
|
41
|
-
Now, generate the optimal search queries: """
|
|
42
|
-
|
|
43
|
-
response = ""
|
|
44
|
-
for chunk in self.ai.chat(prompt):
|
|
45
|
-
response += chunk
|
|
46
|
-
|
|
47
|
-
json_match = re.search(r'\{.*\}', response, re.DOTALL)
|
|
48
|
-
if json_match:
|
|
49
|
-
json_str = json_match.group(0)
|
|
50
|
-
try:
|
|
51
|
-
json_response = json.loads(json_str)
|
|
52
|
-
print(json_response['search_queries'])
|
|
53
|
-
return json_response["search_queries"]
|
|
54
|
-
except json.JSONDecodeError:
|
|
55
|
-
pass
|
|
56
|
-
|
|
57
|
-
queries = re.findall(r'"([^"]+)"', response)
|
|
58
|
-
if len(queries) >= num_queries:
|
|
59
|
-
return queries[:num_queries]
|
|
60
|
-
elif queries:
|
|
61
|
-
return queries
|
|
62
|
-
else:
|
|
63
|
-
return [information]
|
|
64
|
-
|
|
65
|
-
def search(self, information: str, region: str = 'wt-wt', safe: str = 'off',
|
|
66
|
-
max_results: int = 10) -> List[Dict]:
|
|
67
|
-
search_queries = self.generate_search_queries(information, num_queries=10)
|
|
68
|
-
all_results = []
|
|
69
|
-
|
|
70
|
-
for query in search_queries:
|
|
71
|
-
results = []
|
|
72
|
-
with self.webs as webs:
|
|
73
|
-
for result in webs.search(query, region=region, safe=safe,
|
|
74
|
-
max_results=max_results):
|
|
75
|
-
results.append(result)
|
|
76
|
-
all_results.extend(results)
|
|
77
|
-
|
|
78
|
-
return all_results
|
|
79
|
-
|
|
80
|
-
def extract_urls(self, results: List[Dict]) -> List[str]:
|
|
81
|
-
urls = [result.get('href') for result in results if result.get('href')]
|
|
82
|
-
unique_urls = list(set(urls))
|
|
83
|
-
return unique_urls
|
|
84
|
-
|
|
85
|
-
def fetch_webpage(self, url: str) -> Dict[str, str]:
|
|
86
|
-
try:
|
|
87
|
-
with httpx.Client(timeout=120) as client:
|
|
88
|
-
response = client.get(url)
|
|
89
|
-
if response.status_code == 200:
|
|
90
|
-
html = response.text
|
|
91
|
-
soup = BeautifulSoup(html, 'html.parser')
|
|
92
|
-
paragraphs = soup.find_all('p')
|
|
93
|
-
text = ' '.join([p.get_text() for p in paragraphs])
|
|
94
|
-
words = text.split()
|
|
95
|
-
if len(words) > 600:
|
|
96
|
-
text = ' '.join(words[:600]) + '...'
|
|
97
|
-
return {"url": url, "content": text}
|
|
98
|
-
else:
|
|
99
|
-
return {"url": url, "content": f"Failed to fetch {url}: HTTP {response.status_code}"}
|
|
100
|
-
except Exception as e:
|
|
101
|
-
return {"url": url, "content": f"Error fetching {url}: {str(e)}"}
|
|
102
|
-
|
|
103
|
-
def fetch_all_webpages(self, urls: List[str], max_workers: int = 10) -> List[Dict[str, str]]:
|
|
104
|
-
contents = []
|
|
105
|
-
with ThreadPoolExecutor(max_workers=max_workers) as executor:
|
|
106
|
-
future_to_url = {executor.submit(self.fetch_webpage, url): url for url in urls}
|
|
107
|
-
for future in as_completed(future_to_url):
|
|
108
|
-
result = future.result()
|
|
109
|
-
contents.append(result)
|
|
110
|
-
return contents
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
class OnlineSearcher:
|
|
114
|
-
def __init__(self):
|
|
115
|
-
self.agent = WebSearchAgent()
|
|
116
|
-
self.ai = GEMINIAPI(is_conversation=False, api_key='GOOGLE GEMINI API')
|
|
117
|
-
|
|
118
|
-
def answer_question(self, question: str) -> None:
|
|
119
|
-
search_results = self.agent.search(question, max_results=10)
|
|
120
|
-
urls = self.agent.extract_urls(search_results)
|
|
121
|
-
webpage_contents = self.agent.fetch_all_webpages(urls)
|
|
122
|
-
|
|
123
|
-
context = "Web search results and extracted content:\n\n"
|
|
124
|
-
for i, result in enumerate(search_results, 1):
|
|
125
|
-
title = result.get('title', 'No Title')
|
|
126
|
-
href = result.get('href', 'No URL')
|
|
127
|
-
snippet = result.get('body', 'No Snippet')
|
|
128
|
-
context += f"{i}. **Title:** {title}\n **URL:** {href}\n **Snippet:** {snippet}\n\n"
|
|
129
|
-
|
|
130
|
-
context += "Extracted webpage contents:\n"
|
|
131
|
-
for i, webpage in enumerate(webpage_contents, 1):
|
|
132
|
-
content = webpage['content']
|
|
133
|
-
content_preview = content[:600] + '...' if len(content) > 600 else content
|
|
134
|
-
context += f"{i}. **URL:** {webpage['url']}\n **Content:** {content_preview}\n\n"
|
|
135
|
-
|
|
136
|
-
prompt = f""" Task: Provide a comprehensive, insightful, and well-structured answer to the given question based on the provided web search results and your general knowledge.
|
|
137
|
-
Question: {question}
|
|
138
|
-
Context: {context}
|
|
139
|
-
Instructions:
|
|
140
|
-
1. Carefully analyze the provided web search results and extracted content.
|
|
141
|
-
2. Synthesize the information to form a coherent and comprehensive answer.
|
|
142
|
-
3. If the search results contain relevant information, incorporate it into your answer seamlessly.
|
|
143
|
-
4. Avoid providing irrelevant information, and do not reference "according to web page".
|
|
144
|
-
5. If the search results don't contain sufficient information, clearly state this and provide the best answer based on your general knowledge.
|
|
145
|
-
6. Ensure your answer is well-structured, factual, and directly addresses the question.
|
|
146
|
-
7. Use clear headings, bullet points, or other formatting tools to enhance readability where appropriate.
|
|
147
|
-
8. Strive for a tone and style similar to that of professional, authoritative sources like Perplexity, ensuring clarity and depth in your response.
|
|
148
|
-
Your response should be informative, accurate, and properly sourced when possible. Begin your answer now: """
|
|
149
|
-
|
|
150
|
-
for chunk in self.ai.chat(prompt, stream=True):
|
|
151
|
-
print(chunk, end='', flush=True)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
# Usage example
|
|
156
|
-
if __name__ == "__main__":
|
|
157
|
-
assistant = OnlineSearcher()
|
|
158
|
-
while True:
|
|
159
|
-
try:
|
|
160
|
-
question = input(">>> ")
|
|
161
|
-
if question.lower() == 'quit':
|
|
162
|
-
break
|
|
163
|
-
print("=" * 50)
|
|
164
|
-
assistant.answer_question(question)
|
|
165
|
-
print("=" * 50)
|
|
166
|
-
except KeyboardInterrupt:
|
|
167
|
-
print("\nExiting.")
|
|
168
|
-
break
|
|
169
|
-
except Exception as e:
|
|
170
|
-
print(f"An error occurred: {e}")
|
|
171
|
-
|
|
172
|
-
"""
|
|
173
|
-
def format_prompt(messages: Messages, add_special_tokens=False) -> str:
|
|
174
|
-
|
|
175
|
-
if not add_special_tokens and len(messages) <= 1:
|
|
176
|
-
return messages[0]["content"]
|
|
177
|
-
formatted = "\n".join([
|
|
178
|
-
f'{message["role"].capitalize()}: {message["content"]}'
|
|
179
|
-
for message in messages
|
|
180
|
-
])
|
|
181
|
-
return f"{formatted}\nAssistant:
|
|
182
|
-
"""
|
webscout/Agents/__init__.py
DELETED
webscout/Agents/functioncall.py
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
from datetime import date
|
|
2
|
-
import json
|
|
3
|
-
import logging
|
|
4
|
-
import time
|
|
5
|
-
from typing import Any, Dict, List, Optional, Union, Callable
|
|
6
|
-
from dataclasses import dataclass
|
|
7
|
-
import asyncio
|
|
8
|
-
import requests
|
|
9
|
-
from jinja2 import Template
|
|
10
|
-
from webscout import WEBS, ChatGPTES
|
|
11
|
-
|
|
12
|
-
@dataclass
|
|
13
|
-
class ToolParameter:
|
|
14
|
-
name: str
|
|
15
|
-
type: str
|
|
16
|
-
description: str
|
|
17
|
-
required: bool = False
|
|
18
|
-
|
|
19
|
-
@dataclass
|
|
20
|
-
class Tool:
|
|
21
|
-
name: str
|
|
22
|
-
description: str
|
|
23
|
-
parameters: Dict[str, ToolParameter]
|
|
24
|
-
function: Callable
|
|
25
|
-
is_async: bool = False
|
|
26
|
-
|
|
27
|
-
class ToolRegistry:
|
|
28
|
-
def __init__(self):
|
|
29
|
-
self._tools: Dict[str, Tool] = {}
|
|
30
|
-
|
|
31
|
-
def register(self, tool: Tool):
|
|
32
|
-
self._tools[tool.name] = tool
|
|
33
|
-
|
|
34
|
-
def get_tool(self, name: str) -> Optional[Tool]:
|
|
35
|
-
return self._tools.get(name)
|
|
36
|
-
|
|
37
|
-
def list_tools(self) -> List[Tool]:
|
|
38
|
-
return list(self._tools.values())
|
|
39
|
-
|
|
40
|
-
def to_schema(self) -> List[Dict]:
|
|
41
|
-
return [
|
|
42
|
-
{
|
|
43
|
-
"type": "function",
|
|
44
|
-
"function": {
|
|
45
|
-
"name": tool.name,
|
|
46
|
-
"description": tool.description,
|
|
47
|
-
"parameters": {
|
|
48
|
-
"type": "object",
|
|
49
|
-
"properties": {
|
|
50
|
-
param.name: {
|
|
51
|
-
"type": param.type,
|
|
52
|
-
"description": param.description
|
|
53
|
-
} for param in tool.parameters.values()
|
|
54
|
-
},
|
|
55
|
-
"required": [
|
|
56
|
-
param.name for param in tool.parameters.values()
|
|
57
|
-
if param.required
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
for tool in self._tools.values()
|
|
63
|
-
]
|
|
64
|
-
|
|
65
|
-
class FunctionCallingAgent:
|
|
66
|
-
SYSTEM_TEMPLATE = Template("""You are an advanced AI assistant tasked with analyzing user requests and determining the most appropriate action. You have access to the following tools:
|
|
67
|
-
|
|
68
|
-
{{ tools_description }}
|
|
69
|
-
|
|
70
|
-
Instructions:
|
|
71
|
-
1. Carefully analyze the user's request.
|
|
72
|
-
2. Determine which tools (if any) are necessary to fulfill the request.
|
|
73
|
-
3. You can make multiple tool calls if needed to complete the task.
|
|
74
|
-
4. If you decide to use tool(s), respond ONLY with a JSON array in this format:
|
|
75
|
-
[
|
|
76
|
-
{
|
|
77
|
-
"name": "tool_name",
|
|
78
|
-
"arguments": {
|
|
79
|
-
"param1": "value1",
|
|
80
|
-
"param2": "value2"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
... (more tool calls as needed)
|
|
84
|
-
]
|
|
85
|
-
|
|
86
|
-
5. If no tool is needed, respond with an empty array: []
|
|
87
|
-
|
|
88
|
-
The current date is {{ current_date }}. Your knowledge cutoff is {{ knowledge_cutoff }}.
|
|
89
|
-
|
|
90
|
-
User Request: {{ user_message }}
|
|
91
|
-
|
|
92
|
-
Your Response (JSON array only):""")
|
|
93
|
-
|
|
94
|
-
def __init__(self, registry: ToolRegistry = None):
|
|
95
|
-
self.ai = ChatGPTES(timeout=300, intro=None)
|
|
96
|
-
self.registry = registry or ToolRegistry()
|
|
97
|
-
self.knowledge_cutoff = "September 2022"
|
|
98
|
-
self.logger = logging.getLogger(__name__)
|
|
99
|
-
|
|
100
|
-
def _generate_system_message(self, user_message: str) -> str:
|
|
101
|
-
tools_description = ""
|
|
102
|
-
for tool in self.registry.list_tools():
|
|
103
|
-
tools_description += f"- {tool.name}: {tool.description}\n"
|
|
104
|
-
tools_description += " Parameters:\n"
|
|
105
|
-
for param in tool.parameters.values():
|
|
106
|
-
tools_description += f" - {param.name}: {param.description} ({param.type})\n"
|
|
107
|
-
|
|
108
|
-
current_date = date.today().strftime("%B %d, %Y")
|
|
109
|
-
return self.SYSTEM_TEMPLATE.render(
|
|
110
|
-
tools_description=tools_description,
|
|
111
|
-
current_date=current_date,
|
|
112
|
-
knowledge_cutoff=self.knowledge_cutoff,
|
|
113
|
-
user_message=user_message
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
async def _execute_tool(self, tool_call: Dict[str, Any]) -> Any:
|
|
117
|
-
tool_name = tool_call.get("name")
|
|
118
|
-
arguments = tool_call.get("arguments", {})
|
|
119
|
-
|
|
120
|
-
tool = self.registry.get_tool(tool_name)
|
|
121
|
-
if not tool:
|
|
122
|
-
raise ValueError(f"Unknown tool: {tool_name}")
|
|
123
|
-
|
|
124
|
-
try:
|
|
125
|
-
if tool.is_async:
|
|
126
|
-
return await tool.function(**arguments)
|
|
127
|
-
else:
|
|
128
|
-
return tool.function(**arguments)
|
|
129
|
-
except Exception as e:
|
|
130
|
-
self.logger.error(f"Error executing tool {tool_name}: {str(e)}")
|
|
131
|
-
raise
|
|
132
|
-
|
|
133
|
-
async def process_request(self, message: str) -> List[Any]:
|
|
134
|
-
"""Process a user request and execute any necessary tool calls."""
|
|
135
|
-
try:
|
|
136
|
-
system_message = self._generate_system_message(message)
|
|
137
|
-
response = self.ai.chat(system_message)
|
|
138
|
-
self.logger.debug(f"Raw AI response: {response}")
|
|
139
|
-
|
|
140
|
-
tool_calls = self._parse_tool_calls(response)
|
|
141
|
-
if not tool_calls:
|
|
142
|
-
return []
|
|
143
|
-
|
|
144
|
-
results = []
|
|
145
|
-
for tool_call in tool_calls:
|
|
146
|
-
result = await self._execute_tool(tool_call)
|
|
147
|
-
results.append(result)
|
|
148
|
-
return results
|
|
149
|
-
|
|
150
|
-
except Exception as e:
|
|
151
|
-
self.logger.error(f"Error processing request: {str(e)}")
|
|
152
|
-
raise
|
|
153
|
-
|
|
154
|
-
def _parse_tool_calls(self, response: str) -> List[Dict[str, Any]]:
|
|
155
|
-
"""Parse the AI response into a list of tool calls."""
|
|
156
|
-
try:
|
|
157
|
-
# Find the JSON array in the response
|
|
158
|
-
start_idx = response.find("[")
|
|
159
|
-
end_idx = response.rfind("]") + 1
|
|
160
|
-
|
|
161
|
-
if start_idx == -1 or end_idx == -1:
|
|
162
|
-
return []
|
|
163
|
-
|
|
164
|
-
# Extract and parse the JSON array
|
|
165
|
-
response_json = json.loads(response[start_idx:end_idx])
|
|
166
|
-
|
|
167
|
-
if not isinstance(response_json, list):
|
|
168
|
-
response_json = [response_json]
|
|
169
|
-
|
|
170
|
-
return response_json
|
|
171
|
-
|
|
172
|
-
except (json.JSONDecodeError, ValueError) as e:
|
|
173
|
-
self.logger.error(f"Error parsing tool calls: {str(e)}")
|
|
174
|
-
return []
|
|
175
|
-
|
|
176
|
-
# Example usage
|
|
177
|
-
if __name__ == "__main__":
|
|
178
|
-
logging.basicConfig(
|
|
179
|
-
level=logging.INFO,
|
|
180
|
-
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
|
181
|
-
)
|
|
182
|
-
|
|
183
|
-
# Create and configure the tool registry
|
|
184
|
-
registry = ToolRegistry()
|
|
185
|
-
|
|
186
|
-
def web_search(query: str) -> str:
|
|
187
|
-
# Implement actual web search logic
|
|
188
|
-
return f"Search results for: {query}"
|
|
189
|
-
|
|
190
|
-
def get_user_detail(name: str, age: int) -> Dict[str, Any]:
|
|
191
|
-
return {"name": name, "age": age}
|
|
192
|
-
|
|
193
|
-
# Register tools
|
|
194
|
-
registry.register(Tool(
|
|
195
|
-
name="web_search",
|
|
196
|
-
description="Search the web for current information",
|
|
197
|
-
parameters={
|
|
198
|
-
"query": ToolParameter(
|
|
199
|
-
name="query",
|
|
200
|
-
type="string",
|
|
201
|
-
description="The search query to execute",
|
|
202
|
-
required=True
|
|
203
|
-
)
|
|
204
|
-
},
|
|
205
|
-
function=web_search
|
|
206
|
-
))
|
|
207
|
-
|
|
208
|
-
registry.register(Tool(
|
|
209
|
-
name="get_user_detail",
|
|
210
|
-
description="Get user details",
|
|
211
|
-
parameters={
|
|
212
|
-
"name": ToolParameter(
|
|
213
|
-
name="name",
|
|
214
|
-
type="string",
|
|
215
|
-
description="User's name",
|
|
216
|
-
required=True
|
|
217
|
-
),
|
|
218
|
-
"age": ToolParameter(
|
|
219
|
-
name="age",
|
|
220
|
-
type="integer",
|
|
221
|
-
description="User's age",
|
|
222
|
-
required=True
|
|
223
|
-
)
|
|
224
|
-
},
|
|
225
|
-
function=get_user_detail
|
|
226
|
-
))
|
|
227
|
-
|
|
228
|
-
# Create agent
|
|
229
|
-
agent = FunctionCallingAgent(registry=registry)
|
|
230
|
-
|
|
231
|
-
# Test cases
|
|
232
|
-
test_messages = [
|
|
233
|
-
"What's the weather like in New York today?",
|
|
234
|
-
"Get user details name as John and age as 30",
|
|
235
|
-
"Search for latest news about AI",
|
|
236
|
-
]
|
|
237
|
-
|
|
238
|
-
async def run_tests():
|
|
239
|
-
for message in test_messages:
|
|
240
|
-
print(f"\nProcessing: {message}")
|
|
241
|
-
try:
|
|
242
|
-
results = await agent.process_request(message)
|
|
243
|
-
print(f"Results: {results}")
|
|
244
|
-
except Exception as e:
|
|
245
|
-
print(f"Error: {str(e)}")
|
|
246
|
-
|
|
247
|
-
# Run test cases
|
|
248
|
-
asyncio.run(run_tests())
|