# Day 1 - Jan 20 2026

The first day of the GenAI challenge focused on understanding how **LangChain** structures interactions with Large Language Models (LLMs). The session covered prompt engineering fundamentals, dynamic prompt creation, chat-style prompts, and connecting LangChain with **Google Gemini** to generate AI responses.

The objective was to move beyond static prompts and learn how applications can generate structured, reusable, and context-aware prompts programmatically.

### What is LangChain?

LangChain is a framework designed to simplify the development of applications powered by Large Language Models. It provides abstractions for:

* Prompt management
* Model integration
* Chaining multiple AI calls
* Building conversational and agent-based systems

Instead of directly calling an LLM with raw text, LangChain encourages structured inputs and modular design.

## 1. Dynamic Prompts Using `PromptTemplate`

Concept

A **PromptTemplate** allows creation of reusable prompts with placeholders (variables).\
This makes prompts dynamic and adaptable to different inputs without rewriting the prompt text.

Key Takeaway

PromptTemplate separates **prompt structure** from **runtime data**, which is essential for scalable GenAI applications.

## 2. Chat-Style Prompts Using `ChatPromptTemplate`

Concept

`ChatPromptTemplate` is used for conversational AI.\
It structures prompts as a sequence of messages, typically including:

* System messages (instructions)
* Human messages (user input)
* AI messages (responses or examples)

Key Takeaway

ChatPromptTemplate provides better control over **conversation flow and role-based context**.

## 3. Connecting to Google Gemini Using `ChatGoogleGenerativeAI`

Concept

LangChain supports multiple LLM providers.\
In this session, **Google Gemini** was used as the backend Generative AI model.

Key Takeaway

LangChain acts as an abstraction layer, allowing easy switching between models without changing application logic.

## 4. Displaying AI Responses

Concept

Once the prompt and model are connected, the final step is invoking the model and displaying the response.

Output

The model returns a structured response object, from which the generated text can be accessed and displayed.

## Summary of Learnings

* [x] Learned how LangChain structures prompts and conversations
* [x] Created reusable, dynamic prompts using `PromptTemplate`
* [x] Built conversational prompts using `ChatPromptTemplate`
* [x] Integrated Google Gemini with LangChain
* [x] Successfully generated and displayed AI responses

### Key Insight

> Prompt engineering is not just about wording—it is about **structure, reusability, and context control**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shankar-lab.gitbook.io/mylearning/15-days-genai-learning-challenge/day-1-jan-20-2026.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
