|
| 1 | +# Running sample |
| 2 | + |
| 3 | +Here are instructions to run the sample. |
| 4 | + |
| 5 | +## -1- Install the dependencies |
| 6 | + |
| 7 | +```bash |
| 8 | +npm install |
| 9 | +``` |
| 10 | + |
| 11 | +## -3- Run the sample |
| 12 | + |
| 13 | + |
| 14 | +```bash |
| 15 | +npm run build |
| 16 | +``` |
| 17 | + |
| 18 | +Stop (Ctrl+C) the process when it's done building the files. |
| 19 | + |
| 20 | +## -4- Test the sample |
| 21 | + |
| 22 | + |
| 23 | +1. To test the sample, type the following command: |
| 24 | + |
| 25 | + ```sh |
| 26 | + npm run client |
| 27 | + ``` |
| 28 | + |
| 29 | +1. Type `h` to list all the features, you should see an outcome like so: |
| 30 | + |
| 31 | + ```text |
| 32 | + FEATURES |
| 33 | + products, get products by category |
| 34 | + cart-list, get products in cart |
| 35 | + cart-add, Adding products to cart |
| 36 | + add, undefined |
| 37 | + ``` |
| 38 | + |
| 39 | +1. Type `products`, you should see the following text: |
| 40 | + |
| 41 | + ```text |
| 42 | + Provide argument for "category" |
| 43 | + ``` |
| 44 | + |
| 45 | + Type **books**, you should see the following response: |
| 46 | + |
| 47 | + ```text |
| 48 | + RESULT |
| 49 | + { |
| 50 | + content: [ { type: 'text', text: 'Red ridinghood,Three musketeers' } ] |
| 51 | + } |
| 52 | + ``` |
| 53 | + |
| 54 | +1. Let's add this product to the cart, first type **cart-add**: |
| 55 | + |
| 56 | + You should see an outcome like so: |
| 57 | + |
| 58 | + ```text |
| 59 | + Provide argument for "title" |
| 60 | + ``` |
| 61 | + |
| 62 | + Type **Red**, you should see the following outcome: |
| 63 | + |
| 64 | + ```text |
| 65 | + RESULT |
| 66 | + { content: [ { type: 'text', text: 'Added Red ridinghood to cart' } ] } |
| 67 | + ``` |
| 68 | + |
| 69 | + Your item has been added to the cart. Try typing **cart-list** to list the cart content. |
| 70 | + |
| 71 | +## -5- Test the LLm client |
| 72 | + |
| 73 | +1. Start the LLM client with the following command: |
| 74 | + |
| 75 | + ```sh |
| 76 | + npm run client-llm |
| 77 | + ``` |
| 78 | + |
| 79 | +1. Type the following command **show me books** in the app like so: |
| 80 | + |
| 81 | + ```text |
| 82 | + Provide user prompt (type h for help or quit to stop): show me books |
| 83 | + ``` |
| 84 | + |
| 85 | + You should see the following result: |
| 86 | + |
| 87 | + ```text |
| 88 | + Querying LLM: show me books |
| 89 | + Making tool call |
| 90 | + Calling tool "products" with args "{\"category\":\"books\"}" |
| 91 | +
|
| 92 | + Tool result: { |
| 93 | + content: [ { type: 'text', text: 'Red ridinghood,Three musketeers' } ] |
| 94 | + } |
| 95 | + ``` |
| 96 | + |
| 97 | +1. Add an item to the cart by typing the following input **Add Red to cart** |
| 98 | + |
| 99 | + ```text |
| 100 | + Provide user prompt (type h for help or quit to stop): Add Red to cart |
| 101 | + ``` |
| 102 | + |
| 103 | + You should see a result similar to: |
| 104 | + |
| 105 | + ```text |
| 106 | + Querying LLM: add Red to cart |
| 107 | + Making tool call |
| 108 | + Calling tool "cart-add" with args "{\"title\":\"Red\"}" |
| 109 | +
|
| 110 | + Tool result: { content: [ { type: 'text', text: 'Added Red ridinghood to cart' } ] } |
| 111 | + ``` |
| 112 | + |
| 113 | + Here you can see based on the response that the item was added to the cart. Note also how we didn't have to type the full product name (this is an implementation detail in the server). |
| 114 | + |
| 115 | +1. Let's make sure the cart content is correct by typing **show me cart content**, you should see a response similar to: |
| 116 | + |
| 117 | + ```text |
| 118 | + Querying LLM: show me cart content |
| 119 | + Making tool call |
| 120 | + Calling tool "cart-list" with args "{}" |
| 121 | +
|
| 122 | + Tool result: { content: [ { type: 'text', text: 'Red ridinghood' } ] } |
| 123 | + ``` |
0 commit comments