본문 바로가기
C.W.K.
Stream
Lesson 03 of 07 · published

GPT 가 tool 호출 결정하는 법 — tool_choice

~22 min · tool-decision, tool_choice

Level 0Tokenizer
0 XP0/54 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

tool_choice 는 모델이 도구를 부를지 텍스트로 답할지 정하는 방식이야. 'auto' 는 모델이 판단하고, 'required' 는 반드시 어떤 tool 이든 호출하게 하며, {type:'function',name:'X'} 는 특정 tool X 를 강제해.

'required'로 arguments 구성 능력을 따로 봐

eval 에서 routing 판단과 arguments 구성 능력을 분리해 측정할 때 유용해. tool 호출 여부는 이미 정해져 있으므로 arguments 를 얼마나 정확히 만드는지만 평가할 수 있어.

정해진 pipeline 단계에는 특정 tool 을 강제해

tool_choice={'type':'function','name':'X'} 로 tool X 를 지정할 수 있어. web_search 뒤에 summarize 를 실행하는 것처럼 순서가 고정된 pipeline 단계에 알맞아.

'auto'에서는 description 이 routing 을 좌우해

모델이 직접 고르는 경우 모호한 description 은 잘못된 호출을 만들기 쉬워. 사용 범위와 쓰지 말아야 할 예까지 구체적으로 적어.

Code

tool_choice='auto' vs 'required' vs specific·python
# Force a specific function call
response = client.responses.create(
    model="gpt-5.4",
    input="What's the weather?",
    tools=tools,
    tool_choice={"type": "function", "name": "get_weather"},
)

# Require at least one tool call
response = client.responses.create(
    model="gpt-5.4",
    input="Look up current events.",
    tools=tools,
    tool_choice="required",
)

External links

Exercise

tool 하나에 같은 prompt 를 tool_choice 'auto', 'required', 특정 name 설정으로 각각 실행해. 'auto'에서는 건너뛰지만 'required'에서는 호출되는 input 을 기록해.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.