AI4SE Tutorial

Welcome to AI4SE Tutorial

Discover the power of Artificial Intelligence in Software Engineering with this interactive tutorial.

Lets set things up.

Follow this notebook for the Tutorial: Tutorial Notebook

Now we setup Gemini. Do the following:

  • Generate Your API Key
  • Add Your API Key to Colab
    • Open your Google Colab notebook.
    • On the left panel, click the šŸ”‘ ā€œSecretsā€ icon.
    • Click ā€œ+ Add a new secretā€.
    • ā€˜Name’ is you key name, and ā€˜Value’ is the key
  • Configure the API Key in Your Code
    • Change the name in the 3rd cell if needed: GOOGLE_API_KEY=userdata.get(ā€˜Key_Name’)
    • Colab will ask for permission to access your secrets. Grant access to proceed.

Content

1. Prompting

Prompting
Image credit: The Power of Prompt Engineering: Refining Human -AI Interaction with Large Language Models in The Field of Engineering

šŸ’” Prompting involves crafting effective instructions or queries to guide AI models (LLMs) in generating desired outputs. 🧠 LLMs might often need a greater context (History) rather than just the user input to generate a response.

2. Function Calling

Function Calling
Image credit: Expanding AI Horizons: The Rise of Function Calling in LLMs

šŸ”§ Function calling lets a language model go beyond text generation by triggering external tools or APIs based on the user’s prompt. When the model detects that a specific task—like retrieving weather data, running code, querying a database, or automating a process—is needed, it calls a predefined function with the appropriate inputs.

These functions can do things like:

  • Access cloud services (e.g., weather or maps)
  • Run backend processes or scripts
  • Query databases
  • Execute code or automation tasks

šŸ¤– The model then uses the function’s output to generate a final, informed response. This turns the model into a powerful agent that can interact with external systems dynamically.

3. Retrieval-Augmented Generation (RAG)

Retrieval Augmented Generation
Image credit: How I built a Simple Retrieval-Augmented Generation (RAG) Pipeline

1. Data Indexing

This stage prepares documents for retrieval later.

  • Data Loading: Raw documents are collected and loaded.
  • Data Splitting: Documents are split into smaller text chunks (e.g., paragraphs, sentences).
  • Data Embedding: Each chunk is converted into a vector embedding using an embedding model. These are numerical representations that capture the semantic meaning of the text.
  • Data Storing: The embeddings are stored in a Vector Database (Vector DB), which enables fast similarity search.

2. Data Retrieval & Generation

This stage is triggered when a user asks a question.

  • User Query: A user submits a question.
  • Vector Embedding: The query is converted into a vector (like the document chunks).
  • Retrieval: The vector DB is queried with the query embedding to retrieve the most relevant Top-K Chunks.
  • Generation:
    • The retrieved chunks are passed to a Large Language Model (LLM).
    • The LLM uses this context to generate a response.

4. Agentic AI

Agent
Image credit: What is Agentic AI | K21Academy

šŸ¤– Agentic AI refers to AI systems that can act as autonomous agents, making decisions, using tools, collaborating with others, and adapting to complex tasks over time.

šŸ”§ Agent Customization Agentic AI allows you to build specialized agents by customizing:

  • Capabilities (e.g. access to specific tools or APIs)
  • Behavior (how they interact or respond)
  • Roles (like data analyst, assistant, or coder)

🧠 Agent Architecture An agent can be powered by

  • Memory (to remember past actions)
  • Tools (to interact with the world, like APIs or functions)
  • Goals (what the agent is trying to achieve)

šŸ¤– Multi-Agent Conversations Agentic systems involve multiple agents working together. This supports collaborative problem-solving, with agents sharing results or coordinating workflows. They can have various communication patterns.

  • Joint chat: Multiple agents interact simultaneously.
  • Hierarchical chat: One lead agent delegates tasks to others.

šŸ” Flexible Interaction Patterns Agents aren’t limited to user prompts—they

  • Interact with each other
  • Trigger actions autonomously
  • Update plans dynamically

Agent Communication
Image credit: AutoGen


Instructors

Karthik Vaidhyanathan

Karthik Vaidhyanathan

Assistant Professor, IIIT Hyderabad

Rudra Dhar

Rudra Dhar

PhD Student, IIIT Hyderabad