--- 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" ] } } : 어제 미국에서 일어난 최신 뉴스가 알고싶어 : """, 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" ] } } : 어제 미국에서 일어난 최신 뉴스가 알고싶어 : {"name": "get_news_headlines", "arguments": '{"country": "United States"}'} ``` ### 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" ] } } : 요새 재미있는 뉴스 없나? : {"name": "get_news", "arguments": '{"date": "today"}'} : {"status": "unsupported", "message": '지원하지 않는 기능입니다.'} : """, 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" ] } } : 요새 재미있는 뉴스 없나? : {"name": "get_news", "arguments": '{"date": "today"}'} : {"status": "unsupported", "message": '지원하지 않는 기능입니다.'} : 죄송하지만, 저는 뉴스 기능을 지원하지 않습니다. 제 기능은 요리를 주문하는 것에 한정되어 있습니다. 다른 도움이 필요하시면 알려주세요. ```