<aside> ๐ก
BFCL v2๋ LLM์ ํจ์ ํธ์ถ ๋ฅ๋ ฅ์ ํ๊ฐํ๋ ๋ฒค์น๋งํฌ๋ก, ๋ค์ํ ํจ์ ํธ์ถ ์๋๋ฆฌ์ค์์ ๋ชจ๋ธ์ ์ฑ๋ฅ์ ์ธก์ ํฉ๋๋ค. ์ค์ ์ฌ์ฉ์ ์ ๊ณต ๋ฐ์ดํฐ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ๋ฉฐ, ๋จ์ผ ํจ์ ํธ์ถ, ๋ค์ค ํจ์ ์ ํ, ๋ณ๋ ฌ ํธ์ถ, ๊ด๋ จ์ฑ ํ๋จ ๋ฑ ๋ค์ํ ํ ์คํธ ์นดํ ๊ณ ๋ฆฌ๋ฅผ ํฌํจํฉ๋๋ค.

https://github.com/ShishirPatil/gorilla/tree/main/berkeley-function-call-leaderboard
def load_file(file_path: str):
result = []
with open(file_path) as f:
file = f.readlines()
for line in file:
result.append(json.loads(line))
return result
from datasets import Dataset
import copy
import json
def load_json_dataset(test_entries: List[Dict[str, Any]]):
data = {"id": [], "question": [], "function": []}
test_entries_copy = copy.deepcopy(test_entries)
for item in test_entries_copy:
data["id"].append(item["id"])
data["question"].append(item["question"])
for func in item["function"]:
func["parameters"]["properties"] = json.dumps(
func["parameters"]["properties"]
)
data["function"].append(func)
return Dataset.from_dict(data)
# Example usage
test_entries = load_file("path_to_your_file.json")
ds = load_json_dataset(test_entries)