Follow the steps below for a simple walk-through of the application and its capabilities.
@ciprianjichici, please add steps for exercising the data here more thoroughly with prompts on customers and sales orders. Also include steps for seeing the cache in action, changing min relevance, etc.
- Browse to the web application for the solution in your browser.
- Click [+ Create New Chat] button to create a new chat session.
- Type in your questions in the text box and press Enter.
Here are some sample questions you can ask:
-
What kind of socks do you have available?
-
Do you have any customers from Canada? Where in Canada are they from?
-
What kinds of bikes are in your product inventory?
-
add more here
User types in some prompts for data that gets cached. In new session test similar prompts, observe results. Change similarity score. Start new sequence of prompts and completions, see the impact on cache hits.
etc...
One great reason for using an operational database like Azure Cosmos DB as a source for your data in Generative AI applications is that you can leverage its Change Feed capability to dynamically add and remove records which can be vectorized and available in real-time. The steps below can demonstrate this capability.
-
Start a new chat session in the web application.
-
In the chat text box, type: "Can you list all of your socks?". The AI Assistant will list 4 different socks of two types, racing and mountain.
-
Using either CURL or Postman, send the following payload in a PUT request with a
Content-Type
header value ofapplication/json
tohttps://<chat-service-hostname>/api/products
to add a product.curl -X PUT -H "Content-Type: application/json" -d $JsonPayload https://<chat-service-hostname>/api/products
{ "id": "00001", "categoryId": "C48B4EF4-D352-4CD2-BCB8-CE89B7DFA642", "categoryName": "Clothing, Socks", "sku": "SO-R999-M", "name": "Cosmic Racing Socks, M", "description": "The product called Cosmic Racing Socks, M", "price": 6.00, "tags": [ { "id": "51CD93BF-098C-4C25-9829-4AD42046D038", "name": "Tag-25" }, { "id": "5D24B427-1402-49DE-B79B-5A7013579FBC", "name": "Tag-76" }, { "id": "D4EC9C09-75F3-4ADD-A6EB-ACDD12C648FA", "name": "Tag-153" } ] }
Note the
id
of00001
andcategoryId
ofC48B4EF4-D352-4CD2-BCB8-CE89B7DFA642
. We will need these values in a later step. -
Return to the AI Assistant and type, ""Can you list all of your socks again?". This time you should see a new product, "Cosmic Socks, M"
-
Using either CURL or Postman, send the following payload in a DELETE request to
https://<chat-service-hostname>/products/<product_id>?categoryId=<category_id>
to add a product, where<product_id>
is the value of theid
field and<category_id>
is the value of thecategoryId
field of the JSON payload sent via a PUT request in a previous step (00001
andC48B4EF4-D352-4CD2-BCB8-CE89B7DFA642
, respectively, in this case).curl -X DELETE https://<chat-service-hostname>/products/<product_id>?categoryId=<category_id>
-
Open a new chat session and ask the same question again. This time it should show the original list of socks in the product catalog.
Note: Using the same chat session after adding them will sometimes result in the Cosmic Socks not being returned. If that happens, start a new chat session and ask the same question. Also, sometimes after removing the socks they will continue to be returned by the AI Assistant. If that occurs, also start a new chat session. The reason this occurs is that previous prompts and completions are sent to OpenAI to allow it to maintain conversational context. Because of this, it will sometimes use previous completions as a background for generating subsequent responses.