Skip to content

Commit 36804bf

Browse files
authored
Merge pull request #4 from whyhow-ai/renaming
Updating package name to "whyhow_rbr"
2 parents fc5e289 + 63e3841 commit 36804bf

14 files changed

+95
-75
lines changed

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ export OPENAI_API_KEY=<your open ai api key>
4141
export PINECONE_API_KEY=<your pinecone api key>
4242
```
4343

44-
### Developer Install
44+
### Developer Install
45+
4546
For a developer installation, use an editable install and include the development dependencies:
4647

4748
```shell
4849
pip install -e .[dev]
4950
```
5051

5152
For ZSH:
53+
5254
```shell
5355
pip install -e ".[dev]"
5456
```
@@ -60,7 +62,6 @@ run
6062
pip install git+ssh://[email protected]/whyhow-ai/rule-based-retrieval
6163
```
6264

63-
6465
# Documentation
6566

6667
Documentation can be found [here](https://whyhow-ai.github.io/rule-based-retrieval/).
@@ -73,6 +74,7 @@ mkdocs serve
7374
```
7475

7576
For ZSH:
77+
7678
```shell
7779
pip install -e ".[docs]"
7880
mkdocs serve
@@ -85,12 +87,13 @@ Navigate to http://127.0.0.1:8000/ in your browser to view the documentation.
8587
Check out the `examples/` directory for sample scripts demonstrating how to use the Rule-based Retrieval package.
8688

8789
# How to
90+
8891
### [Demo](https://www.loom.com/share/089101b455b34701875b9f362ba16b89)
8992

9093
## Create index & upload
9194

9295
```shell
93-
from whyhow import Client
96+
from whyhow_rbr import Client
9497

9598
# Configure parameters
9699
index_name = "whyhow-demo"
@@ -110,7 +113,7 @@ client.upload_documents(index=index, documents=pdfs, namespace=namespace)
110113
## Query with rules
111114

112115
```shell
113-
from whyhow import Client, Rule
116+
from whyhow_rbr import Client, Rule
114117

115118
# Configure query parameters
116119
index_name = "whyhow-demo"
@@ -154,8 +157,8 @@ print(
154157
155158
## Query with keywords
156159
157-
```shell
158-
from whyhow import Client, Rule
160+
```shell
161+
from whyhow_rbr import Client, Rule
159162

160163
client = Client()
161164

@@ -185,7 +188,7 @@ print(result["used_contexts"])
185188
## Query each rule separately
186189
187190
```shell
188-
from whyhow import Client, Rule
191+
from whyhow_rbr import Client, Rule
189192

190193
client = Client()
191194

@@ -218,6 +221,7 @@ print(result["used_contexts"])
218221
```
219222
220223
# Contributing
224+
221225
We welcome contributions to improve the Rule-based Retrieval package! If you have any ideas, bug reports, or feature requests, please open an issue on the GitHub repository.
222226
223227
If you'd like to contribute code, please follow these steps:
@@ -229,7 +233,9 @@ If you'd like to contribute code, please follow these steps:
229233
5. Open a pull request to the main repository
230234
231235
### License
236+
232237
This project is licensed under the MIT License.
233238
234239
### Support
240+
235241
WhyHow.AI is building tools to help developers bring more determinism and control to their RAG pipelines using graph structures. If you're thinking about, in the process of, or have already incorporated knowledge graphs in RAG, we’d love to chat at [email protected], or follow our newsletter at [WhyHow.AI](https://www.whyhow.ai/). Join our discussions about rules, determinism and knowledge graphs in RAG on our newly-created [Discord](https://discord.com/invite/9bWqrsxgHr).

docs/api.md

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,43 @@
11
# Reference
22

33
## `whyhow.embedding` module
4-
### ::: whyhow.embedding.generate_embeddings
4+
5+
### ::: whyhow_rbr.embedding.generate_embeddings
56

67
## `whyhow.exceptions` module
7-
### ::: whyhow.exceptions.IndexAlreadyExistsException
8-
### ::: whyhow.exceptions.IndexNotFoundException
9-
### ::: whyhow.exceptions.OpenAIException
8+
9+
### ::: whyhow_rbr.exceptions.IndexAlreadyExistsException
10+
11+
### ::: whyhow_rbr.exceptions.IndexNotFoundException
12+
13+
### ::: whyhow_rbr.exceptions.OpenAIException
1014

1115
## `whyhow.processing` module
12-
### ::: whyhow.processing.parse_and_split
13-
### ::: whyhow.processing.clean_chunks
16+
17+
### ::: whyhow_rbr.processing.parse_and_split
18+
19+
### ::: whyhow_rbr.processing.clean_chunks
1420

1521
## `whyhow.rag` module
16-
### ::: whyhow.rag.Client
17-
### ::: whyhow.rag.Rule
18-
### ::: whyhow.rag.PineconeMetadata
19-
### ::: whyhow.rag.PineconeDocument
20-
### ::: whyhow.rag.PineconeMatch
21-
### ::: whyhow.rag.Input
22-
### ::: whyhow.rag.Output
23-
24-
#### ::: whyhow.rag.Client.query
22+
23+
### ::: whyhow_rbr.rag.Client
24+
25+
### ::: whyhow_rbr.rag.Rule
26+
27+
### ::: whyhow_rbr.rag.PineconeMetadata
28+
29+
### ::: whyhow_rbr.rag.PineconeDocument
30+
31+
### ::: whyhow_rbr.rag.PineconeMatch
32+
33+
### ::: whyhow_rbr.rag.Input
34+
35+
### ::: whyhow_rbr.rag.Output
36+
37+
#### ::: whyhow_rbr.rag.Client.query
38+
2539
:docstring:
2640
:members:
2741
:undoc-members:
2842
:show-inheritance:
29-
:special-members: __init__
43+
:special-members: __init__

docs/tutorial.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Tutorial
22

3-
The `whyhow` package helps create customized RAG pipelines. It is built on top
3+
The `whyhow_rbr` package helps create customized RAG pipelines. It is built on top
44
of the following technologies (and their respective Python SDKs)
55

66
- **OpenAI** - text generation
@@ -27,7 +27,7 @@ export PINECONE_API_KEY...
2727
and then instantiate the client without any arguments.
2828

2929
```python title="getting_started.py"
30-
from whyhow import Client
30+
from whyhow_rbr import Client
3131

3232
client = Client()
3333

@@ -41,7 +41,7 @@ An alternative approach is to manually pass the keys when the client is
4141
being constructed
4242

4343
```python title="getting_started.py"
44-
from whyhow import Client
44+
from whyhow_rbr import Client
4545

4646
client = Client(
4747
openai_api_key="...",
@@ -56,7 +56,7 @@ python getting_started.py
5656

5757
## Vector database operations
5858

59-
`whywow` uses Pinecone for everything related to vector databses.
59+
`whyhow_rbr` uses Pinecone for everything related to vector databses.
6060

6161
### Creating an index
6262

@@ -96,7 +96,7 @@ index = client.create_index(
9696
```python
9797
from pinecone import ServerlessSpec
9898

99-
from whyhow import Client
99+
from whyhow_rbr import Client
100100

101101
client = Client()
102102

@@ -140,7 +140,7 @@ index = client.create_index(
140140
```python
141141
from pinecone import PodSpec
142142

143-
from whyhow import Client
143+
from whyhow_rbr import Client
144144

145145
client = Client()
146146

@@ -177,7 +177,7 @@ index = client.get_index("amazing-index")
177177
```python
178178
from pinecone import PodSpec
179179

180-
from whyhow import Client
180+
from whyhow_rbr import Client
181181

182182
client = Client()
183183

@@ -235,7 +235,7 @@ Example output:
235235
## Uploading documents
236236

237237
After creating an index, we are ready to populate it with documents. In
238-
`whyhow` this is done using the `upload_documents` method of the `Client`.
238+
`whyhow_rbr` this is done using the `upload_documents` method of the `Client`.
239239
It performs the following steps under the hood:
240240

241241
- **Preprocessing**: Reading and splitting the provided PDF files into chunks
@@ -261,7 +261,7 @@ client.upload_documents(
261261
??? note "Full code"
262262

263263
```python
264-
from whyhow import Client
264+
from whyhow_rbr import Client
265265

266266
client = Client()
267267

@@ -302,7 +302,7 @@ client.upload_documents(
302302
)
303303
```
304304
Note that the above affects the root logger, however, you can also
305-
just customize the `whyhow` logger.
305+
just customize the `whyhow_rbr` logger.
306306

307307
Navigate to [upload_documents (API docs)](./api.md#whyhow.rag.Client.upload_documents)
308308
if you want to get more information on the parameters.
@@ -311,7 +311,7 @@ if you want to get more information on the parameters.
311311

312312
While Pinecone does not require each document in an index to have the same schema
313313
all the document uploaded via the `upload_documents` will have a fixed schema.
314-
This schema is defined in [PineconeDocument (API docs)](./api.md#whyhow.rag.PineconeDocument).
314+
This schema is defined in [PineconeDocument (API docs)](./api.md#whyhow_rbr.rag.PineconeDocument).
315315
This is done in order to have a predictable set of attributes that
316316
can be used to perform advanced filtering (via rules).
317317

@@ -320,13 +320,13 @@ can be used to perform advanced filtering (via rules).
320320
In previous sections we discussed how to to create an index and
321321
populate it with documents. Now we can finally move to retrieval augmented generation.
322322

323-
In `whyhow`, it can be done via the `query` method.
323+
In `whyhow_rbr`, it can be done via the `query` method.
324324

325325
1. Simple example:
326326

327327
```python
328328

329-
from whyhow import Client, Rule
329+
from whyhow_rbr import Client, Rule
330330

331331
client = Client()
332332

@@ -394,7 +394,7 @@ print(result["matches"])
394394

395395
Note that the number of matches will be in general equal to `top_k` which
396396
can be specified as a parameter. Also, each match has a fixed schema -
397-
it is a dump of [PineconeMatch (API docs)](./api.md#whyhow.rag.PineconeMatch).
397+
it is a dump of [PineconeMatch (API docs)](./api.md#whyhow_rbr.rag.PineconeMatch).
398398

399399
```python
400400
print(result["used_contexts"])
@@ -409,7 +409,7 @@ The OpenAI model only used the context from the 1st match when answering the que
409409
??? note "Full code"
410410

411411
```python
412-
from whyhow import Client
412+
from whyhow_rbr import Client
413413

414414
client = Client()
415415

@@ -431,14 +431,14 @@ The OpenAI model only used the context from the 1st match when answering the que
431431

432432
```
433433

434-
Navigate to [query(API docs)](./api.md#whyhow.rag.Client.query)
434+
Navigate to [query(API docs)](./api.md#whyhow_rbr.rag.Client.query)
435435
if you want to get more information on the parameters.
436436

437437
### Rules
438438

439439
In the previous example, every single document in our index was considered.
440440
However, sometimes it might be beneficial to only retrieve documents satisfying some
441-
predefined conditions (e.g. `filename=harry-potter.pdf`). In `whyhow` this
441+
predefined conditions (e.g. `filename=harry-potter.pdf`). In `whyhow_rbr` this
442442
can be done via the `Rule` class.
443443

444444
A rule can control the following metadata attributes
@@ -453,7 +453,7 @@ A rule can control the following metadata attributes
453453
```python
454454
# Code above omitted 👆
455455

456-
from whyhow import Rule
456+
from whyhow_rbr import Rule
457457

458458
question = "What is Harry Potter's favourite food?"
459459

@@ -477,7 +477,7 @@ In this example, the keyword_trigger parameter is set to True, and the rule incl
477477
??? note "Full code"
478478

479479
```python
480-
from whyhow import Client, Rule
480+
from whyhow_rbr import Client, Rule
481481

482482
client = Client()
483483

@@ -512,7 +512,7 @@ will be evaluated using the `OR` logical operator.
512512
```python
513513
# Code above omitted 👆
514514

515-
from whyhow import Rule
515+
from whyhow_rbr import Rule
516516

517517
question = "What is Harry Potter's favorite food?"
518518

@@ -545,7 +545,7 @@ Depending on the number of rules you use in your query, you may return more chun
545545
??? note "Full code"
546546

547547
```python
548-
from whyhow import Client, Rule
548+
from whyhow_rbr import Client, Rule
549549

550550
client = Client()
551551

@@ -577,5 +577,5 @@ Depending on the number of rules you use in your query, you may return more chun
577577
print(result["used_contexts"])
578578
```
579579

580-
Navigate to [Rule (API docs)](./api.md#whyhow.rag.Rule)
580+
Navigate to [Rule (API docs)](./api.md#whyhow_rbr.rag.Rule)
581581
if you want to get more information on the parameters.

examples/create_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pinecone import PodSpec
66

7-
from whyhow import Client, IndexNotFoundException
7+
from whyhow_rbr import Client, IndexNotFoundException
88

99
# Parameters
1010
index_name = "" # Replace with your index name

examples/querying.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import logging
44

5-
from whyhow import Client, Rule
5+
from whyhow_rbr import Client, Rule
66

77
# Parameters
88
index_name = "" # Replace with your index name
@@ -18,7 +18,7 @@
1818
)
1919
logger = logging.getLogger("querying")
2020
logger.setLevel(logging_level)
21-
logging.getLogger("whyhow").setLevel(logging_level)
21+
logging.getLogger("whyhow_rbr").setLevel(logging_level)
2222

2323

2424
# Define OPENAI_API_KEY and PINECONE_API_KEY as environment variables

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespaces = false
6464
"*" = ["*.txt", "*.rst", "*.typed"]
6565

6666
[tool.setuptools.dynamic]
67-
version = {attr = "whyhow.__version__"}
67+
version = {attr = "whyhow_rbr.__version__"}
6868

6969
[tool.pydocstyle]
7070
convention = "numpy"

0 commit comments

Comments
 (0)