Utilizing Azure AI Studio's Prompt Flow, we were able to easily implement a chatbot that answers questions about PDF documents. Furthermore, we conducted an evaluation of this chatbot to verify its accuracy. In this blog post, we will take you through the next step: moving beyond just testing the chatbot within Azure AI Studio's chat feature. We will demonstrate how to deploy this chatbot as a REST endpoint and test it using Postman, a popular tool for API development and testing by developers and test engineers.
This post is a part of a series that serves as a step-by-step guide to developing a chatbot with RAG:
- Step 1 : How to Easily Build a PDF Chatbot with RAG (Retrieval-Augmented Generation) Using Azure AI Studio's Prompt Flow
- Step 2 : How to Evaluate a PDF Chatbot Response with Prompt Flow
- Step 3 : How to Deploy a PDF Chatbot as a REST Endpoint and Test with Postman ← YOU ARE HERE!
Table of Contents
Prerequisites
- Complete to create a flow (see How to Easily Build a PDF Chatbot with RAG (Retrieval-Augmented Generation) Using Azure Prompt Flow)
- Download Postman
- Optional : Complete to evaluate a flow (see How to Evaluate a PDF Chatbot Response with Prompt Flow)
1. Modify a flow
1-1. Replace with vector db lookup
Need to replace the "index lookup tool" with "vector db lookup".
Add "Vector DB Lookup" from More tools.
Then, enter a node name (e.g. search) and add it to the flow
Finally, input values for the node and Save the change.
If you want to know where these information come from, you can check them in Azure AI Search on Azure portal and navigate to indexes as below.
After creating the "Vector DB Lookup" node your graph will look like the screenshot below.
1-2. Delete an unnecessary node
Delete the "Vector Index Lookup - search_question_from_indexed_docs" and Save the change
1-3. Change the value of search result node
Change the value of search_result to "$(search.output)" in generate_prompt_context node and Save the change
After completing all the steps to replace the "index lookup tool" with "vector db lookup" your graph will look like the screenshot below.
1-4. Try chat
Try the chat with your PDFs to make sure if it works as expected.
2. Deploy a flow
2-1. Deploy a flow from Prompt Flow tab
and change basic settings if you wish.
Review the deployment settings and Create it.
It will take around 10 minutes to complete the deployment.
2-2. Test the deployed endpoint
Move to Deployments tab and select the deployed endpoint,
3. Test the endpoint with Postman
3-1. Copy Rest endpoint and Primary key
Copy REST endpoint and Primary key from Consume tab
3-2. Configure on Postman
- POST : REST endpoint
- Headers
KEY | VALUE |
---|---|
Authorization | Bearer {Primary key} |
Content-Type | application/json |
- Body : raw (json)
{"question":"who are you","chat_history":[]}
3-3. Test the endpoint
Click "Send" and get the response!
Conclusion
In this blog, we have explored how to deploy the chatbot, implemented using Azure AI Studio's Prompt Flow, as a REST endpoint and how to test it using Postman. Next, we plan to introduce a method for implementing a simple application that utilizes the REST endpoint we've just deployed.
Top comments (0)