nosible 0.3.1__py3-none-any.whl → 0.3.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.
- nosible/classes/result.py +3 -3
- nosible/nosible_client.py +7 -9
- {nosible-0.3.1.dist-info → nosible-0.3.2.dist-info}/METADATA +1 -1
- {nosible-0.3.1.dist-info → nosible-0.3.2.dist-info}/RECORD +7 -7
- {nosible-0.3.1.dist-info → nosible-0.3.2.dist-info}/WHEEL +0 -0
- {nosible-0.3.1.dist-info → nosible-0.3.2.dist-info}/licenses/LICENSE +0 -0
- {nosible-0.3.1.dist-info → nosible-0.3.2.dist-info}/top_level.txt +0 -0
nosible/classes/result.py
CHANGED
|
@@ -356,7 +356,7 @@ class Result:
|
|
|
356
356
|
The response must be a float in [-1.0, 1.0]. No other text must be returned.
|
|
357
357
|
"""
|
|
358
358
|
from openai import OpenAI
|
|
359
|
-
llm_client = OpenAI(base_url="https://openrouter.ai/api/
|
|
359
|
+
llm_client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=client.llm_api_key)
|
|
360
360
|
|
|
361
361
|
# Call the chat completions endpoint.
|
|
362
362
|
resp = llm_client.chat.completions.create(
|
|
@@ -519,7 +519,6 @@ class Result:
|
|
|
519
519
|
try:
|
|
520
520
|
from nosible import Search
|
|
521
521
|
|
|
522
|
-
exclude_companies = [self.url_hash] if not exclude_companies else exclude_companies.append(self.url_hash)
|
|
523
522
|
s = Search(
|
|
524
523
|
question=self.title,
|
|
525
524
|
expansions=[],
|
|
@@ -554,7 +553,8 @@ class Result:
|
|
|
554
553
|
iab_tier_4=iab_tier_4,
|
|
555
554
|
instruction=instruction,
|
|
556
555
|
)
|
|
557
|
-
|
|
556
|
+
results = client.fast_search(search=s)
|
|
557
|
+
return results
|
|
558
558
|
except Exception as e:
|
|
559
559
|
raise RuntimeError(f"Failed to find similar results for title '{self.title}': {e}") from e
|
|
560
560
|
|
nosible/nosible_client.py
CHANGED
|
@@ -211,7 +211,7 @@ class Nosible:
|
|
|
211
211
|
self._post = retry(
|
|
212
212
|
reraise=True,
|
|
213
213
|
stop=stop_after_attempt(self.retries) | stop_after_delay(self.timeout),
|
|
214
|
-
wait=wait_exponential(multiplier=1, min=1, max=
|
|
214
|
+
wait=wait_exponential(multiplier=1, min=1, max=20),
|
|
215
215
|
retry=retry_if_exception_type(httpx.RequestError),
|
|
216
216
|
before_sleep=before_sleep_log(self.logger, logging.WARNING),
|
|
217
217
|
)(self._post)
|
|
@@ -220,7 +220,7 @@ class Nosible:
|
|
|
220
220
|
self._generate_expansions = retry(
|
|
221
221
|
reraise=True,
|
|
222
222
|
stop=stop_after_attempt(self.retries) | stop_after_delay(self.timeout),
|
|
223
|
-
wait=wait_exponential(multiplier=1, min=1, max=
|
|
223
|
+
wait=wait_exponential(multiplier=1, min=1, max=20),
|
|
224
224
|
retry=retry_if_exception_type(httpx.RequestError),
|
|
225
225
|
before_sleep=before_sleep_log(self.logger, logging.WARNING),
|
|
226
226
|
)(self._generate_expansions)
|
|
@@ -2047,14 +2047,14 @@ class Nosible:
|
|
|
2047
2047
|
|
|
2048
2048
|
# Include / exclude companies
|
|
2049
2049
|
if include_companies:
|
|
2050
|
-
company_list = "
|
|
2050
|
+
company_list = " OR ".join(f"ARRAY_CONTAINS(companies, '{c}')" for c in include_companies)
|
|
2051
2051
|
clauses.append(
|
|
2052
|
-
f"(
|
|
2052
|
+
f"(companies IS NOT NULL AND ({company_list}))"
|
|
2053
2053
|
)
|
|
2054
2054
|
if exclude_companies:
|
|
2055
|
-
company_list = "
|
|
2055
|
+
company_list = " OR ".join(f"ARRAY_CONTAINS(companies, '{c}')" for c in exclude_companies)
|
|
2056
2056
|
clauses.append(
|
|
2057
|
-
f"(
|
|
2057
|
+
f"(companies IS NULL OR NOT ({company_list}))"
|
|
2058
2058
|
)
|
|
2059
2059
|
|
|
2060
2060
|
if include_docs:
|
|
@@ -2111,9 +2111,7 @@ class Nosible:
|
|
|
2111
2111
|
"certain",
|
|
2112
2112
|
"netloc",
|
|
2113
2113
|
"language",
|
|
2114
|
-
"
|
|
2115
|
-
"company_2",
|
|
2116
|
-
"company_3",
|
|
2114
|
+
"companies"
|
|
2117
2115
|
"doc_hash",
|
|
2118
2116
|
]
|
|
2119
2117
|
import polars as pl # Lazy import
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
nosible/__init__.py,sha256=11QmG9Wjprp_zB0VnPxGjqKwHmaoB0hoT8AGO6cGVMM,1426
|
|
2
|
-
nosible/nosible_client.py,sha256=
|
|
3
|
-
nosible/classes/result.py,sha256=
|
|
2
|
+
nosible/nosible_client.py,sha256=Bh2XADl00qnwlc4FbOhg6sf16I4c9Byx1L2ESdMkFuU,89278
|
|
3
|
+
nosible/classes/result.py,sha256=c1YOFdhZOnSjdcNqpc3YjXxKcoJ2c0ik6wgfIsXTAP0,22697
|
|
4
4
|
nosible/classes/result_set.py,sha256=8XrnnpGdm5lskqE0E7qSRR_mofPZfEHxtOFrkmfpbEM,52662
|
|
5
5
|
nosible/classes/search.py,sha256=VrpuAsS4pxcirR6l6WStJN0gPIfahZ_9Cx3YdNKczSw,13860
|
|
6
6
|
nosible/classes/search_set.py,sha256=VvtKXQ1_Ws_W-0p0C-wUvvdskeuXAyr65tpfvexAVw0,9895
|
|
@@ -9,8 +9,8 @@ nosible/classes/snippet_set.py,sha256=0jPMDhJNCO02WhvY1QR1HedvADvBxRcN6x3FItEgSi
|
|
|
9
9
|
nosible/classes/web_page.py,sha256=cvwQspxS0pU2nFgPLqnDtDWlLONHp1KwxerflHueLJ8,5838
|
|
10
10
|
nosible/utils/json_tools.py,sha256=PcSMjcLEhbA626jAIn0SuD_1-4QDduapZUenTSt3N2E,4569
|
|
11
11
|
nosible/utils/rate_limiter.py,sha256=11s38xZ1HDODkMR5jETKfVb6mArYwX9IPcklUe8wO6M,6063
|
|
12
|
-
nosible-0.3.
|
|
13
|
-
nosible-0.3.
|
|
14
|
-
nosible-0.3.
|
|
15
|
-
nosible-0.3.
|
|
16
|
-
nosible-0.3.
|
|
12
|
+
nosible-0.3.2.dist-info/licenses/LICENSE,sha256=8ifsV4DrsiKi8KVBFy8SBb3KXPXhofE3pYq07q1TSCQ,1117
|
|
13
|
+
nosible-0.3.2.dist-info/METADATA,sha256=xTsk_bl-A0Rr37Gc70flNKzkyrgP8eKtdHKoG8YIpu0,5503
|
|
14
|
+
nosible-0.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
+
nosible-0.3.2.dist-info/top_level.txt,sha256=mOconHuKcNJ1jTAj3DapQP_xB8YOmjTMyHg5txKH3uA,8
|
|
16
|
+
nosible-0.3.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|