nosible 0.2.7__py3-none-any.whl → 0.2.9__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.
@@ -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.
nosible/nosible_client.py CHANGED
@@ -1745,7 +1745,7 @@ class Nosible:
1745
1745
  cpm_counter = 4.0
1746
1746
 
1747
1747
  # Preserve the order you care about:
1748
- for plan in ["test", "basic", "pro", "pro+", "bus", "bus+", "ent"]:
1748
+ for plan in ["test", "basic", "pro", "pro+", "bus", "bus+", "ent", "cons", "stup", "busn"]:
1749
1749
  name = display.get(plan, plan)
1750
1750
  if plan == user_plan:
1751
1751
  current_plan = " (Your current plan)"
@@ -51,6 +51,22 @@ PLAN_RATE_LIMITS = {
51
51
  "slow": [(60, 60), (1_500_000, 24 * 3600 * 30)],
52
52
  "fast": [(360, 60), (15_000_000, 24 * 3600 * 30)],
53
53
  },
54
+ "cons": {
55
+ "visit": [(60, 60), (3000, 24 * 3600 * 30)],
56
+ "slow": [(60, 60), (3000, 24 * 3600 * 30)],
57
+ "fast": [(120, 60), (30_000, 24 * 3600 * 30)],
58
+ },
59
+ "stup": {
60
+ "visit": [(60, 60), (30_000, 24 * 3600 * 30)],
61
+ "slow": [(60, 60), (30_000, 24 * 3600 * 30)],
62
+ "fast": [(360, 60), (300_000, 24 * 3600 * 30)],
63
+ },
64
+ # This plan is used for testing in the package
65
+ "busn": {
66
+ "visit": [(60, 60), (300_000, 24 * 3600 * 30)],
67
+ "slow": [(60, 60), (300_000, 24 * 3600 * 30)],
68
+ "fast": [(360, 60), (3_000_000, 24 * 3600 * 30)],
69
+ },
54
70
  }
55
71
 
56
72
 
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: nosible
3
+ Version: 0.2.9
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
+ [![Linux Tests](https://img.shields.io/github/actions/workflow/status/NosibleAI/nosible-py/run_tests_and_publish.yml?branch=main&label=Linux%20Tests)](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
45
+ [![Windows Tests](https://img.shields.io/github/actions/workflow/status/NosibleAI/nosible-py/run_tests_and_publish.yml?branch=main&label=Windows%20Tests)](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
46
+ [![macOS Tests](https://img.shields.io/github/actions/workflow/status/NosibleAI/nosible-py/run_tests_and_publish.yml?branch=main&label=macOS%20Tests)](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
47
+ [![Read the Docs](https://img.shields.io/readthedocs/nosible-py/latest.svg?label=docs&logo=readthedocs)](https://nosible-py.readthedocs.io/en/latest/)
48
+ [![PyPI version](https://img.shields.io/pypi/v/nosible.svg?label=PyPI&logo=python)](https://pypi.org/project/nosible/)
49
+ [![codecov](https://codecov.io/gh/NosibleAI/nosible-py/graph/badge.svg?token=DDXGQ3V6P9)](https://codecov.io/gh/NosibleAI/nosible-py)
50
+ [![PyPI - Python Versions](https://img.shields.io/pypi/pyversions/nosible.svg)](https://pypi.org)
51
+
52
+
53
+ [//]: # ([![Visit Nosible]&#40;https://img.shields.io/static/v1?label=Visit&message=nosible.ai&style=flat&logoUri=https://www.nosible.ai/assests/favicon.png&logoWidth=20&#41;]&#40;https://www.nosible.ai/&#41;)
54
+
55
+ ![Logo](https://github.com/NosibleAI/nosible-py/blob/main/docs/_static/readme.png?raw=true)
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,16 +1,16 @@
1
1
  nosible/__init__.py,sha256=11QmG9Wjprp_zB0VnPxGjqKwHmaoB0hoT8AGO6cGVMM,1426
2
- nosible/nosible_client.py,sha256=72zWIUaKY818gMMo2C4O1GFFw4JyqsYn7RuOFdrzZl4,94589
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=uQ9oeD2nqYTE1dGetkhkfqmPmuvxmRyVILfeHxSkT1E,53138
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
8
8
  nosible/classes/snippet_set.py,sha256=0jPMDhJNCO02WhvY1QR1HedvADvBxRcN6x3FItEgSiI,5099
9
9
  nosible/classes/web_page.py,sha256=cvwQspxS0pU2nFgPLqnDtDWlLONHp1KwxerflHueLJ8,5838
10
10
  nosible/utils/json_tools.py,sha256=PcSMjcLEhbA626jAIn0SuD_1-4QDduapZUenTSt3N2E,4569
11
- nosible/utils/rate_limiter.py,sha256=qr0Tg-3wVcw95FyQv3gbZhbf-_QY9zKdkIE4FSLFSBo,5400
12
- nosible-0.2.7.dist-info/licenses/LICENSE,sha256=8ifsV4DrsiKi8KVBFy8SBb3KXPXhofE3pYq07q1TSCQ,1117
13
- nosible-0.2.7.dist-info/METADATA,sha256=D9wsIKd4jvha6MyNvL7MCL1zIBXwwVVW59rfEFxzJHI,14796
14
- nosible-0.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- nosible-0.2.7.dist-info/top_level.txt,sha256=mOconHuKcNJ1jTAj3DapQP_xB8YOmjTMyHg5txKH3uA,8
16
- nosible-0.2.7.dist-info/RECORD,,
11
+ nosible/utils/rate_limiter.py,sha256=QWuxHf3H7xWEYg4se2_Y2DjluvKWznKMTj6oaEpCPL4,6008
12
+ nosible-0.2.9.dist-info/licenses/LICENSE,sha256=8ifsV4DrsiKi8KVBFy8SBb3KXPXhofE3pYq07q1TSCQ,1117
13
+ nosible-0.2.9.dist-info/METADATA,sha256=OOdDAjmGuH6psHguXs28D6PZxfocwCIImrOZQE-DQwA,5511
14
+ nosible-0.2.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ nosible-0.2.9.dist-info/top_level.txt,sha256=mOconHuKcNJ1jTAj3DapQP_xB8YOmjTMyHg5txKH3uA,8
16
+ nosible-0.2.9.dist-info/RECORD,,
@@ -1,384 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: nosible
3
- Version: 0.2.7
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
- [![Linux Tests](https://img.shields.io/github/actions/workflow/status/NosibleAI/nosible-py/run_tests_and_publish.yml?branch=main&label=Linux%20Tests)](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
45
- [![Windows Tests](https://img.shields.io/github/actions/workflow/status/NosibleAI/nosible-py/run_tests_and_publish.yml?branch=main&label=Windows%20Tests)](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
46
- [![macOS Tests](https://img.shields.io/github/actions/workflow/status/NosibleAI/nosible-py/run_tests_and_publish.yml?branch=main&label=macOS%20Tests)](https://github.com/NosibleAI/nosible-py/actions/workflows/run_tests_and_publish.yml)
47
- [![Read the Docs](https://img.shields.io/readthedocs/nosible-py/latest.svg?label=docs&logo=readthedocs)](https://nosible-py.readthedocs.io/en/latest/)
48
- [![PyPI version](https://img.shields.io/pypi/v/nosible.svg?label=PyPI&logo=python)](https://pypi.org/project/nosible/)
49
- [![codecov](https://codecov.io/gh/NosibleAI/nosible-py/graph/badge.svg?token=DDXGQ3V6P9)](https://codecov.io/gh/NosibleAI/nosible-py)
50
- [![PyPI - Python Versions](https://img.shields.io/pypi/pyversions/nosible.svg)](https://pypi.org)
51
-
52
-
53
- [//]: # ([![Visit Nosible]&#40;https://img.shields.io/static/v1?label=Visit&message=nosible.ai&style=flat&logoUri=https://www.nosible.ai/assests/favicon.png&logoWidth=20&#41;]&#40;https://www.nosible.ai/&#41;)
54
-
55
- ![Logo](https://github.com/NosibleAI/nosible-py/blob/main/docs/_static/readme.png?raw=true)
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