unique-web-search 1.8.2__py3-none-any.whl → 1.8.3__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/services/search_engine/custom_api.py +11 -2
- unique_web_search/settings.py +2 -0
- {unique_web_search-1.8.2.dist-info → unique_web_search-1.8.3.dist-info}/METADATA +2 -2
- {unique_web_search-1.8.2.dist-info → unique_web_search-1.8.3.dist-info}/RECORD +5 -5
- {unique_web_search-1.8.2.dist-info → unique_web_search-1.8.3.dist-info}/WHEEL +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from typing import Literal, TypeVar
|
|
2
|
+
from typing import Any, Literal, TypeVar
|
|
3
3
|
|
|
4
4
|
from httpx import AsyncClient
|
|
5
5
|
from pydantic import Field
|
|
@@ -86,7 +86,10 @@ class CustomAPI(SearchEngine[CustomAPIConfig]):
|
|
|
86
86
|
async def search(self, query: str, **kwargs) -> list[WebSearchResult]:
|
|
87
87
|
params, body = self._prepare_request_params_and_body(query)
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
async_client_params = self._client_config | {
|
|
90
|
+
"timeout": self.config.timeout,
|
|
91
|
+
}
|
|
92
|
+
async with AsyncClient(**async_client_params) as client:
|
|
90
93
|
response = await client.request(
|
|
91
94
|
method=self._request_method,
|
|
92
95
|
headers=self._headers,
|
|
@@ -118,6 +121,12 @@ class CustomAPI(SearchEngine[CustomAPIConfig]):
|
|
|
118
121
|
def _additional_body_params(self) -> dict[str, str]:
|
|
119
122
|
return json.loads(self.config.api_additional_body_params)
|
|
120
123
|
|
|
124
|
+
@property
|
|
125
|
+
def _client_config(self) -> dict[str, Any]:
|
|
126
|
+
if env_settings.custom_web_search_api_client_config is None:
|
|
127
|
+
return {}
|
|
128
|
+
return json.loads(env_settings.custom_web_search_api_client_config)
|
|
129
|
+
|
|
121
130
|
def _prepare_request_params_and_body(self, query: str) -> tuple[dict, dict]:
|
|
122
131
|
params = self._additional_query_params
|
|
123
132
|
body = self._additional_body_params
|
unique_web_search/settings.py
CHANGED
|
@@ -66,6 +66,7 @@ class Base(BaseSettings):
|
|
|
66
66
|
custom_web_search_api_headers: str | None = None
|
|
67
67
|
custom_web_search_api_additional_query_params: str | None = None
|
|
68
68
|
custom_web_search_api_additional_body_params: str | None = None
|
|
69
|
+
custom_web_search_api_client_config: str | None = None
|
|
69
70
|
|
|
70
71
|
# Proxy settings
|
|
71
72
|
## Shared settings
|
|
@@ -139,6 +140,7 @@ class Base(BaseSettings):
|
|
|
139
140
|
"custom_web_search_api_headers",
|
|
140
141
|
"custom_web_search_api_additional_query_params",
|
|
141
142
|
"custom_web_search_api_additional_body_params",
|
|
143
|
+
"custom_web_search_api_client_config",
|
|
142
144
|
mode="after",
|
|
143
145
|
)
|
|
144
146
|
def validate_json(cls, v: str | None, info: ValidationInfo) -> str | None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: unique-web-search
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.3
|
|
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>
|
|
@@ -17,7 +17,7 @@ Requires-Dist: tavily-python>=0.7.11,<1
|
|
|
17
17
|
Requires-Dist: unidecode>=1.4.0,<2
|
|
18
18
|
Requires-Dist: azure-ai-projects>=1.0.0,<2
|
|
19
19
|
Requires-Dist: azure-identity>=1.25.0,<2
|
|
20
|
-
Requires-Dist: unique-toolkit>=1.
|
|
20
|
+
Requires-Dist: unique-toolkit>=1.45.0,<2
|
|
21
21
|
Requires-Dist: azure-core>=1.36.0,<2
|
|
22
22
|
Requires-Dist: google-cloud-aiplatform>=1.128.0,<2
|
|
23
23
|
Requires-Dist: google-auth>=2.43.0,<3
|
|
@@ -32,7 +32,7 @@ unique_web_search/services/search_engine/__init__.py,sha256=Wzq26mFLy43cZtr-kbau
|
|
|
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
|
|
35
|
-
unique_web_search/services/search_engine/custom_api.py,sha256=
|
|
35
|
+
unique_web_search/services/search_engine/custom_api.py,sha256=nW4a1ruIBiMHaF4kjJuVNImBM8rklTjSWFhkIN1DX0E,4968
|
|
36
36
|
unique_web_search/services/search_engine/firecrawl.py,sha256=CEhnpyxYvr8LO10Xxl54hWpIElCLBRQBH-x8o_vMjPA,4611
|
|
37
37
|
unique_web_search/services/search_engine/google.py,sha256=SKdj2uR6nwOT18ktCkAcOJLoQULq7GeHILDFFewG8dU,5423
|
|
38
38
|
unique_web_search/services/search_engine/jina.py,sha256=1I4C18W-UnjoNe4NXK3K5jfeHe9-2u9RBMkWp9Rgo60,10009
|
|
@@ -50,8 +50,8 @@ unique_web_search/services/search_engine/utils/vertexai/gemini.py,sha256=lpu9COy
|
|
|
50
50
|
unique_web_search/services/search_engine/utils/vertexai/prompts.py,sha256=-gq9R6btaubDgPjENVhmlJUBqPYX6AYCBg2MF_o0KZY,1748
|
|
51
51
|
unique_web_search/services/search_engine/utils/vertexai/response_handler.py,sha256=ddlYzNQ8SFR1I31tittED4U6zp4qoBBcYSYFpMVgyd4,2537
|
|
52
52
|
unique_web_search/services/search_engine/vertexai.py,sha256=4AlNP7NHkSMD1lZROBFDcm61stjXDRTfzAkLBRfFy4A,4664
|
|
53
|
-
unique_web_search/settings.py,sha256=
|
|
53
|
+
unique_web_search/settings.py,sha256=EnMmQZGfn6S8_TFY6fCuz_DrL1dTabPuIOzRbQwAO-I,5901
|
|
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.3.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
56
|
+
unique_web_search-1.8.3.dist-info/METADATA,sha256=2VlbrJC86vSQ-I16zzWJGqg2R8CyulMMhxRNCNG8ViI,5565
|
|
57
|
+
unique_web_search-1.8.3.dist-info/RECORD,,
|
|
File without changes
|