# Import Azure OpenAI
from langchain_openai import AzureChatOpenAI
from dotenv import load_dotenv
from os import getenv

load_dotenv()
llm = AzureChatOpenAI(deployment_name=getenv("MODEL"), max_tokens=4000)

Now define a function to invoke the LLM similar to how we did for embeddings

# Submits a series of prompts to OpenAI model
def api(prompts):
  response = llm.batch(prompts)
  return [item.content for item in response]

Now we pass the api function to your workflow

from txtai import Embeddings, RAG
# Create RAG instance

rag = RAG(embeddings, api)