Skip to content

Commit 9a1e9d8

Browse files
authored
docs(quickstart): update quickstart (#88)
1 parent 139ab9b commit 9a1e9d8

12 files changed

+36
-34
lines changed

docs/concepts/similarity_indexes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ A similarity index consists of two main components:
1111

1212
The concept of "similarity" is deliberately broad, as it varies depending on the store's implementation to best fit the use case. Db-ally not only supports custom store implementations but also includes various built-in implementations, from simple case-insensitive text matches to more complex embedding-based semantic similarities.
1313

14-
See the [Quickstart Part 2: Semantic Similarity](../quickstart/quickstart2.md) for an example of using a similarity index with a semantic similarity store.
14+
See the [Quickstart Part 2: Semantic Similarity](../quickstart/semantic-similarity.md) for an example of using a similarity index with a semantic similarity store.

docs/how-to/update_similarity_indexes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The Similarity Index is a feature provided by db-ally that takes user input and maps it to the closest matching value in the data source using a chosen similarity metric. This feature is handy when the user input does not exactly match the data source, such as when the user asks to "list all employees in the IT department," while the database categorizes this group as the "computer department." To learn more about Similarity Indexes, refer to the [Concept: Similarity Indexes](../concepts/similarity_indexes.md) page.
44

5-
While Similarity Indexes can be used directly, they are usually used with [Views](../concepts/views.md), annotating arguments to filter methods. This technique lets db-ally automatically match user-provided arguments to the most similar value in the data source. You can see an example of using similarity indexes with views on the [Quickstart Part 2: Semantic Similarity](../quickstart/quickstart2.md) page.
5+
While Similarity Indexes can be used directly, they are usually used with [Views](../concepts/views.md), annotating arguments to filter methods. This technique lets db-ally automatically match user-provided arguments to the most similar value in the data source. You can see an example of using similarity indexes with views on the [Quickstart Part 2: Semantic Similarity](../quickstart/semantic-similarity.md) page.
66

77
Similarity Indexes are designed to index all possible values (e.g., on disk or in a different data store). Consequently, when the data source undergoes changes, the Similarity Index must update to reflect these alterations. This guide will explain how to update Similarity Indexes in your code.
88

docs/how-to/use_custom_similarity_fetcher.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ In this example, we used the FaissStore, which utilizes the `faiss` library for
5555

5656
## Using the Similarity Index
5757

58-
You can use the index with a custom fetcher [the same way](../quickstart/quickstart2.md) as you would with a built-in fetcher. The similarity index will map user input to the closest matching value from your data source, allowing you to deliver more precise responses to user queries. Remember to frequently update the similarity index with new values from your data source to maintain its relevance. You can accomplish this by calling the `update` method on the similarity index.
58+
You can use the index with a custom fetcher [the same way](../quickstart/semantic-similarity.md) as you would with a built-in fetcher. The similarity index will map user input to the closest matching value from your data source, allowing you to deliver more precise responses to user queries. Remember to frequently update the similarity index with new values from your data source to maintain its relevance. You can accomplish this by calling the `update` method on the similarity index.
5959

6060
```python
6161
await breeds_similarity.update()
@@ -72,4 +72,4 @@ print(await breeds_similarity.similar("bagle"))
7272

7373
This will return the most similar dog breed to "bagle" based on the data retrieved from the dog.ceo API - in this case, "beagle".
7474

75-
In general, instead of directly calling the similarity index, you would usually use it to annotate arguments to views, as demonstrated in the [Quickstart guide](../quickstart/quickstart2.md).
75+
In general, instead of directly calling the similarity index, you would usually use it to annotate arguments to views, as demonstrated in the [Quickstart guide](../quickstart/semantic-similarity.md).

docs/how-to/use_custom_similarity_store.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ country_similarity = SimilarityIndex(
5656
)
5757
```
5858

59-
In this example, we used the sample `DogBreedsFetcher` fetcher detailed in the [custom fetcher guide](./use_custom_similarity_fetcher.md) and the `PickleStore` to store the values in a Python pickle file. You can use a different fetcher depending on your needs, for example [the Sqlalchemy one described in the Quickstart guide](../quickstart/quickstart2.md)).
59+
In this example, we used the sample `DogBreedsFetcher` fetcher detailed in the [custom fetcher guide](./use_custom_similarity_fetcher.md) and the `PickleStore` to store the values in a Python pickle file. You can use a different fetcher depending on your needs, for example [the Sqlalchemy one described in the Quickstart guide](../quickstart/semantic-similarity.md)).
6060

6161
## Using the Similarity Index
6262

63-
You can use an index with a custom store [the same way](../quickstart/quickstart2.md) you would use one with a built-in store. The similarity index will map user input to the closest matching value from your data source, enabling you to deliver more accurate responses. It's important to regularly update the similarity index with new values from your data source to keep it current. Do this by invoking the `update` method on the similarity index.
63+
You can use an index with a custom store [the same way](../quickstart/semantic-similarity.md) you would use one with a built-in store. The similarity index will map user input to the closest matching value from your data source, enabling you to deliver more accurate responses. It's important to regularly update the similarity index with new values from your data source to keep it current. Do this by invoking the `update` method on the similarity index.
6464

6565
```python
6666
await country_similarity.update()
@@ -77,4 +77,4 @@ print(await country_similarity.similar("bagle"))
7777

7878
This will return the closest matching dog breed to "bagle" - in this case, "beagle".
7979

80-
Typically, instead of directly invoking the similarity index, you would employ it to annotate arguments to views, as demonstrated in the [Quickstart guide](../quickstart/quickstart2.md).
80+
Typically, instead of directly invoking the similarity index, you would employ it to annotate arguments to views, as demonstrated in the [Quickstart guide](../quickstart/semantic-similarity.md).

docs/quickstart/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class CandidateView(SqlAlchemyBaseView):
9797
By setting up these filters, you enable the LLM to fetch candidates while optionally applying filters based on experience, country, and eligibility for a senior data scientist position.
9898

9999
!!! note
100-
The `from_country` filter defined above supports only exact matches, which is not always ideal. Thankfully, db-ally comes with a solution for this problem - Similarity Indexes, which can be used to find the most similar value from the ones available. Refer to [Quickstart Part 2: Semantic Similarity](./quickstart2.md) for an example of using semantic similarity when filtering candidates by country.
100+
The `from_country` filter defined above supports only exact matches, which is not always ideal. Thankfully, db-ally comes with a solution for this problem - Similarity Indexes, which can be used to find the most similar value from the ones available. Refer to [Quickstart Part 2: Semantic Similarity](./semantic-similarity.md) for an example of using semantic similarity when filtering candidates by country.
101101

102102
## OpenAI Access Configuration
103103

@@ -170,8 +170,8 @@ Retrieved 1 candidates:
170170

171171
## Full Example
172172

173-
Access the full example here: [quickstart_code.py](quickstart_code.py)
173+
Access the full example on [GitHub](https://github.com/deepsense-ai/db-ally/blob/main/examples/intro.py){:target="_blank"}.
174174

175175
## Next Steps
176176

177-
Explore [Quickstart Part 2: Semantic Similarity](./quickstart2.md) to expand on the example and learn about using semantic similarity.
177+
Explore [Quickstart Part 2: Semantic Similarity](./semantic-similarity.md) to expand on the example and learn about using semantic similarity.

docs/quickstart/quickstart3.md docs/quickstart/multiple-views.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Quickstart: Multiple Views
22

3-
This guide continues from [Semantic Similarity](./quickstart2.md) guide. It assumes that you have already set up the views and the collection. If not, please refer to the complete Part 2 code here: [quickstart2_code.py](quickstart2_code.py).
3+
This guide continues from [Semantic Similarity](./semantic-similarity.md) guide. It assumes that you have already set up the views and the collection. If not, please refer to the complete Part 2 code on [GitHub](https://github.com/deepsense-ai/db-ally/blob/main/examples/semantic_similarity.py){:target="_blank"}.
44

55
The guide illustrates how to use multiple views to handle queries requiring different types of data. `CandidateView` and `JobView` are used as examples.
66

@@ -124,7 +124,7 @@ Julia Nowak - Adobe XD;Sketch;Figma
124124
Anna Kowalska - AWS;Azure;Google Cloud
125125
```
126126

127-
That wraps it up! You can find the full example code here: [quickstart3_code.py](quickstart3_code.py).
127+
That wraps it up! You can find the full example code on [GitHub](https://github.com/deepsense-ai/db-ally/blob/main/examples/multiple-views.py){:target="_blank"}.
128128

129129
## Next Steps
130130
Visit the [Tutorial](../tutorials.md) for a more comprehensive guide on how to use db-ally.

docs/quickstart/quickstart2.md docs/quickstart/semantic-similarity.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Quickstart: Semantic Similarity
22

3-
This guide is a continuation of the [Intro](./index.md) guide. It assumes that you have already set up the views and the collection. If not, please refer to the complete Part 1 code here: [quickstart_code.py](quickstart_code.py).
3+
This guide is a continuation of the [Intro](./index.md) guide. It assumes that you have already set up the views and the collection. If not, please refer to the complete Part 1 code on [GitHub](https://github.com/deepsense-ai/db-ally/blob/main/examples/intro.py){:target="_blank"}.
44

55
This guide will demonstrate how to use semantic similarity to handle queries in which the filter values are similar to those in the database, without requiring an exact match. We will use filtering by country as an example.
66

@@ -146,8 +146,8 @@ Retrieved 1 candidates:
146146

147147
That's it! You can apply similar techniques to any other filter that takes a string value.
148148

149-
To see the full example, you can find the code here: [quickstart2_code.py](quickstart2_code.py).
149+
To see the full example, you can find the code on [GitHub](https://github.com/deepsense-ai/db-ally/blob/main/examples/semantic_similarity.py){:target="_blank"}.
150150

151151
## Next Steps
152152

153-
Explore [Quickstart Part 3: Multiple Views](./quickstart3.md) to learn how to run queries with multiple views and display the results based on the view that was used to fetch the data.
153+
Explore [Quickstart Part 3: Multiple Views](./multiple-views.md) to learn how to run queries with multiple views and display the results based on the view that was used to fetch the data.

docs/reference/similarity/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ Explore [Similarity Stores](./similarity_store/index.md) and [Similarity Fetcher
1010
* [How-To: Use Similarity Indexes with Data from Custom Sources](../../how-to/use_custom_similarity_fetcher.md)
1111
* [How-To: Store Similarity Index in a Custom Store](../../how-to/use_custom_similarity_store.md)
1212
* [How-To: Update Similarity Indexes](../../how-to/update_similarity_indexes.md)
13-
* [Quickstart: Semantic Similarity](../../quickstart/quickstart2.md)
13+
* [Quickstart: Semantic Similarity](../../quickstart/semantic-similarity.md)
1414

1515
::: dbally.similarity.SimilarityIndex

docs/quickstart/quickstart_code.py examples/intro.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# pylint: disable=missing-return-doc, missing-param-doc, missing-function-docstring
2-
import dbally
1+
# pylint: disable=missing-return-doc, missing-param-doc, missing-function-docstring, duplicate-code
2+
33
import asyncio
44

55
import sqlalchemy
66
from sqlalchemy import create_engine
77
from sqlalchemy.ext.automap import automap_base
88

9-
from dbally import decorators, SqlAlchemyBaseView
9+
import dbally
10+
from dbally import SqlAlchemyBaseView, decorators
1011
from dbally.audit.event_handlers.cli_event_handler import CLIEventHandler
1112
from dbally.llms.litellm import LiteLLM
1213

13-
1414
engine = create_engine("sqlite:///examples/recruiting/data/candidates.db")
1515

1616
Base = automap_base()

docs/quickstart/quickstart3_code.py examples/multiple_views.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
# pylint: disable=missing-return-doc, missing-param-doc, missing-function-docstring
2-
import os
1+
# pylint: disable=missing-return-doc, missing-param-doc, missing-function-docstring, duplicate-code
2+
33
import asyncio
4-
from typing_extensions import Annotated
4+
import os
55

6+
import pandas as pd
67
import sqlalchemy
78
from sqlalchemy import create_engine
89
from sqlalchemy.ext.automap import automap_base
9-
import pandas as pd
10+
from typing_extensions import Annotated
1011

1112
import dbally
12-
from dbally import decorators, SqlAlchemyBaseView, DataFrameBaseView, ExecutionResult
13+
from dbally import DataFrameBaseView, ExecutionResult, SqlAlchemyBaseView, decorators
1314
from dbally.audit import CLIEventHandler
14-
from dbally.similarity import SimpleSqlAlchemyFetcher, FaissStore, SimilarityIndex
1515
from dbally.embeddings.litellm import LiteLLMEmbeddingClient
1616
from dbally.llms.litellm import LiteLLM
17+
from dbally.similarity import FaissStore, SimilarityIndex, SimpleSqlAlchemyFetcher
1718

1819
engine = create_engine("sqlite:///examples/recruiting/data/candidates.db")
1920

docs/quickstart/quickstart2_code.py examples/semantic_similarity.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
# pylint: disable=missing-return-doc, missing-param-doc, missing-function-docstring
2-
import os
1+
# pylint: disable=missing-return-doc, missing-param-doc, missing-function-docstring, duplicate-code
2+
33
import asyncio
4-
from typing_extensions import Annotated
4+
import os
55

6-
from dotenv import load_dotenv
76
import sqlalchemy
7+
from dotenv import load_dotenv
88
from sqlalchemy import create_engine
99
from sqlalchemy.ext.automap import automap_base
10+
from typing_extensions import Annotated
1011

1112
import dbally
12-
from dbally import decorators, SqlAlchemyBaseView
13+
from dbally import SqlAlchemyBaseView, decorators
1314
from dbally.audit.event_handlers.cli_event_handler import CLIEventHandler
14-
from dbally.similarity import SimpleSqlAlchemyFetcher, FaissStore, SimilarityIndex
1515
from dbally.embeddings.litellm import LiteLLMEmbeddingClient
1616
from dbally.llms.litellm import LiteLLM
17+
from dbally.similarity import FaissStore, SimilarityIndex, SimpleSqlAlchemyFetcher
1718

1819
load_dotenv()
1920
engine = create_engine("sqlite:///examples/recruiting/data/candidates.db")

mkdocs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ nav:
88
- db-ally docs: index.md
99
- Quickstart:
1010
- quickstart/index.md
11-
- quickstart/quickstart2.md
12-
- quickstart/quickstart3.md
11+
- quickstart/semantic-similarity.md
12+
- quickstart/multiple-views.md
1313
- Concepts:
1414
- concepts/views.md
1515
- concepts/structured_views.md

0 commit comments

Comments
 (0)