Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable incremental product embedding #202

Conversation

saragluna
Copy link

@saragluna saragluna commented May 16, 2024

  • Allow adding, editing, and deleting products
  • Update Assist service:
    • Add a vectorstore, which doesn't calculate the embeddings when provided in the documents
    • Enable adding/updating documents
    • List the index out of date documents
    • Add a job to update the documents for some products
  • Update the source file of bikes.json and accessories.json to have id, which equals to the id of the product sql file, and the vector_store.json.

The command to deploy the job is like:

az spring job deploy --name assist-job \
    --source-path apps/acme-assist \
    --build-env BP_JVM_VERSION=17 \
    --build-env BP_MAVEN_ACTIVE_PROFILES=job \
    --env \
        SPRING_AI_AZURE_OPENAI_ENDPOINT=${SPRING_AI_AZURE_OPENAI_ENDPOINT} \
        SPRING_AI_AZURE_OPENAI_API_KEY=${SPRING_AI_AZURE_OPENAI_APIKEY}

@saragluna saragluna marked this pull request as ready for review May 16, 2024 12:21
@saragluna saragluna force-pushed the feature/enable-accumulative-editing branch from 1a7bdfd to 1fc9d0c Compare May 20, 2024 02:53
@saragluna
Copy link
Author

Steps to go through this change:

  1. Update the Spring Cloud Gateway routing rules for catalog service, assist service.

  2. Add a new product, you can enrich the short description and description

    curl --location 'https://xiada-fitness-store-gateway-fa329.svc.azuremicroservices.io/products' \
    --header 'Content-Type: application/json' \
    --data '{
        "imageUrl1": "url1",
        "imageUrl2": "url2",
        "imageUrl3": "url3",
        "name": "xiada",
        "shortDescription": "short desc",
        "description": "desc",
        "price": 299.99,
        "tags": [
            "a",
            "b",
            "c"
        ]
    }'
  3. Update the product, this is optional

    curl --location 'https://xiada-fitness-store-gateway-fa329.svc.azuremicroservices.io/products/07e5785e-c844-41ca-b4cb-d1dfa0a1d383' \
    --header 'Content-Type: application/json' \
    --data '{
        "imageUrl1": "https://www.shutterstock.com/shutterstock/photos/2272933579/display_1500/stock-vector-captain-america-logo-art-design-template-white-background-isolated-2272933579.jpg",
        "imageUrl2": "https://www.shutterstock.com/shutterstock/photos/2272933579/display_1500/stock-vector-captain-america-logo-art-design-template-white-background-isolated-2272933579.jpg",
        "imageUrl3": "https://www.shutterstock.com/shutterstock/photos/2272933579/display_1500/stock-vector-captain-america-logo-art-design-template-white-background-isolated-2272933579.jpg",
        "shortDescription": "this is the short description for the product xiada, and it'\''s the best for hiking",
        "description": "xiada likes hiking, and it can be used in different places"
    }'
  4. Deploy the assist-service, call the list product ids to index. You can see the newly added product is in the returned values.

    curl --location 'https://xiada-fitness-store-gateway-fa329.svc.azuremicroservices.io/ai/admin/products-to-index'
  5. Create and deploy the job, make sure setting the BP_MAVEN_ACTIVE_PROFILES env

    az spring job deploy --name assist-job \
        --source-path apps/acme-assist \
        --build-env BP_JVM_VERSION=17 \
        --build-env BP_MAVEN_ACTIVE_PROFILES=job \
        --env \
            SPRING_AI_AZURE_OPENAI_ENDPOINT=${SPRING_AI_AZURE_OPENAI_ENDPOINT} \
            SPRING_AI_AZURE_OPENAI_API_KEY=${SPRING_AI_AZURE_OPENAI_APIKEY}

- Update Assist service:
  + Add a vectorstore, which doesn't calculate the embeddings when provided in the documents
  + Enable adding/updating documents
  + List the index out of date documents
  + Add a job to update the documents for some products
- Update the source file of bikes.json and accessories.json to have id, which equals to the id of the product sql file, and the vector_store.json.
@saragluna saragluna force-pushed the feature/enable-accumulative-editing branch from 524c00d to b26c60d Compare May 26, 2024 08:07
@saragluna saragluna force-pushed the feature/enable-accumulative-editing branch from b26c60d to 709071e Compare May 26, 2024 08:32
@saragluna
Copy link
Author

Close in favor of #207

@saragluna saragluna closed this May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant