Azure OpenAI and LangChain

A brief introduction

Valentina Alto
Microsoft Azure
Published in
4 min readMar 25, 2023

--

In last weeks, many of us have been experimenting with the powerful Azure OpenAI APIs, either in the playground or via REST API or Python SDK.

However, those APIs alone are not sufficient to build powerful applications. We can summarize in three main categories the kind of results we want to obtain with those powerful Large Language Models (LLMs):

  • Conversational chatbot that keeps memory
  • Agents that can interact with other data and applications
  • QnA on custom knowledge base

To address those backend complexities, today I want to introduce you to LangChain, a Python library that makes it easier to combine the power of LLMs with the logic of an application.

In this article, we are going to dwell on how to integrate Azure OpenAI models’ API into LangChain, including some examples in Python.

Prerequisites

In all the examples,

  • An Azure subscription — Create one for free.
  • Access granted to Azure OpenAI in the desired Azure subscription (you can ask access at https://aka.ms/oai/access).
  • An Azure OpenAI resource with a model deployed. For more information about model deployment, you can…

--

--

Valentina Alto
Microsoft Azure

Data&AI Specialist at @Microsoft | MSc in Data Science | AI, Machine Learning and Running enthusiast