Update README.md
Browse files
README.md
CHANGED
|
@@ -35,13 +35,15 @@ from mlx_lm import load, generate
|
|
| 35 |
|
| 36 |
model, tokenizer = load("aipib/llm-jp-3.1-1.8b-function-calling")
|
| 37 |
|
| 38 |
-
prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
messages, add_generation_prompt=True
|
| 44 |
-
)
|
| 45 |
|
| 46 |
-
response = generate(model, tokenizer, prompt=prompt, verbose=True)
|
| 47 |
```
|
|
|
|
| 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)
|
| 49 |
```
|