03. 구조화된 출력 체인(with_structered_output)

Chains using structured output (with_structured_output)

# Configuration file for managing API keys as environment variables
from dotenv import load_dotenv

# Load API key information
load_dotenv()
True
# Set up LangSmith tracking. https://smith.langchain.com
# !pip install langchain-teddynote
from langchain_teddynote import logging

# Enter a project name.
logging.langsmith("Structured-Output-Chain")
Start tracking LangSmith.
[Project name]
Structured-Output-Chain

Implement a process to generate a 4-option multiple choice quiz on a specific topic.

The Quiz class defines the quiz's question, difficulty, and four choices.

The ChatOpenAI instance performs natural language processing using the GPT-4o model, and the ChatPromptTemplate defines the conversational prompt for quiz generation.

Prints the generated quiz.

Last updated