In the rapidly evolving landscape of artificial intelligence, generative AI solutions are becoming increasingly central to a myriad of applications, from chatbots and virtual assistants to content creation and beyond. However, as these solutions grow in complexity and scale, developers are often faced with the daunting task of managing and optimizing the prompts that drive AI interactions. Prompts are the catalysts of AI-generated content, they require meticulous crafting and constant refinement to ensure that the generated output meets the desired quality and relevance.
PromptFlow was released June 2023 and allows AI engineers to rapidly prototype solutions and get a handle on prompt management. PromptFlow is a framework designed to simplify and streamline the orchestration of prompts, transforming the way developers interact with generative AI models. By providing an intuitive and flexible platform, PromptFlow empowers AI engineers to chain, and optimize prompts through Directed Acyclic Graphs or DAGs.
Example of a chat Promptflow DAG.
The integration of PromptFlow with vector databases unlocks even greater potential, particularly for Retrieval Augmentation Generation (RAG) solutions. By leveraging vector databases, PromptFlow enhances the retrieval process, ensuring that the generative AI solution has access to the most relevant and contextually rich information. This not only refines the AI's output but also paves the way for more sophisticated and intelligent applications.
Let’s have a Chat
The sample below shows how you can create your own Promptflow chat experience using RAG with an in-memory Vector DB and a PDF document.
Prerequisites
-
You must have an Azure Machine Learning workspace along with a compute instance that you can access. More info - https://learn.microsoft.com/en-us/azure/machine-learning/how-to-create-compute-instance?view=azureml-api-2&tabs=python
-
Make sure you have an Azure Open AI instance with a GPT and Embedding model deployed.
Upload the sample
Using Azure Machine Learning studio you can import a promptflow solution or use a pre-defined template. For this example we are using a flow that was downloaded from the Microsoft Promptflow github repository.
Begin by going to your Azure Machine Learning workspace then select “Prompt flow” and click on “Create”.
Next click “Upload” from the Upload from local section.
Make sure to clone or download the repository from the Microsoft Repository (https://github.com/microsoft/promptflow/tree/main/examples/flows/chat/chat-with-pdf).
Then navigate to /examples/flows/chat/chat-with-pdf/ and create a zip file or upload the Folder by selecting “Browse” and finally click “Upload” at the bottom of the page.
Prompflow Inputs
This examples lets you interact with the “Generative AI Proof of Concept” PDF from the SpyglassMTG website - https://5237880.fs1.hubspotusercontent-na1.net/hubfs/5237880/GenAIPoCOP.pdf.
Make sure the config input has the correct models by selecting the pencil icon.
Here is an example of the config used in this project. Your config may contain a different Model Deployment Name or Embedding Model. Please check your OpenAI Studio to make sure.
For this project we will use the Automatic Runtime.
After selecting the automatic runtime, open the requirements.txt file and select “Save and install”.
At the end of “setup_env” window select your connection. This can be configured under Azure Machine Learning > Promptflow > Connections. You can use the Default or create a connect for an existing OpenAI resource. Click run to verify the setup ran successfully.
Now you can test by clicking on the “Chat” button in the top right corner and asking “What are the key features of the Generative AI PoC?”
What’s Next?
In the “Chat with your PDF” example showed by simplifying prompt management, PromptFlow empowers developers to craft more nuanced and effective AI interactions with ease. In harnessing the capabilities of PromptFlow, developers are not only optimizing their workflows but are also stepping into a new era of AI development. Whether you're building complex chatbots, dynamic content generators, or sophisticated AI assistants, PromptFlow should be apart your AI toolkit.
Share with us! We hope you dive in and create your own PromptFlows. We’d like to hear about your PromptFlow journey and share your success stories and insights with us. Your innovations could inspire others and contribute to the ever-growing community. Add a comment bellow or visit SpyglassMTG's contact page to share your PromptFlow experiences and join the future of generative AI development.
If you need guidance or looking to maximize the impact of PromptFlow, SpyglassMTG offers a variety of generative AI solutions. As a consulting firm that specializes in AI, SpyglassMTG can provide the support and expertise needed to navigate the complexities of AI integration with your secure network and ensure your projects reach their full potential. Contact us today!