聊聊ShareGPT格式的微調數據集

轉載請註明住處:https://www.cnblogs.com/zhiyong-ITNote

概述

ShareGPT格式的數據集中,一般是如下格式:

[
  {
    "conversations": [
      {
        "from": "human",
        "value": "I saw a dress that I liked. It was originally priced at $200 but it's on sale for 20% off. Can you tell me how much it will cost after the discount?"
      },
      {
        "from": "function_call",
        "value": "{\"name\": \"calculate_discount\", \"arguments\": {\"original_price\": 200, \"discount_percentage\": 20}}"
      },
      {
        "from": "observation",
        "value": "{\"discounted_price\": 160}"
      },
      {
        "from": "gpt",
        "value": "The dress will cost you $160 after the 20% discount."
      }
    ],
    "system": "系統提示詞(選填)",
    "tools": "[{\"name\": \"calculate_discount\", \"description\": \"Calculate the discounted price\", \"parameters\": {\"type\": \"object\", \"properties\": {\"original_price\": {\"type\": \"number\", \"description\": \"The original price of the item\"}, \"discount_percentage\": {\"type\": \"number\", \"description\": \"The percentage of discount\"}}, \"required\": [\"original_price\", \"discount_percentage\"]}}]"
  }
]

function_call表示函數調用,什麼是函數調用?其作用是什麼?
由於大模型的數據一般都是截止於某個時間點之前的數據,不具備實時性。比如,我要問今天的天氣,正常來說,由於模型參數的侷限性,是不會知道的。但基於函數調用的功能,就解決了這個問題。
所謂的function_call,在某個程度來說,可以理解爲API調用,這個API就是一個function,提供了某種功能。
observation表示觀測結果,即function_call的執行結果。
tools表示工具,即對function_call的總結描述。

observation並不是新詞彙,對於HMM模型如果有了解的話,在其模型算法的表述中,也有着observation的相關引用。

ShareGPT格式簡單明瞭而且結構強大,不僅僅輕易的支持單輪對話、多輪對話;還引入了強大的函數調用,支持功能擴展。

擴展

function_call的設計引申出來,可以對應到業務開發中的規則引擎、腳本引擎等設計。譬如,支持在json參數的格式中,傳入JS腳本參數,做一些強大的運算等。在原有的參數格式中,引入強大的函數調用支持。
如何在聊天模型中調用函數(Function Calling)--金融大模型知識庫實戰(十六)
大模型開發 - 一文搞懂 Function Calling(函數調用)

轉載請註明住處:https://www.cnblogs.com/zhiyong-ITNote

首發於個人公衆號
image

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章