Start chatting with the Contoso Sales Assistant

Introduction

  1. Below is the script used in the video, but since the application is powered by a large language model (LLM), conversations will vary. Be prepared to adapt based on the responses you receive.

    The script is a guide rather than a strict rule. However, be aware that some prompts may produce large amounts of data, which can be tedious for the audience as it streams to the assistant. To maintain engagement it's best to use prompts that generate concise responses. The assistant instructions favour data aggregates to reduce data returned from the database.

  2. The chat window shows the LLM Chain of Thought, this is enabled to help understand the context of the conversation. You can show the SQL queries and results from the "Function" tool, and the Python code generated by the "Code Interpreter" tool by clicking their respective dropdowns. Note, there is an overhead for "Chain of Thought" as the context needs to be streamed to the chat window. In production, you'd disable "Chain of Thought".

  3. The Code Interpreter performance execution times can vary, this is dependent on the code complexity, location, and time of day, so be patient when waiting for the Python code to execute and have talking points ready to fill the time.

The Demo Script

  1. From your browser, navigate to the Contoso Sales Assistant event page.
  2. Login with your GitHub account.
  3. Follow the instructions for the event and launch the Contoso Sales Assistant.

Set the Assistant UX to Light Mode

Suggest setting light mode as generally better for an audience.

  1. From the top right, select the user icon.
  2. Select Light Mode.
  3. Start with conversation history closed.

ux-intro

Start the conversation

Help

There are prompt starters in the centre of the chat window. You can select one of these starters to begin the conversation.

  1. Select Help from the Chat Window Starters.

    This will provide a list of sample questions that the assistant can answer. Remember, on startup, the assistant loaded the database schema, product categories, product types, and reporting years, so it has this context to work with when providing help.

  2. Type Help (in your preferred language). For example, Help in Dutch, Help in French, etc. This will provide a list of sample questions that the assistant can answer in the your preferred language.

Note

You can chat to the Contoso Sales Assistant in the language of your choice, but be sure to test it first. Keep in mind that the Code Interpreter may not support all language fonts for visualizations.

Sales by Region

  1. Select Start new chart.
  2. Select the 2nd from left starter: Create a vivid pie chart of sales by region.

    The LLM will first generate a SQL query. It will then call the ask_database function to execute the query and return the results. After that, the LLM will generate Python code to create a pie chart based on the query results. You can view the “Chain of Thought” to see the SQL query, the results, and the Python code executed by the Code Interpreter to create the pie chart.

    cot

Tents for Beginners

  1. Next, we'll ask about beginner-friendly tents. The sales database has limited knowledge of the products as the focus of the database is sales data, so the LLM will generate a limited response based on the data available.

    Submit the prompt: What beginner-friendly tents does Contoso sell?

Extend the Assistant's Knowledge

  1. Next, we'll going to upload a Contoso Tents Datasheet to the Assistants API. This will allow the assistant to provide more detailed information about the tents. The Assistants API will vectorize the PDF and store the data in a vector store and the LLM will be able to access the data using hybrid (semantic and keyword) queries.

  2. Drag and drop the contoso-tents-datasheet.pdf onto the Contoso Sales Assistant. The assistant will now have access to the tent data. The PDF file can be found in the resources folder of this repository.

  3. Add the prompt What beginner-friendly tents does Contoso sell?
  4. Resubmit the question.

    Add the pdf to the prompt

Now the assistant has access to the tent data and can provide more detailed information.

  1. Now, we're going to combine the data from the sales database and the tent datasheet to provide a more detailed analysis.

Submit the prompt: Show sales of BACKPACKING TENTS by region and include a brief description in the table about each tent.

Create an Excel File

  1. Finally, let's use the Assistants API, the LLM, and the code interpreter to generate a report on the sales of beginner-friendly tents in Excel format.

Submit the prompt: Create an excel file

The LLM will generate the Python code to create the Excel file. You can download the file by selecting the download link and open in Excel.

Other questions you can ask

The assistant can answer a wide range of questions about the sales data. Here are some additional questions you can ask:

  1. What are the top 5 products by sales?
  2. Sales by region?
  3. Sales by category?
  4. What are the top 5 products by sales for travel?