3. Testing the Chat AI¶
3.1 Testing Options¶
We know from line 49 that the chat API is deployed against the /api/create_response
endpoint. So, how can we test this?
- You can use a third party client to
POST
a request to the endpoint - You can use a
CURL
command to make the request from commandline - You can use the built-in
/docs
Swagger UI to try it out interactively
3.2 Test with Swagger¶
Let's use option 3 - a side benefit of this is it shows us the curl
command you can use to make the same request from the terminal if you want to try that out later.
- Return to the dev server preview tab in the browser (ends in
github.dev
) - Append
/docs
to the URL to get the Swagger UI interactive testing page - Expand the POST section and click
Try it out
- Specify a question:
What camping gear do I own already?
- Specify a customer_id: try 3 ("Michael Johnson")
- Specify chat_history: enter
[ ]
(empty list)
- Specify a question:
- Click
Execute
to run the query
This is similar to our previous testing with the FastAPI endpoint on Azure Container Apps - but now you can also see the server execution traces in the Visual Studio Code console.
- Check: You should get a valid response in the Swagger UI
- Check: You should also see the response traces in the VS Code terminal
CONGRATULATIONS. You just tested your Chat AI from a web client