top of page

WELCOME TO CLOUD MATTER

Search
Writer's pictureRoman Guoussev-Donskoi

Simple Web App with Azure OpenAI and Azure Cognitive Search

Summary

This post provides super-easy end-to-end example to build ChatGPT-like web app to provide responses based context your PDF documents.

To load PDF into Azure Cognitive Vector Search you can refer to previous post Langchain + OpenAI + Azure Search (cloudmatter.io)


Complete code for this post is in in GitHub . And walkthrough is provided below.


Chainlit is an open-source Python package that makes it incredibly fast to build Chat GPT like applications with your own business logic and data. Overview - Chainlit


first install chainlit

pip install chainlit

Then create python file and add code below


on_chat_start - Chainlit hook is called when user starts session. We will initialize environment and prepare embedding function (chailnlit kindly loads environment from .env file).


now add code to initialize Azure Search and prompt template



Still within start_chat() function add a chain and store it with user session. (We use LangChain Expression Language (LCEL) | 🦜️🔗 Langchain )


Now moving to on_message - Chainlit hook, which is called every time user asks a new question. msg.send() send response to UI.



assuming you have placed code in app.py file run below to start chainlit

chainlit run app.py -w

Screenshot below shows the result

  1. User asked question

  2. Step to retrieve related data using Azure Search vector index

  3. Step to finalize response using Azure Open AI ChatGPT model

  4. Response provided to user


Happy coding!


234 views0 comments

Recent Posts

See All

RAG processing at scale

Summary Application of generative AI has become more diverse. Ubiquitous chatbot RAG pattern is complemented by other scenarios. One of...

Home: Blog2

Subscribe

Home: GetSubscribers_Widget

CONTACT

Your details were sent successfully!

Computers
Home: Contact

©2018 by Cloud Matter. Proudly created with Wix.com

bottom of page