aipib commited on
Commit
e03b89d
·
verified ·
1 Parent(s): 57c662c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -3
README.md CHANGED
@@ -24,7 +24,7 @@ from [mlx-community/llm-jp-3.1-1.8b-instruct4-4bit](https://huggingface.co/mlx-c
24
 
25
  ## Use with mlx
26
 
27
- You need to convert this model to mlx model with mlx-lm.convert. Otherwise, please refer to [the Llama3.2 tool-calling method](https://github.com/huggingface/huggingface-llama-recipes/tree/main/tool_calling).
28
 
29
  ```bash
30
  pip install mlx-lm
@@ -35,14 +35,14 @@ from mlx_lm import load, generate
35
 
36
  model, tokenizer = load("aipib/llm-jp-3.1-1.8b-function-calling")
37
 
38
- prompt="""<bos><start_of_turn>human
39
  あなたは関数呼び出しAIモデルです。<tools></tools> XMLタグ内に関数シグネチャが提供されます。ユーザークエリを支援するために、1つ以上の関数を呼び出すことができます。関数に代入する値について、想定しないでください。使用可能なツールは次のとおりです:<tools> [{'type': 'function', 'function': {'name': 'convert_currency', 'description': 'ある通貨から別の通貨に変換する', 'parameters': {'type': 'object', 'properties': {'amount': {'type': 'number', 'description': '変換する金額'}, 'from_currency': {'type': 'string', 'description': '変換元の通貨'}, 'to_currency': {'type': 'string', 'description': '変換後の通貨'}}, 'required': ['amount', 'from_currency', 'to_currency']}}}, {'type': 'function', 'function': {'name': 'calculate_distance', 'description': '2つの場所間の距離を計算します', 'parameters': {'type': 'object', 'properties': {'start_location': {'type': 'string', 'description': '開始場所'}, 'end_location': {'type': 'string', 'description': '終了場所'}}, 'required': ['start_location', 'end_location']}}}] </tools>各ツール呼び出しには、次の pydantic モデル JSON スキーマを使用します: {'title': 'FunctionCall', 'type': 'object', 'properties': {'arguments': {'title': 'Arguments', 'type': 'object'}, 'name': {'title': 'Name', 'type': 'string'}}, 'required': ['arguments', 'name']}関数呼び出しごとに、関数名と引数を含むJSONオブジェクトを、<tool_call></tool_call> XMLタグ内に以下のように記述して返します。
40
  <tool_call>
41
  {tool_call}
42
  </tool_call>また、関数を呼び出す前に、関数が実行する処理について時間をかけて計画を立ててください。<think>{あなたの考え}
43
 
44
  こんにちは。500米ドルをユーロに両替したいのですが、手伝っていただけますか?<end_of_turn><eos>
45
- <start_of_turn>model
46
  <think>"""
47
 
48
  response = generate(model, tokenizer, prompt=prompt, verbose=True, max_tokens=1000)
 
24
 
25
  ## Use with mlx
26
 
27
+ You need to convert this model to mlx model with mlx-lm.convert. Otherwise, please refer to [the Llama3.2 tool-calling method](https://github.com/huggingface/huggingface-llama-recipes/tree/main/tool_calling) or call this model from some Agent.
28
 
29
  ```bash
30
  pip install mlx-lm
 
35
 
36
  model, tokenizer = load("aipib/llm-jp-3.1-1.8b-function-calling")
37
 
38
+ prompt="""<bos><start_of_turn>user
39
  あなたは関数呼び出しAIモデルです。<tools></tools> XMLタグ内に関数シグネチャが提供されます。ユーザークエリを支援するために、1つ以上の関数を呼び出すことができます。関数に代入する値について、想定しないでください。使用可能なツールは次のとおりです:<tools> [{'type': 'function', 'function': {'name': 'convert_currency', 'description': 'ある通貨から別の通貨に変換する', 'parameters': {'type': 'object', 'properties': {'amount': {'type': 'number', 'description': '変換する金額'}, 'from_currency': {'type': 'string', 'description': '変換元の通貨'}, 'to_currency': {'type': 'string', 'description': '変換後の通貨'}}, 'required': ['amount', 'from_currency', 'to_currency']}}}, {'type': 'function', 'function': {'name': 'calculate_distance', 'description': '2つの場所間の距離を計算します', 'parameters': {'type': 'object', 'properties': {'start_location': {'type': 'string', 'description': '開始場所'}, 'end_location': {'type': 'string', 'description': '終了場所'}}, 'required': ['start_location', 'end_location']}}}] </tools>各ツール呼び出しには、次の pydantic モデル JSON スキーマを使用します: {'title': 'FunctionCall', 'type': 'object', 'properties': {'arguments': {'title': 'Arguments', 'type': 'object'}, 'name': {'title': 'Name', 'type': 'string'}}, 'required': ['arguments', 'name']}関数呼び出しごとに、関数名と引数を含むJSONオブジェクトを、<tool_call></tool_call> XMLタグ内に以下のように記述して返します。
40
  <tool_call>
41
  {tool_call}
42
  </tool_call>また、関数を呼び出す前に、関数が実行する処理について時間をかけて計画を立ててください。<think>{あなたの考え}
43
 
44
  こんにちは。500米ドルをユーロに両替したいのですが、手伝っていただけますか?<end_of_turn><eos>
45
+ <start_of_turn>assistant
46
  <think>"""
47
 
48
  response = generate(model, tokenizer, prompt=prompt, verbose=True, max_tokens=1000)