nosible 0.2.8__py3-none-any.whl → 0.2.10__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_set.py +0 -6
- nosible-0.2.10.dist-info/METADATA +165 -0
- {nosible-0.2.8.dist-info → nosible-0.2.10.dist-info}/RECORD +6 -6
- nosible-0.2.8.dist-info/METADATA +0 -384
- {nosible-0.2.8.dist-info → nosible-0.2.10.dist-info}/WHEEL +0 -0
- {nosible-0.2.8.dist-info → nosible-0.2.10.dist-info}/licenses/LICENSE +0 -0
- {nosible-0.2.8.dist-info → nosible-0.2.10.dist-info}/top_level.txt +0 -0
nosible/classes/result_set.py
CHANGED
|
@@ -429,7 +429,6 @@ class ResultSet(Iterator[Result]):
|
|
|
429
429
|
>>> import polars as pl
|
|
430
430
|
>>> from nosible.classes.result_set import Result, ResultSet
|
|
431
431
|
|
|
432
|
-
# -- date grouping (published) --------------------------------------------
|
|
433
432
|
>>> data = [
|
|
434
433
|
... {"published": "2021-01-15", "netloc": "a.com", "author": "", "language": "en", "similarity": 0.5},
|
|
435
434
|
... {"published": "2021-02-20", "netloc": "a.com", "author": "", "language": "en", "similarity": 0.8},
|
|
@@ -439,23 +438,18 @@ class ResultSet(Iterator[Result]):
|
|
|
439
438
|
>>> results.analyze(by="published") # doctest: +NORMALIZE_WHITESPACE
|
|
440
439
|
{'2021-01': 1, '2021-02': 2}
|
|
441
440
|
|
|
442
|
-
# -- numeric stats (similarity) ------------------------------------------
|
|
443
441
|
>>> stats = results.analyze(by="similarity")
|
|
444
442
|
>>> set(stats) == {"count", "null_count", "mean", "std", "min", "25%", "50%", "75%", "max"}
|
|
445
443
|
True
|
|
446
444
|
>>> round(stats["mean"], 2)
|
|
447
445
|
0.5
|
|
448
446
|
|
|
449
|
-
# -- categorical counts (language) --------------------------------------
|
|
450
447
|
>>> results.analyze(by="language")
|
|
451
448
|
{'en': 2, 'fr': 1}
|
|
452
449
|
|
|
453
|
-
# -- author special case ------------------------------------------------
|
|
454
|
-
# empty author strings get mapped to "Author Unknown"
|
|
455
450
|
>>> results.analyze(by="author")
|
|
456
451
|
{'Author Unknown': 3}
|
|
457
452
|
|
|
458
|
-
# -- invalid field -------------------------------------------------------
|
|
459
453
|
>>> results.analyze(by="foobar") # doctest: +IGNORE_EXCEPTION_DETAIL
|
|
460
454
|
Traceback (most recent call last):
|
|
461
455
|
ValueError: Cannot analyze by 'foobar' - not a valid field.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nosible
|
|
3
|
+
Version: 0.2.10
|
|
4
|
+
Summary: Python client for the NOSIBLE Search API
|
|
5
|
+
Home-page: https://github.com/NosibleAI/nosible
|
|
6
|
+
Author: Stuart Reid, Matthew Dicks, Richard Taylor, Gareth Warburton
|
|
7
|
+
Author-email: Stuart Reid <stuart@nosible.com>, Matthew Dicks <matthew@nosible.com>, Richard Taylor <richard@nosible.com>, Gareth Warburton <gareth@nosible.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/NosibleAI/nosible
|
|
10
|
+
Project-URL: Documentation, https://nosible-py.readthedocs.io/en/latest/
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
17
|
+
Classifier: Intended Audience :: Information Technology
|
|
18
|
+
Classifier: Intended Audience :: Science/Research
|
|
19
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Operating System :: OS Independent
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: polars
|
|
31
|
+
Requires-Dist: duckdb
|
|
32
|
+
Requires-Dist: openai
|
|
33
|
+
Requires-Dist: tantivy
|
|
34
|
+
Requires-Dist: pyrate-limiter
|
|
35
|
+
Requires-Dist: tenacity
|
|
36
|
+
Requires-Dist: cryptography
|
|
37
|
+
Requires-Dist: pyarrow
|
|
38
|
+
Requires-Dist: pandas
|
|
39
|
+
Dynamic: author
|
|
40
|
+
Dynamic: home-page
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
Dynamic: requires-python
|
|
43
|
+
|
|
44
|
+
[](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
|
|
45
|
+
[](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
|
|
46
|
+
[](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
|
|
47
|
+
[](https://nosible-py.readthedocs.io/en/latest/)
|
|
48
|
+
[](https://pypi.org/project/nosible/)
|
|
49
|
+
[](https://codecov.io/gh/NosibleAI/nosible-py)
|
|
50
|
+
[](https://pypi.org)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
[//]: # ([](https://www.nosible.ai/))
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
# NOSIBLE Search Client
|
|
58
|
+
|
|
59
|
+
A high-level Python client for the [NOSIBLE Search API](https://www.nosible.ai/search/v1/docs/swagger#/).
|
|
60
|
+
Easily integrate the Nosible Search API into your Python projects.
|
|
61
|
+
|
|
62
|
+
### 📄 Documentation
|
|
63
|
+
|
|
64
|
+
You can find the full NOSIBLE Search Client documentation
|
|
65
|
+
[here](https://nosible-py.readthedocs.io/).
|
|
66
|
+
|
|
67
|
+
### 📦 Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install nosible
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### ⚡ Installing with uv
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
uv pip install nosible
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Requirements**:
|
|
80
|
+
|
|
81
|
+
* Python 3.9+
|
|
82
|
+
* polars
|
|
83
|
+
* duckdb
|
|
84
|
+
* openai
|
|
85
|
+
* tantivy
|
|
86
|
+
* pyrate-limiter
|
|
87
|
+
* tenacity
|
|
88
|
+
* cryptography
|
|
89
|
+
* pyarrow
|
|
90
|
+
* pandas
|
|
91
|
+
|
|
92
|
+
### 🔑 Authentication
|
|
93
|
+
|
|
94
|
+
1. Sign in to [NOSIBLE.AI](https://www.nosible.ai/) and grab your free API key.
|
|
95
|
+
2. Set it as an environment variable or pass directly:
|
|
96
|
+
|
|
97
|
+
On Windows
|
|
98
|
+
|
|
99
|
+
```powershell
|
|
100
|
+
$Env:NOSIBLE_API_KEY="basic|abcd1234..."
|
|
101
|
+
$Env:LLM_API_KEY="sk-..." # for query expansions (optional)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
On Linux
|
|
105
|
+
```bash
|
|
106
|
+
export NOSIBLE_API_KEY="basic|abcd1234..."
|
|
107
|
+
export LLM_API_KEY="sk-..." # for query expansions (optional)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Or in code:
|
|
111
|
+
|
|
112
|
+
- As an argument:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from nosible import Nosible
|
|
116
|
+
|
|
117
|
+
client = Nosible(
|
|
118
|
+
nosible_api_key="basic|abcd1234...",
|
|
119
|
+
llm_api_key="sk-...",
|
|
120
|
+
)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
- As an environment variable:
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
from nosible import Nosible
|
|
127
|
+
import os
|
|
128
|
+
|
|
129
|
+
os.environ["NOSIBLE_API_KEY"] = "basic|abcd1234..."
|
|
130
|
+
os.environ["LLM_API_KEY"] = "sk-..."
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 🔍 Your first search
|
|
134
|
+
|
|
135
|
+
To complete your first search:
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
from nosible import Nosible
|
|
139
|
+
|
|
140
|
+
with Nosible(nosible_api_key="YOUR API KEY") as client:
|
|
141
|
+
|
|
142
|
+
results = client.fast_search(
|
|
143
|
+
question="What is Artificial General Intelligence?"
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
print(results)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 📄 Documentation
|
|
150
|
+
|
|
151
|
+
You can find the full NOSIBLE Search Client documentation
|
|
152
|
+
[here](https://nosible-py.readthedocs.io/).
|
|
153
|
+
|
|
154
|
+
### 📡 Swagger Docs
|
|
155
|
+
|
|
156
|
+
You can find online endpoints to the NOSIBLE Search API Swagger Docs
|
|
157
|
+
[here](https://www.nosible.ai/search/v1/docs/swagger#/).
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
© 2025 Nosible Inc. | [Privacy Policy](https://www.nosible.ai/privacy) | [Terms](https://www.nosible.ai/terms)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
[nosible-badge]: https://img.shields.io/static/v1?label=Visit&message=nosible.ai&\style=flat&logoUri=https://raw.githubusercontent.com/NosibleAI/nosible-py/main/docs/_static/favicon.png&logoWidth=20
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
nosible/__init__.py,sha256=11QmG9Wjprp_zB0VnPxGjqKwHmaoB0hoT8AGO6cGVMM,1426
|
|
2
2
|
nosible/nosible_client.py,sha256=eKaX56mhY8n8lEtYRgMDChy8WSAxp7LcHq3t9HYjRBU,94613
|
|
3
3
|
nosible/classes/result.py,sha256=htOK8NcCImguiQNIFe9kr3PYCtq46RSuB82-BzAgMbY,22762
|
|
4
|
-
nosible/classes/result_set.py,sha256=
|
|
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
|
|
7
7
|
nosible/classes/snippet.py,sha256=m2qxgnMxIxx4ZOIMqUAViGLf7C1Y4NCGaioyEKw2-Zg,4994
|
|
@@ -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=QWuxHf3H7xWEYg4se2_Y2DjluvKWznKMTj6oaEpCPL4,6008
|
|
12
|
-
nosible-0.2.
|
|
13
|
-
nosible-0.2.
|
|
14
|
-
nosible-0.2.
|
|
15
|
-
nosible-0.2.
|
|
16
|
-
nosible-0.2.
|
|
12
|
+
nosible-0.2.10.dist-info/licenses/LICENSE,sha256=8ifsV4DrsiKi8KVBFy8SBb3KXPXhofE3pYq07q1TSCQ,1117
|
|
13
|
+
nosible-0.2.10.dist-info/METADATA,sha256=gHbMikvZWW1B1GiDDlNmrxh3oGFSNjcZeUP3I5EyeQw,5512
|
|
14
|
+
nosible-0.2.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
+
nosible-0.2.10.dist-info/top_level.txt,sha256=mOconHuKcNJ1jTAj3DapQP_xB8YOmjTMyHg5txKH3uA,8
|
|
16
|
+
nosible-0.2.10.dist-info/RECORD,,
|
nosible-0.2.8.dist-info/METADATA
DELETED
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: nosible
|
|
3
|
-
Version: 0.2.8
|
|
4
|
-
Summary: Python client for the NOSIBLE Search API
|
|
5
|
-
Home-page: https://github.com/NosibleAI/nosible
|
|
6
|
-
Author: Stuart Reid, Matthew Dicks, Richard Taylor, Gareth Warburton
|
|
7
|
-
Author-email: Stuart Reid <stuart@nosible.com>, Matthew Dicks <matthew@nosible.com>, Richard Taylor <richard@nosible.com>, Gareth Warburton <gareth@nosible.com>
|
|
8
|
-
License-Expression: MIT
|
|
9
|
-
Project-URL: Homepage, https://github.com/NosibleAI/nosible
|
|
10
|
-
Project-URL: Documentation, https://nosible-py.readthedocs.io/en/latest/
|
|
11
|
-
Classifier: Development Status :: 4 - Beta
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
-
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
17
|
-
Classifier: Intended Audience :: Information Technology
|
|
18
|
-
Classifier: Intended Audience :: Science/Research
|
|
19
|
-
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
-
Classifier: Operating System :: OS Independent
|
|
27
|
-
Requires-Python: >=3.9
|
|
28
|
-
Description-Content-Type: text/markdown
|
|
29
|
-
License-File: LICENSE
|
|
30
|
-
Requires-Dist: polars
|
|
31
|
-
Requires-Dist: duckdb
|
|
32
|
-
Requires-Dist: openai
|
|
33
|
-
Requires-Dist: tantivy
|
|
34
|
-
Requires-Dist: pyrate-limiter
|
|
35
|
-
Requires-Dist: tenacity
|
|
36
|
-
Requires-Dist: cryptography
|
|
37
|
-
Requires-Dist: pyarrow
|
|
38
|
-
Requires-Dist: pandas
|
|
39
|
-
Dynamic: author
|
|
40
|
-
Dynamic: home-page
|
|
41
|
-
Dynamic: license-file
|
|
42
|
-
Dynamic: requires-python
|
|
43
|
-
|
|
44
|
-
[](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
|
|
45
|
-
[](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
|
|
46
|
-
[](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
|
|
47
|
-
[](https://nosible-py.readthedocs.io/en/latest/)
|
|
48
|
-
[](https://pypi.org/project/nosible/)
|
|
49
|
-
[](https://codecov.io/gh/NosibleAI/nosible-py)
|
|
50
|
-
[](https://pypi.org)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
[//]: # ([](https://www.nosible.ai/))
|
|
54
|
-
|
|
55
|
-

|
|
56
|
-
|
|
57
|
-
# NOSIBLE Search Client
|
|
58
|
-
|
|
59
|
-
A high-level Python client for the [NOSIBLE Search API](https://www.nosible.ai/search/v1/docs/swagger#/).
|
|
60
|
-
Easily integrate the Nosible Search API into your Python projects.
|
|
61
|
-
|
|
62
|
-
### 📄 Documentation
|
|
63
|
-
|
|
64
|
-
You can find the full NOSIBLE Search Client documentation
|
|
65
|
-
[here](https://nosible-py.readthedocs.io/).
|
|
66
|
-
|
|
67
|
-
### 📦 Installation
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
pip install nosible
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### ⚡ Installing with uv
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
uv pip install nosible
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**Requirements**:
|
|
80
|
-
|
|
81
|
-
* Python 3.9+
|
|
82
|
-
* polars
|
|
83
|
-
* duckdb
|
|
84
|
-
* openai
|
|
85
|
-
* tantivy
|
|
86
|
-
* pyrate-limiter
|
|
87
|
-
* tenacity
|
|
88
|
-
* cryptography
|
|
89
|
-
* pyarrow
|
|
90
|
-
* pandas
|
|
91
|
-
|
|
92
|
-
### 🔑 Authentication
|
|
93
|
-
|
|
94
|
-
1. Sign in to [NOSIBLE.AI](https://www.nosible.ai/) and grab your free API key.
|
|
95
|
-
2. Set it as an environment variable or pass directly:
|
|
96
|
-
|
|
97
|
-
On Windows
|
|
98
|
-
|
|
99
|
-
```powershell
|
|
100
|
-
$Env:NOSIBLE_API_KEY="basic|abcd1234..."
|
|
101
|
-
$Env:LLM_API_KEY="sk-..." # for query expansions (optional)
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
On Linux
|
|
105
|
-
```bash
|
|
106
|
-
export NOSIBLE_API_KEY="basic|abcd1234..."
|
|
107
|
-
export LLM_API_KEY="sk-..." # for query expansions (optional)
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Or in code:
|
|
111
|
-
|
|
112
|
-
- As an argument:
|
|
113
|
-
|
|
114
|
-
```python
|
|
115
|
-
from nosible import Nosible
|
|
116
|
-
|
|
117
|
-
client = Nosible(
|
|
118
|
-
nosible_api_key="basic|abcd1234...",
|
|
119
|
-
llm_api_key="sk-...",
|
|
120
|
-
)
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
- As an environment variable:
|
|
124
|
-
|
|
125
|
-
```python
|
|
126
|
-
from nosible import Nosible
|
|
127
|
-
import os
|
|
128
|
-
|
|
129
|
-
os.environ["NOSIBLE_API_KEY"] = "basic|abcd1234..."
|
|
130
|
-
os.environ["LLM_API_KEY"] = "sk-..."
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### 🎯 Core Workflows
|
|
134
|
-
|
|
135
|
-
| I need | Method | Use case |
|
|
136
|
-
|---------------------------------|-----------------|-------------------------|
|
|
137
|
-
| Single query, up to 100 results | `fast-search` | Interactive lookups |
|
|
138
|
-
| Multiple queries in parallel | `fast-searches` | Dashboards, comparisons |
|
|
139
|
-
| Thousands of results (100–10k) | `bulk_search` | Analytics, offline jobs |
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
### 🚀 Examples
|
|
143
|
-
|
|
144
|
-
#### Search
|
|
145
|
-
|
|
146
|
-
The Search and Searches functions enables you to retrieve **up to 100** results for a single query. This is ideal for most use cases where you need to retrieve information quickly and efficiently.
|
|
147
|
-
|
|
148
|
-
- Use the `search` method when you need between **10 and 100** results for a single query.
|
|
149
|
-
- The same applies for the `searches` and `.similar()` methods.
|
|
150
|
-
|
|
151
|
-
- A search will return a set of `Result` objects.
|
|
152
|
-
- The `Result` object is used to represent a single search result and provides methods to access the result's properties.
|
|
153
|
-
- `url`: The URL of the search result.
|
|
154
|
-
- `title`: The title of the search result.
|
|
155
|
-
- `description`: A brief description or summary of the search result.
|
|
156
|
-
- `netloc`: The network location (domain) of the URL.
|
|
157
|
-
- `published`: The publication date of the search result.
|
|
158
|
-
- `visited`: The date and time when the result was visited.
|
|
159
|
-
- `author`: The author of the content.
|
|
160
|
-
- `content`: The main content or body of the search result.
|
|
161
|
-
- `language`: The language code of the content (e.g., 'en' for English).
|
|
162
|
-
- `similarity`: Similarity score with respect to a query or reference.
|
|
163
|
-
|
|
164
|
-
They can be accessed directly from the `Result` object: `print(result.title)` or
|
|
165
|
-
`print(result["title"])`
|
|
166
|
-
|
|
167
|
-
```python
|
|
168
|
-
from nosible import Nosible
|
|
169
|
-
|
|
170
|
-
with Nosible(
|
|
171
|
-
nosible_api_key="basic|abcd1234...",
|
|
172
|
-
llm_api_key="sk-...",
|
|
173
|
-
openai_base_url="https://api.openrouter.ai/v1"
|
|
174
|
-
) as client:
|
|
175
|
-
results = client.fast_search(
|
|
176
|
-
question="What are the terms of the partnership between Microsoft and OpenAI?",
|
|
177
|
-
n_results=20,
|
|
178
|
-
language="en",
|
|
179
|
-
publish_start="2020-06-01",
|
|
180
|
-
publish_end="2025-06-30",
|
|
181
|
-
visited_start="2023-06-01",
|
|
182
|
-
visited_end="2025-06-29",
|
|
183
|
-
include_netlocs=["nytimes.com", "techcrunch.com"],
|
|
184
|
-
exclude_netlocs=["example.com"],
|
|
185
|
-
include_companies=["/m/04sv4"], # Microsoft's GKID
|
|
186
|
-
exclude_companies=["/m/045c7b"] # Google GKID
|
|
187
|
-
)
|
|
188
|
-
print([r.title for r in results])
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
#### Expansions
|
|
192
|
-
|
|
193
|
-
**Prompt expansions** are questions **lexically** and **semantically similar** to your main question. Expansions are added alongside your search query to improve your search results. You can add up to 10 expansions per search.
|
|
194
|
-
|
|
195
|
-
- You can add you **own expansions** by passing a list of strings to the `expansions` parameter.
|
|
196
|
-
- You can also get your expansions automatically generated by setting `autogenerate_expansions` to `True` when running the search.
|
|
197
|
-
- For expansions to be generated, you will need the `LLM_API_KEY` to be set in the environment or passed to the `Nosible` constructor.
|
|
198
|
-
- By default, we use openrouter as an endpoint. However, **we support any endpoint that supports openai**. If you
|
|
199
|
-
want to use a different endpoint, follow [this](https://nosible-py.readthedocs.io/en/latest/configuration.html#change-llm-base-url) guide in the docs.
|
|
200
|
-
- You can change this model with the argument **expansions_model**.
|
|
201
|
-
|
|
202
|
-
```python
|
|
203
|
-
# Example of using your own expansions
|
|
204
|
-
with Nosible() as nos:
|
|
205
|
-
results = nos.fast_search(
|
|
206
|
-
question="How have the Trump tariffs impacted the US economy?",
|
|
207
|
-
expansions=[
|
|
208
|
-
"What are the consequences of Trump's 2018 steel and aluminum tariffs on American manufacturers?",
|
|
209
|
-
"How did Donald Trump's tariffs on Chinese imports influence US import prices and inflation?",
|
|
210
|
-
"What impact did the Section 232 tariffs under President Trump have on US agricultural exports?",
|
|
211
|
-
"In what ways have Trump's trade duties affected employment levels in the US automotive sector?",
|
|
212
|
-
"How have the tariffs imposed by the Trump administration altered American consumer goods pricing nationwide?",
|
|
213
|
-
"What economic outcomes resulted from President Trump's protective tariffs for the United States economy?",
|
|
214
|
-
"How did Trump's solar panel tariffs change investment trends in the US energy market?",
|
|
215
|
-
"What have been the financial effects of Trump's Section 301 tariffs on Chinese electronics imports?",
|
|
216
|
-
"How did Trump's trade barriers influence GDP growth and trade deficits in the United States?",
|
|
217
|
-
"In what manner did Donald Trump's import taxes reshape competitiveness of US steel producers globally?",
|
|
218
|
-
],
|
|
219
|
-
n_results=10,
|
|
220
|
-
)
|
|
221
|
-
|
|
222
|
-
print(results)
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
#### Parallel Searches
|
|
226
|
-
|
|
227
|
-
Allows you to run multiple searches concurrently and `yields` the results as they come in.
|
|
228
|
-
- You can pass a list of questions to the `searches` method.
|
|
229
|
-
|
|
230
|
-
```python
|
|
231
|
-
from nosible import Nosible
|
|
232
|
-
|
|
233
|
-
with Nosible(nosible_api_key="basic|abcd1234...", llm_api_key="sk-...") as client:
|
|
234
|
-
for batch in client.fast_searches(
|
|
235
|
-
questions=[
|
|
236
|
-
"What are the terms of the partnership between Microsoft and OpenAI?",
|
|
237
|
-
"What exclusivity or non-compete clauses are included in their partnership?"
|
|
238
|
-
],
|
|
239
|
-
n_results=10,
|
|
240
|
-
publish_start="2025-06-01"
|
|
241
|
-
):
|
|
242
|
-
print(batch[0].title)
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
#### Bulk Search
|
|
246
|
-
|
|
247
|
-
Bulk search enables you to retrieve a large number of results in a single request, making it ideal for large-scale data analysis and processing.
|
|
248
|
-
|
|
249
|
-
- Use the `bulk_search` method when you need more than 1,000 results for a single query.
|
|
250
|
-
- You can request between **1,000 and 10,000** results per query.
|
|
251
|
-
- All parameters available in the standard `search` method—such as `expansions`, `include_companies`, and more—are also supported in `bulk_search`.
|
|
252
|
-
- A bulk search for 10,000 results typically completes in about 30 seconds or less.
|
|
253
|
-
|
|
254
|
-
```python
|
|
255
|
-
from nosible import Nosible
|
|
256
|
-
|
|
257
|
-
with Nosible(nosible_api_key="basic|abcd1234...") as client:
|
|
258
|
-
bulk = client.bulk_search(
|
|
259
|
-
question="What chip-development responsibilities has Intel committed to under its deal with Apple?",
|
|
260
|
-
n_results=2000
|
|
261
|
-
)
|
|
262
|
-
print(len(bulk))
|
|
263
|
-
print(bulk)
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
#### Combine Results
|
|
267
|
-
|
|
268
|
-
Add two ResultSets together:
|
|
269
|
-
|
|
270
|
-
```python
|
|
271
|
-
from nosible import Nosible
|
|
272
|
-
|
|
273
|
-
with Nosible(nosible_api_key="basic|abcd1234...") as client:
|
|
274
|
-
r1 = client.fast_search(
|
|
275
|
-
question="What are the terms of the partnership between Microsoft and OpenAI?",
|
|
276
|
-
n_results=5
|
|
277
|
-
)
|
|
278
|
-
r2 = client.fast_search(
|
|
279
|
-
question="How is research governance and decision-making structured between Google and DeepMind?",
|
|
280
|
-
n_results=5
|
|
281
|
-
)
|
|
282
|
-
combined = r1 + r2
|
|
283
|
-
print(combined)
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
#### Search Object
|
|
287
|
-
|
|
288
|
-
Use the `Search` class to encapsulate parameters:
|
|
289
|
-
|
|
290
|
-
```python
|
|
291
|
-
from nosible import Nosible, Search
|
|
292
|
-
|
|
293
|
-
with Nosible(nosible_api_key="basic|abcd1234...") as client:
|
|
294
|
-
search = Search(
|
|
295
|
-
question="What are the terms of the partnership between Microsoft and OpenAI?",
|
|
296
|
-
n_results=3,
|
|
297
|
-
publish_start="2020-01-15",
|
|
298
|
-
publish_end="2025-07-20",
|
|
299
|
-
include_netlocs=["arxiv.org", "bbc.com"],
|
|
300
|
-
certain=True
|
|
301
|
-
)
|
|
302
|
-
results = client.fast_search(search=search)
|
|
303
|
-
print([r for r in results])
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
#### Sentiment
|
|
307
|
-
|
|
308
|
-
This fetches a sentiment score for each search result.
|
|
309
|
-
- The sentiment score is a float between `-1` and `1`, where `-1` is **negative**, `0` is **neutral**, and `1` is **positive**.
|
|
310
|
-
- The sentiment model can be changed by passing the `sentiment_model` parameter to the `Nosible` constructor.
|
|
311
|
-
- The `sentiment_model` defaults to "openai/gpt-4o", which is a powerful model for sentiment analysis.
|
|
312
|
-
- You can also change the base URL for the LLM API by passing the `openai_base_url` parameter to the `Nosible` constructor.
|
|
313
|
-
- The `openai_base_url` defaults to OpenRouter's API endpoint.
|
|
314
|
-
|
|
315
|
-
```python
|
|
316
|
-
from nosible import Nosible
|
|
317
|
-
|
|
318
|
-
with Nosible(nosible_api_key="basic|abcd1234...", llm_api_key="sk-...") as client:
|
|
319
|
-
results = client.fast_search(
|
|
320
|
-
question="What are the terms of the partnership between Microsoft and OpenAI?",
|
|
321
|
-
n_results=1
|
|
322
|
-
)
|
|
323
|
-
score = results[0].sentiment(client)
|
|
324
|
-
print(f"Sentiment score: {score:.2f}")
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
#### Save & Load Formats
|
|
328
|
-
|
|
329
|
-
Supported formats for saving and loading:
|
|
330
|
-
|
|
331
|
-
```python
|
|
332
|
-
from nosible import Nosible, ResultSet
|
|
333
|
-
|
|
334
|
-
with Nosible(nosible_api_key="basic|abcd1234...") as client:
|
|
335
|
-
combined = client.fast_search(
|
|
336
|
-
question="What are the terms of the partnership between Microsoft and OpenAI?",
|
|
337
|
-
n_results=5
|
|
338
|
-
) + client.fast_search(
|
|
339
|
-
question="How is research governance and decision-making structured between Google and DeepMind?",
|
|
340
|
-
n_results=5
|
|
341
|
-
)
|
|
342
|
-
|
|
343
|
-
# Save
|
|
344
|
-
combined.write_csv("all_news.csv")
|
|
345
|
-
combined.write_json("all_news.json")
|
|
346
|
-
combined.write_parquet("all_news.parquet")
|
|
347
|
-
combined.write_ipc("all_news.arrow")
|
|
348
|
-
combined.write_duckdb("all_news.duckdb", table_name="news")
|
|
349
|
-
combined.write_ndjson("all_news.ndjson")
|
|
350
|
-
|
|
351
|
-
# Load
|
|
352
|
-
rs_csv = ResultSet.read_csv("all_news.csv")
|
|
353
|
-
rs_json = ResultSet.read_json("all_news.json")
|
|
354
|
-
rs_parq = ResultSet.read_parquet("all_news.parquet")
|
|
355
|
-
rs_arrow = ResultSet.read_ipc("all_news.arrow")
|
|
356
|
-
rs_duckdb = ResultSet.read_duckdb("all_news.duckdb")
|
|
357
|
-
rs_ndjson = ResultSet.read_ndjson("all_news.ndjson")
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
#### More Examples
|
|
361
|
-
|
|
362
|
-
For more examples, checkout `/examples` for in-depth usage of the NOSIBLE Client Package
|
|
363
|
-
|
|
364
|
-
### 📡 Swagger Docs
|
|
365
|
-
|
|
366
|
-
You can find online endpoints to the NOSIBLE Search API Swagger Docs
|
|
367
|
-
[here](https://www.nosible.ai/search/v1/docs/swagger#/).
|
|
368
|
-
|
|
369
|
-
### ⚙️ Rate Limiting
|
|
370
|
-
|
|
371
|
-
Inspect your current limits at runtime:
|
|
372
|
-
|
|
373
|
-
```python
|
|
374
|
-
client.get_ratelimits()
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
Or you can view them on the [docs](https://nosible-py.readthedocs.io/en/latest/rate_limits.html).
|
|
378
|
-
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
© 2025 Nosible Inc. | [Privacy Policy](https://www.nosible.ai/privacy) | [Terms](https://www.nosible.ai/terms)
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
[nosible-badge]: https://img.shields.io/static/v1?label=Visit&message=nosible.ai&\style=flat&logoUri=https://raw.githubusercontent.com/NosibleAI/nosible-py/main/docs/_static/favicon.png&logoWidth=20
|
|
File without changes
|
|
File without changes
|
|
File without changes
|