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
- Go to Google AiStudio Api Key
- Generate Key.
- Provide any necessary permissions when prompted.
- 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
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
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)
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
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
Image credit: AutoGen
Instructors

Karthik Vaidhyanathan
Assistant Professor, IIIT Hyderabad

Rudra Dhar
PhD Student, IIIT Hyderabad