로 나뉜다. 시스템 프롬프트는 모델의 전반적인 동작을 안내하는 역할을 하며, 상대적으로 고
정적이다. 반면에 사용자 프롬프트는 더 동적이고 모델이 수행할 작업에 대한 구체적인 지시를
제공한다. 지금 예에서는
AI
어시스턴트의 역할을 설정하는 시스템 프롬프트를 전체 요청 객체
의
system
필드에 지정하고 사용자 프롬프트와 컨텍스트는
messages
배열의 한 항목으로 지
정해서 전송했다.
1.2.3
LLM
비종속적 프레임워크 사용
동일한 작업을 파이댄틱
AI
프레임워크
14
를 사용해서 수행한다면 다음과 같은 코드가 된다(필
요한
API
키가 환경 변수에 설정되어 있다고 가정한다).
15
from pydantic_ai import Agent
agent = Agent('anthropic:claude-sonnet-4-5',
system_prompt="당신은 파이썬 프로그래밍 전문가입니다.",)
result = agent.run_sync(
"주어진 정수 목록의 중앙값을 구하는 코드를 작성하세요.")
print(result.data)
이 방식의 장점은 기초 모델 제공업체를 변경하기가 매우 쉽다는 것이다.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.