sse-lib 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.
- sse_lib/__init__.py +119 -0
- sse_lib/client.py +1212 -0
- sse_lib/endpoints.py +115 -0
- sse_lib/exceptions.py +119 -0
- sse_lib/models.py +611 -0
- sse_lib/options.py +420 -0
- sse_lib/py.typed +0 -0
- sse_lib/transport.py +308 -0
- sse_lib-0.1.0.dist-info/METADATA +236 -0
- sse_lib-0.1.0.dist-info/RECORD +12 -0
- sse_lib-0.1.0.dist-info/WHEEL +5 -0
- sse_lib-0.1.0.dist-info/top_level.txt +1 -0
sse_lib/__init__.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""
|
|
2
|
+
sse_lib
|
|
3
|
+
-------
|
|
4
|
+
|
|
5
|
+
Thin client library for the **Semantic Search Engine** (SSE) REST API.
|
|
6
|
+
|
|
7
|
+
It wraps the HTTP endpoints of ``sse_api`` (collections, indexing, hybrid
|
|
8
|
+
search, RAG answers, chats and model listings) behind a small Python facade;
|
|
9
|
+
the server side stays untouched::
|
|
10
|
+
|
|
11
|
+
from sse_lib import SSEClient, SearchOptions, GenerativeOptions
|
|
12
|
+
|
|
13
|
+
with SSEClient("http://localhost:8271", token="...") as client:
|
|
14
|
+
collection = client.create_collection(
|
|
15
|
+
"my_docs",
|
|
16
|
+
"My Documents",
|
|
17
|
+
"Test collection",
|
|
18
|
+
embedder="radlab/polish-bi-encoder-mean",
|
|
19
|
+
reranker="radlab/polish-cross-encoder",
|
|
20
|
+
index_type="HNSW",
|
|
21
|
+
)
|
|
22
|
+
client.index_documents(collection.name, ["Some text to index."])
|
|
23
|
+
found = client.search(collection.name, "text", max_results=10)
|
|
24
|
+
answer = client.generate_answer(
|
|
25
|
+
found.query_response_id,
|
|
26
|
+
GenerativeOptions(
|
|
27
|
+
generative_model="radlab/pLLama-3-8B-DPO-L",
|
|
28
|
+
percentage_rank_mass=40,
|
|
29
|
+
),
|
|
30
|
+
)
|
|
31
|
+
print(answer.answer)
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
from __future__ import annotations
|
|
35
|
+
|
|
36
|
+
from sse_lib import endpoints
|
|
37
|
+
from sse_lib.client import SSEClient
|
|
38
|
+
from sse_lib.exceptions import (
|
|
39
|
+
SSEAPIError,
|
|
40
|
+
SSEAuthenticationError,
|
|
41
|
+
SSEConfigError,
|
|
42
|
+
SSEError,
|
|
43
|
+
SSEHTTPError,
|
|
44
|
+
SSETransportError,
|
|
45
|
+
SSEValueError,
|
|
46
|
+
)
|
|
47
|
+
from sse_lib.models import (
|
|
48
|
+
Answer,
|
|
49
|
+
Chat,
|
|
50
|
+
ChatHistory,
|
|
51
|
+
ChatMessage,
|
|
52
|
+
ChatReply,
|
|
53
|
+
Collection,
|
|
54
|
+
DocumentPreview,
|
|
55
|
+
DocumentPreviewPage,
|
|
56
|
+
DocumentRef,
|
|
57
|
+
IndexingJobStatus,
|
|
58
|
+
IndexingResult,
|
|
59
|
+
IndexingStatus,
|
|
60
|
+
SearchHistory,
|
|
61
|
+
SearchHistoryAnswer,
|
|
62
|
+
SearchHit,
|
|
63
|
+
SearchResponse,
|
|
64
|
+
UploadResult,
|
|
65
|
+
)
|
|
66
|
+
from sse_lib.options import (
|
|
67
|
+
DEFAULT_INDEX_TYPE,
|
|
68
|
+
INDEX_TYPES,
|
|
69
|
+
ChatOptions,
|
|
70
|
+
GenerativeOptions,
|
|
71
|
+
IndexingOptions,
|
|
72
|
+
SearchOptions,
|
|
73
|
+
build_options,
|
|
74
|
+
text_document,
|
|
75
|
+
)
|
|
76
|
+
from sse_lib.transport import DEFAULT_TIMEOUT, DEFAULT_TOKEN_TYPE, Transport
|
|
77
|
+
|
|
78
|
+
__version__ = "0.1.0"
|
|
79
|
+
|
|
80
|
+
__all__ = [
|
|
81
|
+
"DEFAULT_INDEX_TYPE",
|
|
82
|
+
"DEFAULT_TIMEOUT",
|
|
83
|
+
"DEFAULT_TOKEN_TYPE",
|
|
84
|
+
"INDEX_TYPES",
|
|
85
|
+
"Answer",
|
|
86
|
+
"Chat",
|
|
87
|
+
"ChatHistory",
|
|
88
|
+
"ChatMessage",
|
|
89
|
+
"ChatOptions",
|
|
90
|
+
"ChatReply",
|
|
91
|
+
"Collection",
|
|
92
|
+
"DocumentPreview",
|
|
93
|
+
"DocumentPreviewPage",
|
|
94
|
+
"DocumentRef",
|
|
95
|
+
"GenerativeOptions",
|
|
96
|
+
"IndexingJobStatus",
|
|
97
|
+
"IndexingOptions",
|
|
98
|
+
"IndexingResult",
|
|
99
|
+
"IndexingStatus",
|
|
100
|
+
"SSEAPIError",
|
|
101
|
+
"SSEAuthenticationError",
|
|
102
|
+
"SSEClient",
|
|
103
|
+
"SSEConfigError",
|
|
104
|
+
"SSEError",
|
|
105
|
+
"SSEHTTPError",
|
|
106
|
+
"SSETransportError",
|
|
107
|
+
"SSEValueError",
|
|
108
|
+
"SearchHistory",
|
|
109
|
+
"SearchHistoryAnswer",
|
|
110
|
+
"SearchHit",
|
|
111
|
+
"SearchOptions",
|
|
112
|
+
"SearchResponse",
|
|
113
|
+
"Transport",
|
|
114
|
+
"UploadResult",
|
|
115
|
+
"build_options",
|
|
116
|
+
"endpoints",
|
|
117
|
+
"text_document",
|
|
118
|
+
"__version__",
|
|
119
|
+
]
|