Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8dce458
docs: ko: bonus-unit1/what-is-function-calling.mdx
xhaktm Aug 5, 2025
ebb91b2
feat: gpt draft
xhaktm Aug 5, 2025
ad855ae
docs: ko: what-is-function-calling.mdx
xhaktm Aug 26, 2025
5174a7b
feat: gpt draft
xhaktm Aug 26, 2025
a59be64
fix: manual edits
xhaktm Aug 26, 2025
85534f7
Update what-is-function-calling.mdx
xhaktm00 Aug 26, 2025
0ccf9ca
Update what-is-function-calling.mdx
xhaktm00 Aug 26, 2025
e896df9
Merge branch 'main' into ko-bonus-unit1/what-is-function-calling.mdx
xhaktm00 Aug 28, 2025
3e7d67b
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
cfc4119
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
0b589fa
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
ed8bd8b
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
c1c4fe7
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
7b25315
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
ff01bad
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
52b3aa7
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
24fd538
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
2f84643
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
efadc50
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
ea78fb5
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
562b4fb
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
8b6955d
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
bc4da71
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
86093fd
Update units/ko/bonus-unit1/what-is-function-calling.mdx
xhaktm00 Oct 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion units/ko/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@
- title: Bonus Unit 1. Fine-tuning an LLM for Function-calling
sections:
- local: bonus-unit1/introduction
title: Introduction
title: Introduction
- local: bonus-unit1/what-is-function-calling
title: What is Function Calling?
76 changes: 76 additions & 0 deletions units/ko/bonus-unit1/what-is-function-calling.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# ν•¨μˆ˜ ν˜ΈμΆœμ΄λž€ 무엇인가[[what-is-function-calling]]

ν•¨μˆ˜ ν˜ΈμΆœμ€ **LLM이 ν™˜κ²½κ³Ό μƒν˜Έμž‘μš©ν•˜μ—¬ λ™μž‘μ„ μˆ˜ν–‰ν•˜λŠ” 방법**μž…λ‹ˆλ‹€. μ²˜μŒμ—λŠ” [GPT-4μ—μ„œ λ„μž…λ˜μ—ˆμœΌλ©°](https://openai.com/index/function-calling-and-other-api-updates/), 이후 λ‹€λ₯Έ λͺ¨λΈμ—μ„œλ„ κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μ—μ΄μ „νŠΈμ˜ λ„κ΅¬μ²˜λŸΌ, ν•¨μˆ˜ ν˜ΈμΆœμ€ λͺ¨λΈμ—κ²Œ **μ£Όμ–΄μ§„ ν™˜κ²½μ—μ„œ λ™μž‘μ„ μˆ˜ν–‰ν•  수 μžˆλŠ” λŠ₯λ ₯**을 μ œκ³΅ν•©λ‹ˆλ‹€. λ‹€λ§Œ ν•¨μˆ˜ 호좜 λŠ₯λ ₯은 **λͺ¨λΈ 슀슀둜 ν•™μŠ΅μ„ 톡해 μ²΄λ“ν•œ 것**μ΄λ―€λ‘œ, λ‹€λ₯Έ μ—μ΄μ „νŠΈ 기법듀보닀 **ν”„λ‘¬ν”„νŠΈμ— 덜 의쑴**ν•œλ‹€λŠ” μ μž…λ‹ˆλ‹€.

Unit 1μ—μ„œλŠ” μ—μ΄μ „νŠΈκ°€ **도ꡬλ₯Ό μ‚¬μš©ν•˜λŠ” 법을 ν•™μŠ΅ν•œ 것이 μ•„λ‹ˆλ©°**, μš°λ¦¬λŠ” κ·Έμ € 도ꡬ λͺ©λ‘μ„ λͺ¨λΈμ—κ²Œ μ œκ³΅ν–ˆκ³ , λͺ¨λΈμ΄ **이 도ꡬ듀을 ν™œμš©ν•΄ κ³„νšμ„ 생성할 κ²ƒμ΄λΌλŠ” μΌλ°˜ν™” λŠ₯λ ₯**에 μ˜μ‘΄ν–ˆμŠ΅λ‹ˆλ‹€.

μ—¬κΈ°μ„œλŠ” **ν•¨μˆ˜ ν˜ΈμΆœμ„ 톡해 μ—μ΄μ „νŠΈκ°€ 도ꡬλ₯Ό μ‚¬μš©ν•  수 μžˆλ„λ‘ λ―Έμ„Έ μ‘°μ •(ν•™μŠ΅)**ν•©λ‹ˆλ‹€.

## λͺ¨λΈμ€ λ™μž‘ μˆ˜ν–‰μ„ μ–΄λ–»κ²Œ "ν•™μŠ΅"ν• κΉŒμš”?[[how-does-the-model-learn-to-take-an-action]]

Unit 1μ—μ„œλŠ” μ—μ΄μ „νŠΈμ˜ 일반적인 μ›Œν¬ν”Œλ‘œμš°λ₯Ό μ‚΄νŽ΄λ³΄μ•˜μŠ΅λ‹ˆλ‹€. μ‚¬μš©μžκ°€ μ—μ΄μ „νŠΈμ— 도ꡬλ₯Ό μ œκ³΅ν•˜κ³  질의λ₯Ό μ „λ‹¬ν•˜λ©΄, λͺ¨λΈμ€ λ‹€μŒ 과정을 λ°˜λ³΅ν•©λ‹ˆλ‹€.

1. *사고(Think)* : λͺ©ν‘œλ₯Ό λ‹¬μ„±ν•˜κΈ° μœ„ν•΄ μ–΄λ–€ λ™μž‘μ„ μˆ˜ν–‰ν•΄μ•Ό ν• μ§€ κ³ λ―Όν•©λ‹ˆλ‹€.
2. *행동(Act)* : μ •ν•΄μ§„ ν˜•μ‹μ— 맞좰 행동을 μˆ˜ν–‰ν•˜κ³ , 일단 μžμ‹ μ˜ ν…μŠ€νŠΈ 응닡 생성은 멈μΆ₯λ‹ˆλ‹€.
3. *κ΄€μ°°(Observe)* : ν–‰λ™μ˜ μ‹€ν–‰ κ²°κ³Όλ₯Ό μ™ΈλΆ€λ‘œλΆ€ν„° λ°›μ•„μ˜΅λ‹ˆλ‹€.

APIλ₯Ό ν†΅ν•œ β€œμΌλ°˜μ μΈβ€ λŒ€ν™”λŠ” μ•„λž˜μ²˜λŸΌ μ‚¬μš©μž("user")와 μ–΄μ‹œμŠ€ν„΄νŠΈ("assistant")κ°€ λ©”μ‹œμ§€λ₯Ό μ£Όκ³ λ°›λŠ” ν˜•νƒœλ‘œ κ΅¬μ„±λ©λ‹ˆλ‹€.

```python
conversation = [
{"role": "user", "content": "I need help with my order"},
{"role": "assistant", "content": "I'd be happy to help. Could you provide your order number?"},
{"role": "user", "content": "It's ORDER-123"},
]
```

ν•¨μˆ˜ ν˜ΈμΆœμ€ 이 λŒ€ν™”μ˜ 흐름에 **μƒˆλ‘œμš΄ μ—­ν• ("role")**을 μΆ”κ°€ν•©λ‹ˆλ‹€!

1. **행동(Action)**을 μœ„ν•œ μƒˆλ‘œμš΄ μ—­ν• 
2. **κ΄€μ°°(Observation)**을 μœ„ν•œ μƒˆλ‘œμš΄ μ—­ν• 

[Mistral API](https://docs.mistral.ai/capabilities/function_calling/)λ₯Ό 예둜 λ“€λ©΄, λŒ€ν™” ꡬ쑰가 μ΄λ ‡κ²Œ λ°”λ€Œκ²Œ λ©λ‹ˆλ‹€.

```python
conversation = [
{
"role": "user",
"content": "What's the status of my transaction T1001?"
},
{
"role": "assistant",
"content": "",
"function_call": {
"name": "retrieve_payment_status",
"arguments": "{\"transaction_id\": \"T1001\"}"
}
},
{
"role": "tool",
"name": "retrieve_payment_status",
"content": "{\"status\": \"Paid\"}"
},
{
"role": "assistant",
"content": "Your transaction T1001 has been successfully paid."
}
]
```
> ...ν•˜μ§€λ§Œ 방금 ν•¨μˆ˜ ν˜ΈμΆœμ— 'μƒˆλ‘œμš΄ μ—­ν• '이 μΆ”κ°€λœλ‹€κ³  ν•˜μ§€ μ•Šμ•˜λ‚˜μš”?

**그렇기도 ν•˜κ³  μ•„λ‹ˆκΈ°λ„ ν•©λ‹ˆλ‹€.** 이 경우λ₯Ό λΉ„λ‘―ν•΄ λ§Žμ€ APIμ—μ„œ, λͺ¨λΈμ€ μˆ˜ν–‰ν•  λ™μž‘μ„ "assistant" λ©”μ‹œμ§€λ‘œ 좜λ ₯ν•©λ‹ˆλ‹€. 그러면 이후 μ±„νŒ… ν…œν”Œλ¦Ώμ΄ 이 λ©”μ‹œμ§€λ₯Ό ν•¨μˆ˜ ν˜ΈμΆœμ„ μœ„ν•œ **특수 토큰**으둜 λ³€ν™˜ν•˜μ—¬ μ²˜λ¦¬ν•©λ‹ˆλ‹€.

- `[AVAILABLE_TOOLS]` – μ‚¬μš© κ°€λŠ₯ν•œ 도ꡬ λͺ©λ‘ μ‹œμž‘
- `[/AVAILABLE_TOOLS]` – μ‚¬μš© κ°€λŠ₯ν•œ 도ꡬ λͺ©λ‘ μ’…λ£Œ
- `[TOOL_CALLS]` – 도ꡬλ₯Ό 호좜(즉, **Action** μˆ˜ν–‰)
- `[TOOL_RESULTS]` – λ™μž‘ κ²°κ³Ό(β€œObserve”)
- `[/TOOL_RESULTS]` – κ΄€μ°° μ’…λ£Œ(이제 λͺ¨λΈμ΄ μ΄μ–΄μ„œ 응닡을 생성할 수 있음)

κ°•μ˜μ—μ„œ ν•¨μˆ˜ ν˜ΈμΆœμ„ λ‹€μ‹œ λ‹€λ£° μ˜ˆμ •μ΄μ§€λ§Œ, 더 깊이 μ‚΄νŽ΄λ³΄κ³  μ‹Άλ‹€λ©΄ [Mistral의 곡식 λ¬Έμ„œ](https://docs.mistral.ai/capabilities/function_calling/)λ₯Ό μ°Έκ³ ν•˜μ„Έμš”.

---
이제 ν•¨μˆ˜ 호좜이 무엇이고 μ–΄λ–»κ²Œ μž‘λ™ν•˜λŠ”μ§€ λ°°μ› μœΌλ‹ˆ, 아직 ν•΄λ‹Ή κΈ°λŠ₯이 μ—†λŠ” λͺ¨λΈμΈ [google/gemma-2-2b-it]([google/gemma-2-2b-it](https://huggingface.co/google/gemma-2-2b-it)에 μƒˆλ‘œμš΄ 특수 토큰을 λ§λΆ™μ΄λŠ” λ°©μ‹μœΌλ‘œ ν•¨μˆ˜ 호좜 κΈ°λŠ₯을 직접 μΆ”κ°€ν•΄λ³΄κ² μŠ΅λ‹ˆλ‹€.

이λ₯Ό μœ„ν•΄μ„œλŠ” **λ¨Όμ € λ―Έμ„Έ μ‘°μ •κ³Ό LoRA**λ₯Ό 이해해야 ν•©λ‹ˆλ‹€.