Skip to content

Commit 94d1e5f

Browse files
committed
fix: update links
1 parent 64e379b commit 94d1e5f

1 file changed

Lines changed: 25 additions & 26 deletions

File tree

docs/articles/forget_text_to_sql.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Search technology has evolved significantly – and so have user expectations, e
55
In this article, we’ll show you how to build a modern search system for e-commerce products using natural language queries that leverage context, rather than traditional text-to-SQL approaches that struggle with meaning.
66

77
## The Shortcomings of Traditional Search
8+
89
Traditional keyword-based search with filters often fails to capture the meaning of complex queries that combine multiple attributes - like text descriptions, numerical data (eg. price), categorical information (eg. product type), and ratings. For example:
910

1011
- "comfortable running shoes for marathon training under $150"
@@ -15,23 +16,24 @@ Traditional keyword-based search with filters often fails to capture the meaning
1516
](../assets/use_cases/forget_text_to_sql/example_query_result.webp)
1617

1718
## A Better Approach: Multi-attribute Vector Search
19+
1820
We can build a system that’s more flexible and effective than converting natural language to SQL queries (text-to-SQL), using:
1921

2022
1. Vector embeddings for all product attributes (i.e., text, numbers, categories)
2123
2. Natural language query decomposition
2224
3. Multi-dimensional vector search
2325

24-
2526
### Key Components
27+
2628
1. Superlinked Framework: handles vector embeddings, indexing, and natural query processing
2729
2. MongoDB Atlas: provides vector database capabilities
2830
3. OpenAI: powers natural language understanding
2931
4. Streamlit: offers a user interface
3032

3133
![](../assets/use_cases/forget_text_to_sql/system_diagram.webp)
3234

33-
3435
## How to Implement - An Overview
36+
3537
1. **Process your Product Data**: clean and prepare Amazon product data (title, description, price, ratings, etc.)
3638
2. **Define your Schema**: define your product data structure using Superlinked's schema system, much like you would using Python data classes or Pydantic.
3739

@@ -53,10 +55,10 @@ product = ProductSchema()
5355
```
5456

5557
3. **Create your Vector Embeddings**: Superlinked's approach lets us combine various types of data into a single vector index:
56-
- categories
57-
- text
58-
- numbers (floats and integers)
59-
- temporal data (supported, but not used in our example here)
58+
- categories
59+
- text
60+
- numbers (floats and integers)
61+
- temporal data (supported, but not used in our example here)
6062

6163
```python
6264
# Create similarity spaces for different attributes
@@ -67,19 +69,19 @@ category_space = sl.CategoricalSimilaritySpace(
6769
negative_filter=-1,
6870
)
6971
description_space = sl.TextSimilaritySpace(
70-
text=product.description,
72+
text=product.description,
7173
model="Alibaba-NLP/gte-large-en-v1.5"
7274
)
7375
review_rating_maximizer_space = sl.NumberSpace(
74-
number=product.review_rating,
76+
number=product.review_rating,
7577
min_value=-1.0,
76-
max_value=5.0,
78+
max_value=5.0,
7779
mode=sl.Mode.MAXIMUM
7880
)
7981
price_minimizer_space = sl.NumberSpace(
80-
number=product.price,
81-
min_value=0.0,
82-
max_value=1000,
82+
number=product.price,
83+
min_value=0.0,
84+
max_value=1000,
8385
mode=sl.Mode.MINIMUM
8486
)
8587
```
@@ -110,20 +112,19 @@ semantic_query = (
110112
```
111113

112114
6. **Set up Search using API and Interface**:
113-
- Superlinked’s RESTful API exposes search functionality
114-
- Streamlit interface enables user interaction
115-
115+
- Superlinked’s RESTful API exposes search functionality
116+
- Streamlit interface enables user interaction
116117

117118
## Benefits of Multi-attribute Search
119+
118120
1. **Natural Interaction**: Users can express complex search intentions in plain language
119121
2. **Multi-attribute Understanding**: System comprehends relationships between different product attributes
120122
3. **Flexible Architecture**: Easy to extend by adding new attributes, and easy to modify search behavior
121123
4. **No unreliable SQL Complex queries**: text-to-SQL can’t reliably generate complex SQL queries
122124

125+
## For Example…
123126

124-
## For Example…
125-
Using a multi-attribute vector search system, the query
126-
127+
Using a multi-attribute vector search system, the query
127128

128129
```text
129130
"psychology books with a price lower than 100 and a rating bigger than 4"
@@ -132,17 +133,17 @@ Using a multi-attribute vector search system, the query
132133
gets automatically decoded into:
133134

134135
```text
135-
semantic search elements:
136-
description="psychology"
136+
semantic search elements:
137+
description="psychology"
137138
price=100
138139
rating=4
139140
filters: type="book"
140141
```
141142

142143
Our system then performs vector similarity search across all attributes simultaneously, providing more nuanced and relevant results than traditional filtering.
143144

144-
145145
## How to Get Started
146+
146147
A complete implementation of this system is available on [GitHub](https://rebrand.ly/amazon-tabular-semantic-github). It includes:
147148

148149
- Data processing scripts
@@ -151,11 +152,9 @@ A complete implementation of this system is available on [GitHub](https://rebran
151152
- Streamlit interface
152153

153154
## Conclusion
154-
Combining vector embeddings and natural language processing is by far more intuitive and powerful than traditional text-to-SQL methods in handling the complexities of e-commerce search. Using a multi-attribute vector search platform like Superlinked’s, you can build modern search experiences that meet the expectations of 21st century e-commerce users, without the complexities and deficiencies of manual SQL query generation, or the overhead of maintaining a separate search index for each different attribute type.
155-
156-
157155

156+
Combining vector embeddings and natural language processing is by far more intuitive and powerful than traditional text-to-SQL methods in handling the complexities of e-commerce search. Using a multi-attribute vector search platform like Superlinked’s, you can build modern search experiences that meet the expectations of 21st century e-commerce users, without the complexities and deficiencies of manual SQL query generation, or the overhead of maintaining a separate search index for each different attribute type.
158157

159-
Ready to try it out yourself? Superlinked is here to help you with your implementation. We also offer a fully-managed cloud service. Don’t hesitate to [get in touch](https://superlinked.typeform.com/to/LXMRzHWk?source=vh-paul-article&typeform-source=vh-paul-article)!
158+
Ready to try it out yourself? Superlinked is here to help you with your implementation. We also offer a fully-managed cloud service. Don’t hesitate to [get in touch](http://getdemo.superlinked.com/?utm_source=vh-paul-article)!
160159

161-
*This article is based on [Paul Iusztin](https://www.linkedin.com/in/pauliusztin/)’s tutorial on Decoding ML - check out the full version [here](https://decodingml.substack.com/p/forget-text-to-sql-use-this-natural).*
160+
_This article is based on [Paul Iusztin](https://www.linkedin.com/in/pauliusztin/)’s tutorial on Decoding ML - check out the full version [here](https://decodingml.substack.com/p/forget-text-to-sql-use-this-natural)._

0 commit comments

Comments
 (0)