reserp-haystack 0.1.0__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.
- haystack_integrations/components/websearch/py.typed +1 -0
- haystack_integrations/components/websearch/reserp/__init__.py +6 -0
- haystack_integrations/components/websearch/reserp/websearch.py +49 -0
- reserp_haystack-0.1.0.dist-info/METADATA +52 -0
- reserp_haystack-0.1.0.dist-info/RECORD +7 -0
- reserp_haystack-0.1.0.dist-info/WHEEL +4 -0
- reserp_haystack-0.1.0.dist-info/licenses/LICENSE +22 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Minimal Haystack component for Reserp."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import Any
|
|
7
|
+
from urllib.request import Request, urlopen
|
|
8
|
+
|
|
9
|
+
from haystack import component, default_from_dict, default_to_dict
|
|
10
|
+
from haystack.utils import Secret, deserialize_secrets_inplace
|
|
11
|
+
|
|
12
|
+
ENDPOINT = "https://api.reserp.ai/v1/serp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@component
|
|
16
|
+
class ReserpWebSearch:
|
|
17
|
+
"""Expose one public Reserp request as a Haystack component call."""
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
api_key: Secret | None = None,
|
|
22
|
+
) -> None:
|
|
23
|
+
self.api_key = api_key or Secret.from_env_var("RESERP_API_KEY")
|
|
24
|
+
self.api_key.resolve_value()
|
|
25
|
+
|
|
26
|
+
def to_dict(self) -> dict[str, Any]:
|
|
27
|
+
"""Serialize this component."""
|
|
28
|
+
return default_to_dict(self, api_key=self.api_key.to_dict())
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
def from_dict(cls, data: dict[str, Any]) -> ReserpWebSearch:
|
|
32
|
+
"""Deserialize this component."""
|
|
33
|
+
deserialize_secrets_inplace(data["init_parameters"], keys=["api_key"])
|
|
34
|
+
return default_from_dict(cls, data)
|
|
35
|
+
|
|
36
|
+
@component.output_types(response=dict[str, Any])
|
|
37
|
+
def run(self, url: str) -> dict[str, dict[str, Any]]:
|
|
38
|
+
"""Make one Reserp request and expose the public JSON response."""
|
|
39
|
+
request = Request(
|
|
40
|
+
ENDPOINT,
|
|
41
|
+
data=json.dumps({"url": url}).encode(),
|
|
42
|
+
headers={
|
|
43
|
+
"Authorization": f"Bearer {self.api_key.resolve_value()}",
|
|
44
|
+
"Content-Type": "application/json",
|
|
45
|
+
},
|
|
46
|
+
method="POST",
|
|
47
|
+
)
|
|
48
|
+
with urlopen(request) as response:
|
|
49
|
+
return {"response": json.load(response)}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: reserp-haystack
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Minimal Haystack component for the Reserp Google Search API
|
|
5
|
+
Project-URL: Homepage, https://reserp.ai/
|
|
6
|
+
Project-URL: Documentation, https://reserp.ai/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/reserp-ai/reserp-haystack
|
|
8
|
+
Project-URL: Issues, https://github.com/reserp-ai/reserp-haystack/issues
|
|
9
|
+
Author: Reserp
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: google-search,haystack,reserp,search-api,serp-api
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: haystack-ai<3,>=2.24.1
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Reserp Haystack Integration
|
|
23
|
+
|
|
24
|
+
`ReserpWebSearch` exposes the [Reserp Google Search API](https://reserp.ai/) as a minimal Haystack component.
|
|
25
|
+
|
|
26
|
+
The component accepts the public Reserp request field—a complete Google Search URL—makes one request, and returns the public JSON under Haystack's required output key. It adds no retries, timeout policy, concurrency management, caching, queues, result conversion, or automatic pagination.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install reserp-haystack
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from haystack.utils import Secret
|
|
38
|
+
from haystack_integrations.components.websearch.reserp import ReserpWebSearch
|
|
39
|
+
|
|
40
|
+
search = ReserpWebSearch(api_key=Secret.from_env_var("RESERP_API_KEY"))
|
|
41
|
+
result = search.run(
|
|
42
|
+
url="https://www.google.com/search?q=photonic+computing&gl=us&hl=en"
|
|
43
|
+
)
|
|
44
|
+
print(result["response"])
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The surrounding pipeline owns retries, timeouts, task queues, concurrency, observability, and pagination. See the [Reserp API documentation](https://reserp.ai/docs) and [OpenAPI definition](https://reserp.ai/openapi.json).
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT
|
|
52
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
haystack_integrations/components/websearch/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
2
|
+
haystack_integrations/components/websearch/reserp/__init__.py,sha256=-z0gYVb6G20DGo0fg7unsQYet7rmPS2zYbLjttleldE,180
|
|
3
|
+
haystack_integrations/components/websearch/reserp/websearch.py,sha256=iv32dLIlzNXGtsJTqJoKzbctAmsyqC4m3sRcoQEa7mQ,1625
|
|
4
|
+
reserp_haystack-0.1.0.dist-info/METADATA,sha256=NrYMmBA470j3bWr0VtDqxGO6m8x9lqtjTPZArr1B7RA,1871
|
|
5
|
+
reserp_haystack-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
6
|
+
reserp_haystack-0.1.0.dist-info/licenses/LICENSE,sha256=-uOsPY4deEB-26MFlCmfiog7nzOfvFm-bSGUEhTadRw,1064
|
|
7
|
+
reserp_haystack-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Reserp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|