These are many approaches you can do with Azure OpenAI and AI Search, from your option A and B, it falls under:
A, Retrieve Then Read: Simple retrieve-then-read implementation, using the AI Search and OpenAI APIs directly. It first retrieves top documents from search, then constructs a prompt with them, and then uses OpenAI to generate an completion (answer) with that prompt. Read more here: https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/app/backend/approaches/retrievethenread.py
B, Chat Read Retrieve Read: A multi-step approach that first uses OpenAI to turn the user's question into a search query, then uses Azure AI Search to retrieve relevant documents, and then sends the conversation history, original user question, and search results to OpenAI to generate a response.
Function Calling
like this sample implementation https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/app/backend/approaches/chatreadretrieveread.py. You can leverage further with multi-step depends on your business, not only just data_source but also for your python function https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-callingWhat's better?
A is simple and straightforward. If you search for an item and AI Search returns no information, then OpenAI takes no further action, and the conversation ends early. This often happens because not every user asks for information in the first query or may not know how to phrase their question.
B helps expand the conversation context and allows OpenAI to decide which function to run, making the interaction feel more human-like. It absolutely depends on your business needs to branch the conversation scenario in more customizable ways. For example, when a user asks, "How's the weather today?", it's necessary to have two parameters: "location" and "unit" (Celsius or Fahrenheit). Without providing enough parameters, OpenAI will prompt the user with something like, "Please let me know your location and unit." It will keep asking if either parameter is missing and will run the function once it has all the necessary information.