opensolr-haystack 0.2.5__tar.gz → 0.2.7__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.
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/PKG-INFO +3 -1
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/README.md +2 -0
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/haystack_integrations/document_stores/opensolr/client.py +31 -2
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/opensolr_haystack.egg-info/PKG-INFO +3 -1
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/pyproject.toml +1 -1
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/LICENSE +0 -0
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/haystack_integrations/components/retrievers/opensolr/__init__.py +0 -0
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/haystack_integrations/components/retrievers/opensolr/retriever.py +0 -0
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/haystack_integrations/document_stores/opensolr/__init__.py +0 -0
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/haystack_integrations/document_stores/opensolr/store.py +0 -0
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/opensolr_haystack.egg-info/SOURCES.txt +0 -0
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/opensolr_haystack.egg-info/dependency_links.txt +0 -0
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/opensolr_haystack.egg-info/requires.txt +0 -0
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/opensolr_haystack.egg-info/top_level.txt +0 -0
- {opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opensolr-haystack
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Haystack integration for Opensolr — managed Apache Solr DocumentStore with server-side embeddings and hybrid BM25+kNN retrieval
|
|
5
5
|
Author-email: Opensolr <support@opensolr.com>
|
|
6
6
|
License: MIT
|
|
@@ -22,6 +22,8 @@ Dynamic: license-file
|
|
|
22
22
|
[Opensolr](https://opensolr.com) — managed Apache Solr as a DocumentStore,
|
|
23
23
|
with **server-side embeddings** and native **hybrid (BM25 + kNN) retrieval**.
|
|
24
24
|
|
|
25
|
+
**See it live (real news index, hybrid + AI answer):** https://search.opensolr.com/news__dense?q=how+am+I+supposed+to+save+money%3F
|
|
26
|
+
|
|
25
27
|
No embedder components needed in your pipeline — texts and queries are
|
|
26
28
|
embedded on Opensolr's GPU infrastructure (multilingual E5-large-instruct,
|
|
27
29
|
1024 dimensions, cosine).
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
[Opensolr](https://opensolr.com) — managed Apache Solr as a DocumentStore,
|
|
5
5
|
with **server-side embeddings** and native **hybrid (BM25 + kNN) retrieval**.
|
|
6
6
|
|
|
7
|
+
**See it live (real news index, hybrid + AI answer):** https://search.opensolr.com/news__dense?q=how+am+I+supposed+to+save+money%3F
|
|
8
|
+
|
|
7
9
|
No embedder components needed in your pipeline — texts and queries are
|
|
8
10
|
embedded on Opensolr's GPU infrastructure (multilingual E5-large-instruct,
|
|
9
11
|
1024 dimensions, cosine).
|
|
@@ -42,6 +42,26 @@ def resolve_location(location: str) -> str:
|
|
|
42
42
|
BATCH_EMBED_MAX = 50
|
|
43
43
|
|
|
44
44
|
|
|
45
|
+
# Default RAG instruction (added 2026-08-25).
|
|
46
|
+
# Without an instruction the server falls back to "Answer the query based on
|
|
47
|
+
# the context", which makes the model hedge: it opens with a disclaimer that
|
|
48
|
+
# the context does not cover the question and then answers it anyway. These
|
|
49
|
+
# rules make it lead with the answer and keep the concrete details. Callers
|
|
50
|
+
# can still override everything by passing ``instruction``.
|
|
51
|
+
DEFAULT_RAG_INSTRUCTION = (
|
|
52
|
+
# Consolidated 2026-08-26. The rule list had grown to eight overlapping lines and the
|
|
53
|
+
# 3B model drowned in them: it restated the question, opened with a preamble, and
|
|
54
|
+
# presented items as fit for purposes the context never stated. Tested against the
|
|
55
|
+
# live model on three cases (answer present, answer absent, yes/no) before shipping.
|
|
56
|
+
"Answer the question using only the context below.\n"
|
|
57
|
+
"Begin with the answer itself, the specific fact, product or detail. "
|
|
58
|
+
"No preamble, no restating the question, no heading.\n"
|
|
59
|
+
"Then give the concrete supporting details from the context: names, numbers, sizes, dates. "
|
|
60
|
+
"Write two to four sentences.\n"
|
|
61
|
+
"If the context holds no answer, say that in the first sentence and name what it does contain instead.\n"
|
|
62
|
+
"Never present something as suitable for a purpose the context does not state."
|
|
63
|
+
)
|
|
64
|
+
|
|
45
65
|
class OpensolrError(RuntimeError):
|
|
46
66
|
"""Raised when an Opensolr API call fails."""
|
|
47
67
|
|
|
@@ -353,6 +373,16 @@ class OpensolrClient:
|
|
|
353
373
|
index, query, rows=docs, fl="title,description,text", fq=fq
|
|
354
374
|
)
|
|
355
375
|
hits = body.get("response", {}).get("docs", [])
|
|
376
|
+
# Relevance floor (2026-08-25). Retrieval always returns `docs` hits, so a
|
|
377
|
+
# narrow question arrives with one good match and several unrelated ones.
|
|
378
|
+
# The model then sees that most of its context does not answer the query
|
|
379
|
+
# and hedges. Drop anything scoring below half of the best hit; documents
|
|
380
|
+
# without a score are kept, since only provable weakness is filtered.
|
|
381
|
+
scored = [float(h["score"]) for h in hits if isinstance(h, dict) and h.get("score") is not None]
|
|
382
|
+
if scored:
|
|
383
|
+
floor = max(scored) * 0.5
|
|
384
|
+
hits = [h for h in hits if h.get("score") is None or float(h["score"]) >= floor]
|
|
385
|
+
|
|
356
386
|
parts: List[str] = []
|
|
357
387
|
for doc in hits[:docs]:
|
|
358
388
|
text_words = _flat(doc.get("text")).split()[:words]
|
|
@@ -390,8 +420,7 @@ class OpensolrClient:
|
|
|
390
420
|
"stream": "false",
|
|
391
421
|
**params,
|
|
392
422
|
}
|
|
393
|
-
|
|
394
|
-
data["instruction"] = instruction
|
|
423
|
+
data["instruction"] = instruction or DEFAULT_RAG_INSTRUCTION
|
|
395
424
|
if "context" not in data:
|
|
396
425
|
try:
|
|
397
426
|
context = self._rag_context(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opensolr-haystack
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Haystack integration for Opensolr — managed Apache Solr DocumentStore with server-side embeddings and hybrid BM25+kNN retrieval
|
|
5
5
|
Author-email: Opensolr <support@opensolr.com>
|
|
6
6
|
License: MIT
|
|
@@ -22,6 +22,8 @@ Dynamic: license-file
|
|
|
22
22
|
[Opensolr](https://opensolr.com) — managed Apache Solr as a DocumentStore,
|
|
23
23
|
with **server-side embeddings** and native **hybrid (BM25 + kNN) retrieval**.
|
|
24
24
|
|
|
25
|
+
**See it live (real news index, hybrid + AI answer):** https://search.opensolr.com/news__dense?q=how+am+I+supposed+to+save+money%3F
|
|
26
|
+
|
|
25
27
|
No embedder components needed in your pipeline — texts and queries are
|
|
26
28
|
embedded on Opensolr's GPU infrastructure (multilingual E5-large-instruct,
|
|
27
29
|
1024 dimensions, cosine).
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "opensolr-haystack"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.7"
|
|
8
8
|
description = "Haystack integration for Opensolr — managed Apache Solr DocumentStore with server-side embeddings and hybrid BM25+kNN retrieval"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/opensolr_haystack.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{opensolr_haystack-0.2.5 → opensolr_haystack-0.2.7}/opensolr_haystack.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|