BookmarkSubscribeRSS Feed

From Chat to Decision: A Blueprint for Intelligent AI Assistants

Started ‎04-13-2025 by
Modified ‎04-13-2025 by
Views 875

In a previous post, From Chat to Decision: Building an AI Assistant with SAS Intelligent Decisioning and Azure, we demonstrated how to combine conversational AI with decision-making logic to calculate customer risk scores. This post dives deeper into the mechanics of that solution, showing how SAS Intelligent Decisioning, Azure OpenAI, and Azure Logic Apps work together to deliver intelligent, automated decisions.

 

Overview

 

The AI assistant collects user inputs, such as demographic and financial data, processes them via an Azure Logic app, and sends a scoring request to the decision logic deployed in an Azure Container Instance (ACI). This decision logic calculates the risk score, which is then returned to the AI assistant in a user-friendly format.

 

Solution Architecture Components

 

Here’s how the components interact in this solution:

 

  1. AI Assistant in Azure AI Foundry: Collects user inputs via a conversational interface and generates a structured JSON payload that is sent to an Azure Logic app. 01_BT_AI_Assistant_SAS_Intelligent_Decisioning_Azure_AI_Foundry-1536x826.png

Select any image to see a larger version.

Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

  1. Azure Logic app: Acts as middleware, handling the JSON payload from the AI assistant, sending it to the decision logic, running in a container, and formatting the response.02_BT_AI_Assistant_SAS_Intelligent_Decisioning_Azure_Logic_App-1536x729.png

     

  2. SAS Intelligent Decisioning: The core business logic is built and tested here. It calculates the risk score based on the inputs provided. The decision is then published to Azure, where it becomes a Docker image.03_BT_AI_Assistant_SAS_Intelligent_Decisioning_Decision-1024x485.png
  3. Azure Container Instance (ACI): Hosts the decision logic as a running Docker container, making it scalable and independent of a full SAS Viya environment. 04_BT_AI_Assistant_SAS_Container-1-1024x550.png

 

Key Features and Benefits

 

This solution brings several innovations to the table:

 

  1. Deploying a SAS Intelligent Decisioning decision as a Docker image allows businesses to scale decision-making independently of SAS Viya environments.
  2. Azure OpenAI provides a powerful framework for building AI assistants that deliver actionable insights through natural language interactions. The solution takes advantage of a recent integration between Azure OpenAI and Azure Logic Apps.
  3. Azure Logic Apps enable smooth communication between the AI assistant, and the container instance where the decision logic is deployed. It provides low-code-no-code tools, without requiring custom code for complex workflows.
  4. Inputs for risk calculations are collected using conversations, formatted into JSON behind the scenes, results are converted to text, making easier for users to interact.

 

Step-by-Step Guide to Building the Solution

 

1. Develop and Test the Decision Logic in SAS Intelligent Decisioning

Start by building the decision logic that calculates the risk score. Notice the expected inputs and the returned outputs:

 

05_BT_AI_Assistant_SAS_Intelligent_Decisioning_Decision_Variables.png

 

2. Create an Azure Publishing Destination

To publish the decision logic for deployment:

 

  1. Create an Azure Container Registry (ACR) to store the decision logic as a Docker image.
  2. Configure the Azure publishing destination in SAS Intelligent Decisioning. For detailed steps, refer to How to Publish a SAS Model to Azure with SCR: A Start-to-Finish Guide.
  3. Publish the decision to the ACR. For example, it will appear as repository: risk_rating2_0:latest06_BT_AI_Assistant_Azure_Container_Registry_Repository_Decision-1024x360.png

 

3. Deploy the Decision Logic to an Azure Container Instance

Once the Docker image is in the ACR:

 

  1. Create an Azure Container Instance (ACI) and deploy the image.
  2. Note the container endpoint (e.g., http://CONT.LOCATION.azurecontainer.io:8080/risk_rating2_0) and the payload format required for scoring.

 

To test the container, you can use the following curl command:

 

curl --location --request POST "http://${CONT}.${LOCATION}.azurecontainer.io:8080/${IMAGE}" \
  --header 'Content-Type: application/json'  \
  --header 'Accept: application/json'  \
  --data-raw '{"inputs" : [{"name": "age", "value" : 30}, {"name": "credit_score", "value" : 720}, {"name": "dti", "value": 40}, {"name": "employment_status", "value": "full-time"}, {"name": "income", "value" : 45000} ] }'

 

07_BT_AI_Assistant_SAS_Container-1-1024x550.png

 

4. Integrate with Azure Logic Apps

Azure Logic Apps bridge the gap between the assistant and the decision logic. Here's how to set it up:

 

Trigger: HTTP Request

Configure the Logic App to trigger on an HTTP request. The request body should adhere to a specific JSON schema, which includes user inputs such as age, employment status, income, credit score, and DTI.

 

08_BT_AI_Assistant_Azure_Logic_App_HTTP_Trigger-1024x550.png

 

 

In Azure AI Foundry, when you attach to the AI assistant the Azure Logic App as a function:

 

09_BT_AI_Assistant_Add_Logic_App_Function-1024x550.png

 

 

A JSON schema is generated:

 

10_BT_AI_Assistant_Add_Function_JSON_Schema-1024x550.png

 

When the Logic app receives a JSON payload that adheres to that schema, the rest of the logic is triggered.

 

Action: HTTP Request

Send a POST request to the container endpoint using the JSON payload.

 

11_BT_AI_Assistant_SAS_Intelligent_Decisioning_Azure_Logic_App-1536x729.png

 

 

Action: Parse JSON Response

Use a predefined schema to parse the JSON response from the container.

 

12_BT_AI_Assistant_Azure_Logic_App_Parse_JSON-1024x550.png

 

 

Action: Initialize Variable (Optional)

  • The parsed outputs array from the JSON response is stored in a variable named risk_rating_outputs.
  • This variable is of type array.

 

13_BT_AI_Assistant_Azure_Logic_App_Initialize_Variable-1024x486.png

 

 

Action: Create CSV Table (Optional)

Extract the variables from the array and convert to a CSV format for readability.

 

14_BT_AI_Assistant_Azure_Logic_App_Create_CSV_Table-1024x486.png

 

 

Action: Return Response

Send the processed response back to the AI assistant.

 

5. Configure the AI Assistant in Azure OpenAI Foundry

  1. Create an Azure OpenAI resource in your Azure subscription.
  2. Deploy a large language model in Azure OpenAI. We used GPT-4o.
  3. Create an AI assistant with instructions tailored to the risk-rating task.

 

Sample Instructions for the Assistant:

You are an AI assistant that helps people calculate risk rating depending on inputs. Greet with: 'Hi, I can calculate your risk rating. For a precise calculation, I am going to need some inputs.'
You will need some inputs for the calculation.
Ask each person the following: 'What is your age?', 'What is your employment status? (choose only from this list: "unemployed", "part-time", "full-time")',
'What is your yearly income?', 'What is your current credit score?', 'What is your debt to income ratio or 'DTI'?
Collect those values, keep track of the value you collected or not.
Pass the collected values to the __ALA__sas-decisioning function.
The function returns a csv table. Extract risk_rating (a string) from the raw csv table outputs.
Provide a text with the calculated risk_rating. Provide additional data used for risk calculation, if asked.
Answer with a message: 'Based on the inputs you provided, SAS Intelligent Decisioning calculated your risk rating: …'
If the question is not related to a risk rating calculation say: "Please contact your Credit Officer. I do not have knowledge of what you are asking, or I am not authorized to respond."

 

The assistant is programmed with instruction-based prompt engineering to ensure it gathers all required inputs systematically. It integrates with the Logic App via a function (e.g., __ALA__sas-decisioning) that passes the inputs to the container instance and processes the results.

 

15_BT_AI_Assistant_SAS_Intelligent_Decisioning_Azure_AI_Foundry-1536x826.png

 

 

The instructions are an example of instruction-based prompt engineering, ensuring the assistant operates within a predefined domain and delivers accurate, task-specific responses while avoiding ambiguity or scope creep. It uses:

 

  • Step-by-step task definition.
  • Behavioral constraints.
  • Structured inputs/outputs.
  • Function integration: The assistant is programmed to interact with an external function (__ALA__sas-decisioning) and utilize its results for the task.

 

Testing the Solution

 

Before deploying the solution in production, test it end-to-end:

 

  1. Logic app testing: Use the following payload to test the Logic app: 
    {
      "parameters": {
        "properties": {
          "age": 30,
          "employment_status": "full-time",
          "income": 45000,
          "credit_score": 720,
          "dti": 40
        }
      }
    }

 

  1. Verify that the Logic app triggers correctly, sends the payload to the container instance, and returns a structured response: 16_BT_AI_Assistant_Azure_Logic_App_Test_Input-1024x550.png17_BT_AI_Assistant_Azure_Logic_App_Test_Output-1024x550.png

 

  1. AI assistant testing: Interact with the Azure OpenAI assistant to ensure it collects inputs accurately, passes them to the Logic App, and displays the risk rating.

 

Example Response:

"Based on the inputs you provided, SAS Intelligent Decisioning calculated your risk rating: Low Risk."

 

18_BT_AI_Assistant_Calculation_Result-1024x550.png

 

Ask details about the calculation: "Explain how you calculated my Low Risk. What is behind?"

 

19_BT_AI_Assistant_Calculation_Result_Details-1024x780.png

 

Conclusion

 

This post has shown how to:

 

  • Build an AI assistant that calculates risk ratings using conversational AI, SAS Intelligent Decisioning, and Azure resources, using a low-code, no-code approach.
  • Use Azure Logic Apps to integrate API responses into workflows.

 

By adopting a similar approach, businesses can deliver personalized, decision-driven insights at scale. Whether for financial risk assessment or other domains, this solution demonstrates how conversational AI can be combined with powerful decision-making tools to create intelligent, automated workflows.

 

Additional Resources

 

Video demonstrating the approach:

 

 

I was inspired by the following resources:

 

 

If you liked the post, give it a thumbs up! Please comment and tell us what you think about the AI Decisioning Assistant. For further guidance, reach out for assistance. Let us know how this solution works for you!

 

 

Find more articles from SAS Global Enablement and Learning here.

Contributors
Version history
Last update:
‎04-13-2025 11:29 PM
Updated by:

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started