unique-web-search 1.8.0__py3-none-any.whl → 1.8.2__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.
- unique_web_search/config.py +10 -3
- unique_web_search/services/executors/configs/__init__.py +1 -3
- unique_web_search/services/executors/configs/v2_config.py +10 -3
- unique_web_search/services/search_engine/__init__.py +2 -2
- {unique_web_search-1.8.0.dist-info → unique_web_search-1.8.2.dist-info}/METADATA +1 -1
- {unique_web_search-1.8.0.dist-info → unique_web_search-1.8.2.dist-info}/RECORD +7 -7
- {unique_web_search-1.8.0.dist-info → unique_web_search-1.8.2.dist-info}/WHEEL +0 -0
unique_web_search/config.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from logging import getLogger
|
|
2
|
-
from typing import Annotated
|
|
2
|
+
from typing import Annotated, Literal
|
|
3
3
|
|
|
4
|
-
from pydantic import BaseModel, Field, model_validator
|
|
4
|
+
from pydantic import BaseModel, Field, field_validator, model_validator
|
|
5
5
|
from pydantic.json_schema import SkipJsonSchema
|
|
6
6
|
from unique_toolkit._common.chunk_relevancy_sorter.config import (
|
|
7
7
|
ChunkRelevancySortConfig,
|
|
@@ -109,7 +109,7 @@ class WebSearchConfig(BaseToolConfig):
|
|
|
109
109
|
web_search_mode_config_v2: WebSearchV2Config = Field(
|
|
110
110
|
default_factory=WebSearchV2Config,
|
|
111
111
|
description="Web Search Mode Configuration V2",
|
|
112
|
-
title="Web Search Mode Configuration V2
|
|
112
|
+
title="Web Search Mode Configuration V2",
|
|
113
113
|
)
|
|
114
114
|
|
|
115
115
|
search_engine_config: ActivatedSearchEngine = Field( # type: ignore (This type is computed at runtime so pyright is not able to infer it)
|
|
@@ -188,3 +188,10 @@ class WebSearchConfig(BaseToolConfig):
|
|
|
188
188
|
if self.web_search_active_mode == WebSearchMode.V1
|
|
189
189
|
else self.web_search_mode_config_v2
|
|
190
190
|
)
|
|
191
|
+
|
|
192
|
+
@field_validator("web_search_active_mode", mode="before")
|
|
193
|
+
@classmethod
|
|
194
|
+
def validate_web_search_active_mode(cls, v: str) -> Literal["v1", "v2"]:
|
|
195
|
+
if "v2" in v.lower(): # Make sure to handle "v2 (beta)" as well
|
|
196
|
+
return "v2"
|
|
197
|
+
return "v1"
|
|
@@ -19,9 +19,7 @@ def get_default_web_search_mode_config() -> WebSearchMode:
|
|
|
19
19
|
case "v2":
|
|
20
20
|
return WebSearchMode.V2
|
|
21
21
|
case _:
|
|
22
|
-
raise ValueError(
|
|
23
|
-
f"Invalid web search mode: {env_settings.default_web_search_mode}"
|
|
24
|
-
)
|
|
22
|
+
raise ValueError(f"Invalid web search mode: {env_settings.web_search_mode}")
|
|
25
23
|
|
|
26
24
|
|
|
27
25
|
__all__ = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Annotated, Literal
|
|
2
2
|
|
|
3
|
-
from pydantic import Field
|
|
3
|
+
from pydantic import Field, field_validator
|
|
4
4
|
from pydantic.json_schema import SkipJsonSchema
|
|
5
5
|
from unique_toolkit._common.pydantic.rjsf_tags import RJSFMetaTag
|
|
6
6
|
from unique_toolkit.agentic.tools.config import get_configuration_dict
|
|
@@ -13,12 +13,12 @@ from unique_web_search.services.executors.configs.prompts import (
|
|
|
13
13
|
DEFAULT_TOOL_DESCRIPTION,
|
|
14
14
|
DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT,
|
|
15
15
|
)
|
|
16
|
-
from unique_web_search.services.helpers import
|
|
16
|
+
from unique_web_search.services.helpers import clean_model_title_generator
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class WebSearchV2Config(BaseWebSearchModeConfig[WebSearchMode.V2]):
|
|
20
20
|
model_config = get_configuration_dict(
|
|
21
|
-
model_title_generator=
|
|
21
|
+
model_title_generator=clean_model_title_generator
|
|
22
22
|
)
|
|
23
23
|
mode: SkipJsonSchema[Literal[WebSearchMode.V2]] = WebSearchMode.V2
|
|
24
24
|
|
|
@@ -46,3 +46,10 @@ class WebSearchV2Config(BaseWebSearchModeConfig[WebSearchMode.V2]):
|
|
|
46
46
|
default=DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT["v2"],
|
|
47
47
|
description="Description of the tool's capabilities, intended for inclusion in system prompts to inform the language model what the tool can do.",
|
|
48
48
|
)
|
|
49
|
+
|
|
50
|
+
@field_validator("mode", mode="before")
|
|
51
|
+
@classmethod
|
|
52
|
+
def validate_mode(cls, v: str) -> Literal["v2"]:
|
|
53
|
+
if "v2" in v.lower(): # Make sure to handle "v2 (beta)" as well
|
|
54
|
+
return "v2"
|
|
55
|
+
raise ValueError(f"Invalid mode: {v}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: unique-web-search
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.2
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Andreas Hauri, Gustav Hartz, Rami Azouz
|
|
6
6
|
Author-email: Andreas Hauri <andreas@unique.ch>, Gustav Hartz <gustav.hartz.ext@unique.ch>, Rami Azouz <rami.ext@unique.ch>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
unique_web_search/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
unique_web_search/client_settings.py,sha256=gGcD6ehgwv6mNzJw07naAGqYug2Rf25kYYQ4eeeqs_g,5879
|
|
3
|
-
unique_web_search/config.py,sha256=
|
|
3
|
+
unique_web_search/config.py,sha256=hshXhJdEzuddxHEgKYtdfZ8HcIgwLZWdpyp26xAYTUg,7378
|
|
4
4
|
unique_web_search/prompts.py,sha256=lfwW-qxzcJ0wthZ962yRgtuGvIdiDZ_wZ-LqjXLaC9A,2186
|
|
5
5
|
unique_web_search/schema.py,sha256=0Qivyo9RV1PmycXslOoQsa9-DnpHDav4wOsA1-BdYFw,1621
|
|
6
6
|
unique_web_search/service.py,sha256=ntosE4gtijK4Gpp52Jer_UqBk0OiK57cWJEpPBCU7GQ,13104
|
|
@@ -19,16 +19,16 @@ unique_web_search/services/crawlers/tavily.py,sha256=dFVyvS4VQ_Z8xbX-NY97KWYyx5c
|
|
|
19
19
|
unique_web_search/services/executors/README.md,sha256=wTtvzuW5d3SQouwP6BpgsSD2xQc1ZL9RRasX23nNwTw,8896
|
|
20
20
|
unique_web_search/services/executors/__init__.py,sha256=Dc4YyPJPz6vta7vf-Oudgz0NLzq9RF-6SAPD5EpTtVs,260
|
|
21
21
|
unique_web_search/services/executors/base_executor.py,sha256=FD6TKTDq5qZtruQrMmb1AWLT6qG54BoUWj1HSX1raiE,6241
|
|
22
|
-
unique_web_search/services/executors/configs/__init__.py,sha256=
|
|
22
|
+
unique_web_search/services/executors/configs/__init__.py,sha256=yOy0O95Mlmi0rukAj1YlkFpF6QznxET-8s-JMXgkUro,895
|
|
23
23
|
unique_web_search/services/executors/configs/base.py,sha256=TFHc3eKEN-3SHMiB100__y-g-aIfzUHLmgsCAllcwb4,833
|
|
24
24
|
unique_web_search/services/executors/configs/prompts.py,sha256=z84UyRq48dCiKBQsmXd37lwDLtCYZHUQz3ZAWUzcbVg,9748
|
|
25
25
|
unique_web_search/services/executors/configs/v1_config.py,sha256=GMlsP1CWer6WqGxTe9819CLtbtpwCFFLs9BO8yBsqBs,3732
|
|
26
|
-
unique_web_search/services/executors/configs/v2_config.py,sha256=
|
|
26
|
+
unique_web_search/services/executors/configs/v2_config.py,sha256=DZUV0DfZ9nemMsUO46rxnMXU-5dQK1IAqqkdsObtixo,2160
|
|
27
27
|
unique_web_search/services/executors/web_search_v1_executor.py,sha256=LCcHjWlLh68MEr7w9TJanh34SBmH64U-RpXoAenpvmw,13343
|
|
28
28
|
unique_web_search/services/executors/web_search_v2_executor.py,sha256=PLPS9hXFpyCzibDqQH3j5Vo5H4bcVXtrWZ3i-KvR6Og,11047
|
|
29
29
|
unique_web_search/services/helpers.py,sha256=4Iv0oiGrgeW8cx85JZqQr96AHye1oGu4Aw2NW_-cEy4,562
|
|
30
30
|
unique_web_search/services/search_engine/README.md,sha256=qBn85f7orZBrautIQBXT0BTf3tMndW8_3Cx3gck9KLo,19637
|
|
31
|
-
unique_web_search/services/search_engine/__init__.py,sha256=
|
|
31
|
+
unique_web_search/services/search_engine/__init__.py,sha256=Wzq26mFLy43cZtr-kbauQfYvQfID80F04YFYqbVL1WA,4096
|
|
32
32
|
unique_web_search/services/search_engine/base.py,sha256=MBQWiozcIAnXvH7vuMpLo6EaWYlAgI30c-ROb91wZRU,2069
|
|
33
33
|
unique_web_search/services/search_engine/bing.py,sha256=qBhQeeOOt9bxZK_5C3NeLcfHLgbFnMdhhwNAFjqrJEM,3743
|
|
34
34
|
unique_web_search/services/search_engine/brave.py,sha256=qJg7efQCuIU1l1kyb_H_0AvA-zboOg2Ip0QnnMhCpN0,3764
|
|
@@ -52,6 +52,6 @@ unique_web_search/services/search_engine/utils/vertexai/response_handler.py,sha2
|
|
|
52
52
|
unique_web_search/services/search_engine/vertexai.py,sha256=4AlNP7NHkSMD1lZROBFDcm61stjXDRTfzAkLBRfFy4A,4664
|
|
53
53
|
unique_web_search/settings.py,sha256=Yj8LqYzylqv3qA8yZ5XZSQ-CrTOOEx2O81Z3yk2cs-k,5795
|
|
54
54
|
unique_web_search/utils.py,sha256=5yLyzKyqy1v-Ut_TEYb4fggpiUj-nPf84YsO7db75so,4069
|
|
55
|
-
unique_web_search-1.8.
|
|
56
|
-
unique_web_search-1.8.
|
|
57
|
-
unique_web_search-1.8.
|
|
55
|
+
unique_web_search-1.8.2.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
56
|
+
unique_web_search-1.8.2.dist-info/METADATA,sha256=nKvXFqfohz6PYfvXeYCftT34M4nvVewXWiiH6D6tWOA,5565
|
|
57
|
+
unique_web_search-1.8.2.dist-info/RECORD,,
|
|
File without changes
|