🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 4: Photo Caption Bot

AI Engineer

Builds on these lessons

Current Task

Objective

An LLMChain bundles a PromptTemplate and a model into a single reusable object with one .invoke() call.

Task: build a prompt, wire it into a chain with a model, and print the chain's input keys.

index.py
from langchain_core.prompts import PromptTemplate from langchain_openai import ChatOpenAI prompt = PromptTemplate( template="Caption this photo: {description}", input_variables=["description"], ) model = ChatOpenAI(model="gpt-4o-mini") chain = prompt | model print(chain.input_schema.model_json_schema()["required"])

* Hint: Correct characters turn green, incorrect ones turn red.

Live Preview
🖼️

Verify your code to see the preview