0% found this document useful (0 votes)
21 views12 pages

ML-AI - Technical Coding Evaluation

The document outlines a project for optimizing an airline call center using AI, focusing on two main problems: a two-agent system for handling flight inquiries and a binary classification model for customer sentiment analysis. It details the functionalities required for each agent, the implementation of a sentiment analysis model, and guidelines for setup, testing, and submission. The project emphasizes the use of Generative AI and machine learning techniques to enhance customer service and operational efficiency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views12 pages

ML-AI - Technical Coding Evaluation

The document outlines a project for optimizing an airline call center using AI, focusing on two main problems: a two-agent system for handling flight inquiries and a binary classification model for customer sentiment analysis. It details the functionalities required for each agent, the implementation of a sentiment analysis model, and guidelines for setup, testing, and submission. The project emphasizes the use of Generative AI and machine learning techniques to enhance customer service and operational efficiency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

AI-Powered Airline Call Center

Optimization
Overview
In an airline call center, agents handle a wide range of customer inquiries—from flight
cancellations and reschedules to refunds and complaints. These conversations produce
valuable data that can be leveraged through Generative AI. By integrating services like AWS
Bedrock or OpenAI or Together AI models, the system can:

 Transcribe audio recordings

 Categorize issues (e.g., Flight Cancellation vs. Refund)

 Compute KPIs to optimize call center operations

This approach should enhance customer satisfaction, reduce call handling times, and
streamline agent performance.

Problem 1: Two-Agent System with Function Calling &


Structured Output
Evaluation Criteria:

 Multi-Agent Coordination – Handling two AI agents working together

 Function Calling – One agent invoking another’s functions

 Structured JSON Output – Ensuring responses follow a defined schema


 Prompt Engineering – Effectively guiding AI agents

Problem Statement

You are building a system where two AI agents collaborate to answer user queries about
airline flights:

1. Info Agent

 Has access to a function get_flight_info(flight_number) that returns structured


flight data (e.g., destination, departure time, status).

 Responds only in JSON format, with no additional text.

2. QA Agent

 Receives user queries (e.g., “What time does Flight 123 depart?”).

 Calls the Info Agent to fetch relevant flight data.

 Processes the result and returns a structured JSON response in a user-friendly


format.

Functions to Implement

1. get_flight_info(flight_number: str) -> dict

 Simulates or mocks flight data retrieval.

Returns a Python dictionary with keys like:

{
"flight_number": "AI123",
"departure_time": "08:00 AM",
"destination": "Delhi",
"status": "Delayed"
}

2. info_agent_request(flight_number: str) -> str

 Calls get_flight_info and returns the data as a JSON string.

 No extra text—only valid JSON.

3. qa_agent_respond(user_query: str) -> str

 Extracts the flight number from the query (e.g., “Flight 123”).

 Calls info_agent_request to get the flight’s JSON data.

Returns a structured JSON response, for example:

{
"answer": "Flight AI123 departs at 08:00 AM to Delhi. Current status: Delayed."
}

 The output must strictly follow JSON format—no plain text or extra commentary.

Test Cases:
Function Call Expected Output

get_flight_info("AI123") {"flight_number": "AI123",


"departure_time": "08:00 AM",
"destination": "Delhi", "status":
"Delayed"}

info_agent_request("AI123") JSON string of the above dictionary (without


extra text)

qa_agent_respond("When does {"answer": "Flight AI123 departs at 08:00


Flight AI123 depart?") AM to Delhi. Current status: Delayed."}

qa_agent_respond("What is the {"answer": "Flight AI999 not found in


status of Flight AI999?") database."} (if flight doesn’t exist)
Problem 2: Binary Classification for Customer
Sentiment
Evaluation Criteria:

 Data Preprocessing – Tokenization, handling missing values, etc.

 Model Training – Logistic Regression, Naive Bayes, or similar

 Prediction & Evaluation – Accuracy, confusion matrix, etc.

 Use of Provided Training Data

Problem Statement

You have a small dataset of customer feedback from an airline. Each row contains a text
snippet and a binary label: positive or negative.

Your task:

1. Train a model to classify feedback as positive or negative.

2. Predict the sentiment for new input text.

Sample Training Data


Text Label

"The flight was on time, and the staff was friendly." positive

"I had to wait 3 hours due to a delay. Terrible!" negative

"Great legroom and comfortable seats." positive

"Lost my luggage, extremely upset about this." negative


"Check-in was smooth, no issues at all." positive

(Full training dataset will be provided.)

Link to download: 2026_ML_test_dataset

Functions to Implement

1. train_sentiment_model(training_data: List[Tuple[str, str]]) -> Any

 Accepts a list of (text, label) pairs where label ∈ { "positive", "negative" }.

 Preprocesses the text (tokenization, lowercasing, etc.).

 Trains a simple model (e.g., LogisticRegression from sklearn).

 Returns the trained model object.

2. predict_sentiment(model: Any, new_text: str) -> str

 Accepts the trained model and a text string.

 Applies the same preprocessing used during training.

 Returns "positive" or "negative" based on the model’s prediction.

Test Cases
Function Call Expected Output

train_sentiment_model([("I love this airline", Trained model object (e.g.,


"positive"), ("Worst experience ever", LogisticRegression)
"negative")])

predict_sentiment(model, "The seats were Likely "positive" (depending


comfortable and service was great!") on training)

predict_sentiment(model, "They lost my Likely "negative"


baggage and were very unhelpful!")

predict_sentiment(model, "Nothing special, just Could be "positive" or


an average flight.") "negative"—depends on the
model.

Implementation & Submission Guidelines


Prerequisites

Before you begin, ensure you have:

 Python 3.8+ installed

 A virtual environment setup (venv or conda recommended)

 API keys for OpenAI, AWS Bedrock, or Together AI (depending on your choice of
LLM provider)

Installed required libraries:

pip install openai boto3 together ai

LLM Setup and API Key Configuration

1. Using OpenAI

Getting API Key

1. Sign up or log in at OpenAI.

2. Navigate to API Keys under your Account Settings.

3. Generate a new API key and copy it.


Setting Up API Key in Python
import openai
import os

os.environ["OPENAI_API_KEY"] = "your_openai_api_key"

response = openai.ChatCompletion.create(
model="gpt-4",
messages=[{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is AI?"}]
)

print(response["choices"][0]["message"]["content"])

2. Using AWS Bedrock

Getting API Key

1. Sign in to AWS Console.

2. Navigate to AWS IAM → Create a user with Bedrock access.

3. Attach the AmazonBedrockFullAccess policy.

4. Generate and download the Access Key ID and Secret Access Key.

Setting Up API Key in Python


```
import boto3

bedrock = boto3.client(
service_name="bedrock-runtime",
region_name="us-east-1", # Change region if needed
aws_access_key_id="your_aws_access_key",
aws_secret_access_key="your_aws_secret_key"
)
response = bedrock.invoke_model(
body='{"prompt": "What is AI?", "max_tokens": 100}',
modelId="anthropic.claude-v2"
)

print(response["body"].read().decode("utf-8"))
```

3. Using Together AI

Getting API Key

1. Sign up at Together AI.

2. Go to API Keys and generate a new key.

3. Copy and store it securely.

Setting Up API Key in Python


import together
import os

os.environ["TOGETHER_API_KEY"] = "your_together_api_key"

response = together.ChatCompletion.create(
model="together/gpt-neoxt-20b",
messages=[{"role": "user", "content": "What is AI?"}]
)

print(response["choices"][0]["message"]["content"])
2. Language & Libraries

 Use Python.

 For Problem 1, simulate/mock multi-agent interaction.

 For Problem 2, libraries like sklearn, numpy, pandas are permitted.

3. Project Structure
Suggested file structure:

├── agent_system.py # For Problem 1


├── ml_classifier.py # For Problem 2
├── README.md # Setup & usage instructions

4. Testing

 Ensure functions pass all test cases.

 Handle edge cases (e.g., missing flight number, empty text).

5. Documentation

 Docstrings for every function.

 README should explain:

o Installation

o Running the code


o Approach for multi-agent function calling (optional).

6. Time Constraints

 Recommended: 60 minutes (or as allocated).

 Extra time? Consider:

o Robust error handling

o Hyperparameter tuning

7. Submission Instructions

1. Project Structure

a. Keep each problem in a separate folder.

b. Each folder must contain a README.md with instructions to run the code.

c. Include all necessary files but DO NOT include __pycache__, venv, or


unnecessary logs.

2. API Keys

a. Store API keys in an api_keys.env file inside each folder.

b. Do not hardcode API keys in the scripts.


3. Dependencies

a. Each folder must have a requirements.txt specifying the necessary


packages.

4. Packaging for Submission

a. Zip the project folder while excluding virtual environments and cache files.

b. The final ZIP file should contain all folders with their respective README.md,
requirements.txt, and scripts.
c. Add the Zip file to your drive and give access to whoever can
access the link.
d. Submit the link to google form given
e. Google Form for Submission:
https://docs.google.com/forms/d/e/1FAIpQLSc8E8Sh32CeKFDr
N82DouvMh1DLimzWgiTW_VtmJAmlziophw/viewform?
usp=header

Example Structure:

submission.zip/

│── problem1/

│ ├── main.py

│ ├── api_keys.env

│ ├── requirements.txt

│ ├── README.md

│── problem2/

│ ├── main.py

│ ├── api_keys.env

│ ├── requirements.txt

│ ├── README.md
All the very best

You might also like