Skip to content

Commit 52fb68e

Browse files
valerioarvizzignoValerio Arvizzigno
andauthored
adding retail vertex-ai demo to labs repo (#7)
* adding retail vertex-ai demo to labs repo * removed unecessary files * resetting homecraft folder * removing unnecessary files * polished folder * adding homecraft info in commong readme --------- Co-authored-by: Valerio Arvizzigno <valerio@ComputeiValerio.station>
1 parent 2bd88e1 commit 52fb68e

File tree

9 files changed

+2627
-0
lines changed

9 files changed

+2627
-0
lines changed

example-apps/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Use these apps as a starting point for your own projects.
1313
- [OpenAI embeddings](./OpenAI-embeddings/README.md). Use OpenAI embeddings at index time and in Elastic kNN queries. Available in [JavaScript](./OpenAI-embeddings/OpenAI-JS/README.md) and [Python](./OpenAI-embeddings/OpenAI-Py/README.md) versions.
1414
- [Workplace search](./Workplace-Search/README.md). Build a semantic search experience for organizational/workplace data.
1515
- [relevance-workbench](./relevance-workbench/README.md). A Python application that allows you to compare results ranking between the **Elastic Learned Sparse Encoder** model and BM25.
16+
- [Homecraft Vertex](./homecraft_vertex/README.md). A Python application designed for Retail industry simulating an e-commerce search bar. It integrates with Google's VertexAI and PALM2 model, BigQuery Datasets and Elastic Vector Search to answer questions around previous orders, suggested products available and company information.
1617

1718

1819
> ℹ️ **Note**:
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
POST search-homecraft-ikea/_mapping
2+
{
3+
"properties": {
4+
"title-vector": {
5+
"type": "dense_vector",
6+
"dims": 768,
7+
"index": true,
8+
"similarity": "dot_product"
9+
}
10+
}
11+
}
12+
13+
14+
POST home-depot-product-catalog-vector/_mapping
15+
{
16+
"properties": {
17+
"title-vector": {
18+
"type": "dense_vector",
19+
"dims": 768,
20+
"index": true,
21+
"similarity": "dot_product"
22+
}
23+
}
24+
}
25+
26+
POST _reindex
27+
{
28+
"source": {
29+
"index": "home-depot-product-catalog"
30+
},
31+
"dest": {
32+
"index": "home-depot-product-catalog-vector",
33+
"pipeline": "ml-inference-title-vector"
34+
}
35+
}
36+
37+
38+
POST /home-depot-product-catalog-vector/_delete_by_query
39+
{
40+
"query": {
41+
"match_all": {}
42+
}
43+
}
44+
45+
DELETE /home-depot-product-catalog-vector
46+
47+
PUT /home-depot-product-catalog-vector
48+
49+
50+
# Elasticsearch query (BM25) and kNN configuration for hybrid search
51+
52+
GET home-depot-product-catalog-vector/_search
53+
{
54+
"query" : {
55+
"bool": {
56+
"must": [{
57+
"match": {
58+
"title": {
59+
"query": "list the 3 top paint primers in the product catalog, specify also product price and product key features",
60+
"boost": 1
61+
}
62+
}
63+
}],
64+
"filter": [{
65+
"exists": {
66+
"field": "title-vector"
67+
}
68+
}]
69+
}
70+
},
71+
72+
"knn" : {
73+
"field": "title-vector",
74+
"k": 1,
75+
"num_candidates": 20,
76+
"query_vector_builder": {
77+
"text_embedding": {
78+
"model_id": "sentence-transformers__all-distilroberta-v1",
79+
"model_text": "list the 3 top paint primers in the product catalog, specify also product price and product key features."
80+
}
81+
},
82+
"boost": 24
83+
}
84+
85+
}
86+

0 commit comments

Comments
 (0)