keenable-haystack 0.1.0__tar.gz → 0.1.2__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.
- {keenable_haystack-0.1.0 → keenable_haystack-0.1.2}/PKG-INFO +2 -3
- {keenable_haystack-0.1.0 → keenable_haystack-0.1.2}/README.md +1 -2
- {keenable_haystack-0.1.0 → keenable_haystack-0.1.2}/haystack_integrations/components/websearch/keenable/web_search.py +6 -8
- {keenable_haystack-0.1.0 → keenable_haystack-0.1.2}/pyproject.toml +1 -1
- {keenable_haystack-0.1.0 → keenable_haystack-0.1.2}/.gitignore +0 -0
- {keenable_haystack-0.1.0 → keenable_haystack-0.1.2}/LICENSE +0 -0
- {keenable_haystack-0.1.0 → keenable_haystack-0.1.2}/haystack_integrations/components/fetchers/keenable/__init__.py +0 -0
- {keenable_haystack-0.1.0 → keenable_haystack-0.1.2}/haystack_integrations/components/fetchers/keenable/fetcher.py +0 -0
- {keenable_haystack-0.1.0 → keenable_haystack-0.1.2}/haystack_integrations/components/websearch/keenable/__init__.py +0 -0
- {keenable_haystack-0.1.0 → keenable_haystack-0.1.2}/haystack_integrations/components/websearch/keenable/_client.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: keenable-haystack
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Keenable web-search and page-fetch components for Haystack. Keyless by default.
|
|
5
5
|
Project-URL: Homepage, https://keenable.ai
|
|
6
6
|
Project-URL: Documentation, https://docs.keenable.ai
|
|
@@ -34,8 +34,7 @@ Description-Content-Type: text/markdown
|
|
|
34
34
|
so you don't need a separate `LinkContentFetcher` + `HTMLToDocument` step).
|
|
35
35
|
|
|
36
36
|
**Keyless by default**: with no API key the keyless public endpoints are used.
|
|
37
|
-
Provide a key to use the authenticated endpoints (
|
|
38
|
-
and for higher rate limits).
|
|
37
|
+
Provide a key to use the authenticated endpoints (for higher rate limits).
|
|
39
38
|
|
|
40
39
|
## Install
|
|
41
40
|
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
so you don't need a separate `LinkContentFetcher` + `HTMLToDocument` step).
|
|
12
12
|
|
|
13
13
|
**Keyless by default**: with no API key the keyless public endpoints are used.
|
|
14
|
-
Provide a key to use the authenticated endpoints (
|
|
15
|
-
and for higher rate limits).
|
|
14
|
+
Provide a key to use the authenticated endpoints (for higher rate limits).
|
|
16
15
|
|
|
17
16
|
## Install
|
|
18
17
|
|
|
@@ -9,6 +9,7 @@ from haystack.utils import Secret, deserialize_secrets_inplace
|
|
|
9
9
|
|
|
10
10
|
from haystack_integrations.components.websearch.keenable._client import (
|
|
11
11
|
KeenableError,
|
|
12
|
+
_redact,
|
|
12
13
|
keenable_post,
|
|
13
14
|
normalize_key,
|
|
14
15
|
)
|
|
@@ -27,8 +28,7 @@ class KeenableWebSearch:
|
|
|
27
28
|
Keyless by default: with no API key the keyless public endpoint
|
|
28
29
|
(``/v1/search/public``) is used. Provide an API key (the ``api_key`` argument
|
|
29
30
|
or the ``KEENABLE_API_KEY`` environment variable) to use the authenticated
|
|
30
|
-
endpoint (``/v1/search``)
|
|
31
|
-
rate limits.
|
|
31
|
+
endpoint (``/v1/search``) for higher rate limits.
|
|
32
32
|
|
|
33
33
|
The API endpoint is read from ``KEENABLE_API_URL`` (HTTPS enforced), never a
|
|
34
34
|
``run`` argument, so the search cannot be redirected to an arbitrary host.
|
|
@@ -60,8 +60,7 @@ class KeenableWebSearch:
|
|
|
60
60
|
absent (or blank) the keyless public endpoint is used.
|
|
61
61
|
:param top_k: Keep at most this many results (applied client-side; the API
|
|
62
62
|
returns a fixed-size set with no count parameter). ``None`` keeps all.
|
|
63
|
-
:param mode: Default search mode, ``"pro"`` (
|
|
64
|
-
(low latency). ``"realtime"`` requires an API key. Overridable per run.
|
|
63
|
+
:param mode: Default search mode, ``"pro"`` (default). Overridable per run.
|
|
65
64
|
:param site: Default single-domain restriction, e.g. ``"github.com"``.
|
|
66
65
|
Overridable per run.
|
|
67
66
|
:param timeout: Per-request timeout in seconds.
|
|
@@ -118,9 +117,6 @@ class KeenableWebSearch:
|
|
|
118
117
|
"""
|
|
119
118
|
effective_mode = mode or self.mode
|
|
120
119
|
api_key = normalize_key(self.api_key.resolve_value())
|
|
121
|
-
if effective_mode == "realtime" and api_key is None:
|
|
122
|
-
msg = "mode='realtime' requires an API key; it is not available on the keyless endpoint."
|
|
123
|
-
raise KeenableError(msg)
|
|
124
120
|
|
|
125
121
|
payload: dict[str, Any] = {"query": query, "mode": effective_mode}
|
|
126
122
|
for field, value in (
|
|
@@ -136,7 +132,9 @@ class KeenableWebSearch:
|
|
|
136
132
|
data = keenable_post("/v1/search/public", "/v1/search", payload, api_key, self.timeout)
|
|
137
133
|
results = data.get("results")
|
|
138
134
|
if not isinstance(results, list):
|
|
139
|
-
|
|
135
|
+
# Redact like _client does: a 200 body could echo the key (e.g. a
|
|
136
|
+
# debug field), and it would otherwise land in the exception text.
|
|
137
|
+
msg = f"Unexpected response from the Keenable search API: {_redact(repr(data)[:200], api_key)}"
|
|
140
138
|
raise KeenableError(msg)
|
|
141
139
|
|
|
142
140
|
if self.top_k is not None:
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "keenable-haystack"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
description = "Keenable web-search and page-fetch components for Haystack. Keyless by default."
|
|
9
9
|
authors = [{ name = "Keenable", email = "hello@keenable.ai" }]
|
|
10
10
|
maintainers = [{ name = "keenableai" }]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|