Generative AIby Dhruv Narang

1. Prompt → LLM → Response

Every call has the same three parts.

1 · Prompt
What is the capital of India?
sends→
2 · LLMLarge Language Modellike ChatGPT
returns→
3 · Response
The capital of India is New Delhi.

2. Two Ways to Use an LLM

01
Use a ready-made app
chatgpt.com
Explain tokens in one line

Tokens are the small pieces of text an AI reads.

+Ask anything↑
chatgpt.comclaude.aigemini.google.com
Already built for you. For using AI, no code needed
02
Use it in your code
your_program.pymodel.invoke("Hello")
  • Your Python program calls the model
  • Needs a package
  • Needs an API key
For building AI products

Why an API key? It is your secret password to the model. The company uses it to know who is calling and to bill you for the tokens you use.


3. How Software Connects to an LLM: The API

To use a hosted model (Google, OpenAI, Mistral) in our Python scripts, web apps, or mobile apps, we use an API (Application Programming Interface):

Your sideYour Python codeasks the question
Requestprompt + API key, sent over HTTP
Responsethe generated text
Provider cloudRuns the model on GPUs
GoogleOpenAIMistral