You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In addition to the current full text search capability, we should be able to offer a natual language based vector search that a user can use to find products.
This is already largely implemented, but is turned off due to the fact that performance is not as good as it should be.
Related Code
Backend -> routes.py API route
@r.post("/vectorsearch/text/user",response_model=t.List[Product],name="product:find_similar_by_user_text",operation_id="compute_user_text_similarity")asyncdeffind_products_by_user_text(similarity_request: UserTextSimilarityRequest) ->t.List[Product]:
q=create_query(similarity_request.search_type,
similarity_request.number_of_results,
vector_field_name="text_vector",
gender=similarity_request.gender,
category=similarity_request.category)
redis_client=awaitRedis(host=config.REDIS_HOST, port=config.REDIS_PORT, db=0)
# obtain vector from text model in top level __init__.pyvector=TEXT_MODEL.encode(similarity_request.user_text)
# obtain results of the queryresults=awaitredis_client.ft().search(q, query_params={"vec_param": vector.tobytes()})
# Get Product records of those resultssimilar_product_pks= [p.product_pkforpinresults.docs]
similar_products= [awaitProduct.get(pk) forpkinsimilar_product_pks]
returnsimilar_products
investigate performance of user text vector search
- This will largely be in the data prep stage. We currently use the description as the text vector data. This is manually cleaned with regex and probably not optimal.
Once performance is acceptable, enable the vector search in addition to text search
make sure the buttons look right on the front end.
The text was updated successfully, but these errors were encountered:
Description
In addition to the current full text search capability, we should be able to offer a natual language based vector search that a user can use to find products.
This is already largely implemented, but is turned off due to the fact that performance is not as good as it should be.
Related Code
Backend -> routes.py API route
Backend -> Pydantic Schema for API route
The huggingface model is held as a global variable within the top-level
__init__.py
. This could probably be improved.Frontend -> Header.tsx currently commented out.
Frontend JS to call backend -> api.ts
TODO
- This will largely be in the data prep stage. We currently use the description as the text vector data. This is manually cleaned with regex and probably not optimal.
The text was updated successfully, but these errors were encountered: