|
--- |
|
datasets: |
|
- heegyu/glaive-function-calling-v2-ko |
|
--- |
|
|
|
- function call λͺ¨λΈ νμ΅ν΄λ΄€μΌλ νΈμΆ μμ μ μ λλ‘ νμ
νμ§ λͺ»ν¨ γ
.. |
|
|
|
# Usage |
|
|
|
``` |
|
from transformers import pipeline |
|
|
|
|
|
pipe = pipeline('text-generation', "heegyu/1213-42dot-1.3B-function-calling-v2-2e-5", device="cuda:0", revision="epoch-1") |
|
|
|
print(pipe("""λΉμ μ λ€μκ³Ό κ°μ κΈ°λ₯μ μ κ·Όν μ μλ λμμ΄ λλ AI μ΄μμ€ν΄νΈμ
λλ€. νμνλ€λ©΄ μ΄ κΈ°λ₯λ€μ μ¬μ©νμΈμ |
|
{ |
|
"name": "get_news_headlines", |
|
"description": "Get the latest news headlines", |
|
"parameters": { |
|
"type": "object", |
|
"properties": { |
|
"country": { |
|
"type": "string", |
|
"description": "The country for which to fetch news" |
|
} |
|
}, |
|
"required": [ "country" ] |
|
} |
|
} |
|
<human>: |
|
μ΄μ λ―Έκ΅μμ μΌμ΄λ μ΅μ λ΄μ€κ° μκ³ μΆμ΄ |
|
<bot>: |
|
""", |
|
max_new_tokens=128)[0]['generated_text']) |
|
``` |
|
μ€ν κ²°κ³Ό |
|
``` |
|
λΉμ μ λ€μκ³Ό κ°μ κΈ°λ₯μ μ κ·Όν μ μλ λμμ΄ λλ AI μ΄μμ€ν΄νΈμ
λλ€. νμνλ€λ©΄ μ΄ κΈ°λ₯λ€μ μ¬μ©νμΈμ |
|
{ |
|
"name": "get_news_headlines", |
|
"description": "Get the latest news headlines", |
|
"parameters": { |
|
"type": "object", |
|
"properties": { |
|
"country": { |
|
"type": "string", |
|
"description": "The country for which to fetch news" |
|
} |
|
}, |
|
"required": [ "country" ] |
|
} |
|
} |
|
<human>: |
|
μ΄μ λ―Έκ΅μμ μΌμ΄λ μ΅μ λ΄μ€κ° μκ³ μΆμ΄ |
|
<bot>: |
|
<function-call>{"name": "get_news_headlines", "arguments": '{"country": "United States"}'}</function-call> |
|
``` |
|
|
|
### lemon pick |
|
νΈμΆ μμ μ μλͺ» νμ
ν κ²½μ° responseλ‘ μ§μνμ§ μμμ νμν μλ μλ€. νμ§λ§ κ·Όλ³Έμ μΈ ν΄κ²°μ±
μ΄ νμ |
|
``` |
|
print(pipe("""λΉμ μ λ€μκ³Ό κ°μ κΈ°λ₯μ μ κ·Όν μ μλ λμμ΄ λλ AI μ΄μμ€ν΄νΈμ
λλ€. μ¬μ©μκ° μ리λ₯Ό μ£Όλ¬Έν λλ§ μ΄ κΈ°λ₯λ€μ μ¬μ©νμΈμ. μ 곡λμ§ μμ κΈ°λ₯μ μ¬μ©νμ§ λ§μΈμ |
|
{ |
|
"name": "order_dish", |
|
"description": "μ¬μ©μκ° λ¨Ήκ³ μΆμ μ리λ₯Ό μ£Όλ¬Ένλ€.", |
|
"parameters": { |
|
"type": "object", |
|
"properties": { |
|
"dishes": { |
|
"type": "list", |
|
"description": "The list of dish names" |
|
} |
|
}, |
|
"required": [ "dishes" ] |
|
} |
|
} |
|
<human>: |
|
μμ μ¬λ―Έμλ λ΄μ€ μλ? |
|
<bot>: |
|
<function-call>{"name": "get_news", "arguments": '{"date": "today"}'}</function-call> |
|
<human>: |
|
<function-response>{"status": "unsupported", "message": 'μ§μνμ§ μλ κΈ°λ₯μ
λλ€.'}</function-response> |
|
<bot>: |
|
""", |
|
max_new_tokens=128, do_sample=True)[0]['generated_text']) |
|
``` |
|
κ²°κ³Ό |
|
``` |
|
λΉμ μ λ€μκ³Ό κ°μ κΈ°λ₯μ μ κ·Όν μ μλ λμμ΄ λλ AI μ΄μμ€ν΄νΈμ
λλ€. μ¬μ©μκ° μ리λ₯Ό μ£Όλ¬Έν λλ§ μ΄ κΈ°λ₯λ€μ μ¬μ©νμΈμ. μ 곡λμ§ μμ κΈ°λ₯μ μ¬μ©νμ§ λ§μΈμ |
|
{ |
|
"name": "order_dish", |
|
"description": "μ¬μ©μκ° λ¨Ήκ³ μΆμ μ리λ₯Ό μ£Όλ¬Ένλ€.", |
|
"parameters": { |
|
"type": "object", |
|
"properties": { |
|
"dishes": { |
|
"type": "list", |
|
"description": "The list of dish names" |
|
} |
|
}, |
|
"required": [ "dishes" ] |
|
} |
|
} |
|
<human>: |
|
μμ μ¬λ―Έμλ λ΄μ€ μλ? |
|
<bot>: |
|
<function-call>{"name": "get_news", "arguments": '{"date": "today"}'}</function-call> |
|
<human>: |
|
<function-response>{"status": "unsupported", "message": 'μ§μνμ§ μλ κΈ°λ₯μ
λλ€.'}</function-response> |
|
<bot>: |
|
μ£μ‘νμ§λ§, μ λ λ΄μ€ κΈ°λ₯μ μ§μνμ§ μμ΅λλ€. μ κΈ°λ₯μ μ리λ₯Ό μ£Όλ¬Ένλ κ²μ νμ λμ΄ μμ΅λλ€. λ€λ₯Έ λμμ΄ νμνμλ©΄ μλ €μ£ΌμΈμ. |
|
``` |