117 lines
10 KiB
JSON
117 lines
10 KiB
JSON
|
|
{
|
||
|
|
"add_bos_token": true,
|
||
|
|
"add_eos_token": false,
|
||
|
|
"added_tokens_decoder": {
|
||
|
|
"0": {
|
||
|
|
"content": "<unk>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
},
|
||
|
|
"1": {
|
||
|
|
"content": "<s>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
},
|
||
|
|
"2": {
|
||
|
|
"content": "</s>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
},
|
||
|
|
"73440": {
|
||
|
|
"content": "<|im_end|>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
},
|
||
|
|
"73441": {
|
||
|
|
"content": "<|im_start|>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
},
|
||
|
|
"73442": {
|
||
|
|
"content": "<|tool_call|>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
},
|
||
|
|
"73443": {
|
||
|
|
"content": "<|execute_start|>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
},
|
||
|
|
"73444": {
|
||
|
|
"content": "<|execute_end|>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
},
|
||
|
|
"73445": {
|
||
|
|
"content": "<|fim_prefix|>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
},
|
||
|
|
"73446": {
|
||
|
|
"content": "<|fim_middle|>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
},
|
||
|
|
"73447": {
|
||
|
|
"content": "<|fim_suffix|>",
|
||
|
|
"lstrip": false,
|
||
|
|
"normalized": false,
|
||
|
|
"rstrip": false,
|
||
|
|
"single_word": false,
|
||
|
|
"special": true
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"additional_special_tokens": [
|
||
|
|
"<|im_end|>",
|
||
|
|
"<|im_start|>",
|
||
|
|
"<|tool_call|>",
|
||
|
|
"<|execute_start|>",
|
||
|
|
"<|execute_end|>",
|
||
|
|
"<|fim_prefix|>",
|
||
|
|
"<|fim_middle|>",
|
||
|
|
"<|fim_suffix|>"
|
||
|
|
],
|
||
|
|
"bos_token": "<s>",
|
||
|
|
"clean_up_tokenization_spaces": false,
|
||
|
|
"eos_token": "<|im_end|>",
|
||
|
|
"legacy": true,
|
||
|
|
"model_max_length": 1000000000000000019884624838656,
|
||
|
|
"pad_token": null,
|
||
|
|
"sp_model_kwargs": {},
|
||
|
|
"spaces_between_special_tokens": false,
|
||
|
|
"tokenizer_class": "LlamaTokenizer",
|
||
|
|
"unk_token": "<unk>",
|
||
|
|
"use_default_system_prompt": false,
|
||
|
|
"chat_template": "{%- macro json_to_python_type(param_name, json_spec) %}\n{%- set basic_type_map = {\n 'string': 'str',\n 'number': 'float',\n 'integer': 'int',\n 'boolean': 'bool',\n 'null': 'None'\n} %}\n\n{%- if json_spec.enum %}\n {{- param_name|title }}\n{%- elif basic_type_map[json_spec.type] is defined %}\n {{- basic_type_map[json_spec.type] }}\n{%- elif json_spec.type == 'array' %}\n {{- 'List[' + json_to_python_type(param_name, json_spec['items']) + ']' }}\n{%- elif json_spec.type == 'object' %}\n {{- 'Dict[str, ' + json_to_python_type(param_name, json_spec.additionalProperties if json_spec.additionalProperties else 'Any') + ']' if not json_spec.properties else param_name|title }}\n{%- elif json_spec.type is iterable %}\n {{- 'Union[' }}\n {%- for t in json_spec.type %}\n {{- json_to_python_type(param_name, {'type': t}) }}\n {{- ', ' if not loop.last }}\n {%- endfor %}\n {{- ']' }}\n{%- else %}\n {{- 'Any' }}\n{%- endif %}\n{%- endmacro %}\n\n{%- macro object_to_fields(json_spec, field_indent) %}\n {%- set o_ns = namespace(f = caller()) %}\n {%- for param_name, param_fields in json_spec.properties|items %}\n {%- if param_fields.enum %}\n {{- '\\n\\nclass ' + param_name|title + '(Enum):\\n' }}\n {%- for enum_option in param_fields.enum %}\n {{- ' enum_' + loop.index0|string + ' = ' + enum_option|tojson + '\\n' }}\n {%- endfor %}\n {%- elif param_fields.type == 'object' and param_fields.properties %}\n {%- call object_to_fields(param_fields, ' ') %}\n {{- '\\n\\nclass ' + param_name|title + '(BaseModel):\\n' }}\n {%- endcall %}\n {%- elif param_fields.type == 'array' and param_fields['items'] and param_fields['items'].type == 'object' and param_fields['items'].properties %}\n {%- call object_to_fields(param_fields['items'], ' ') %}\n {{- '\\n\\nclass ' + param_name|title + '(BaseModel):\\n' }}\n {%- endcall %}\n {%- endif %}\n {%- set param_default = param_fields.default|tojson if param_fields.default is string else param_fields.default|string if param_fields.default is defined else 'None' %}\n {%- set o_ns.f = o_ns.f + field_indent + param_name + ': ' %}\n {%- set o_ns.f = o_ns.f + ('Optional[' + json_to_python_type(param_name, param_fields) + ']' if param_name not in json_spec.required else json_to_python_type(param_name, param_fields)) %}\n {%- if not param_fields.title and not param_fields.description and not param_fields.pattern %}\n {%- set o_ns.f = o_ns.f + (' = ' + param_default if param_name not in json_spec.required else '') %}\n {%- else %}\n {%- set o_ns.f = o_ns.f + (' = Field(...' if param_name in json_spec.required else ' = Field(' + param_default) %}\n {%- set o_ns.f = o_ns.f + (', description=' + param_fields.description|tojson if param_fields.description else '') %}\n {%- set o_ns.f = o_ns.f + (', regex=' + param_fields.pattern|tojson if param_fields.pattern else '') %}\n {%- set o_ns.f = o_ns.f + (', title=' + param_fields.title|tojson if param_fields.title else '') %}\n {%- set o_ns.f = o_ns.f + ')' %}\n {%- endif %}\n {%- set o_ns.f = o_ns.f + '\\n' %}\n {%- endfor %}\n {{- o_ns.f }}\n{%- endmacro %}\n\n{%- macro tool_parser(tools) %}\n{%- for tool in tools %}\n {%- if tool.type is not defined or tool.type == 'function' %}\n {%- if tool.function is defined %}\n {%- set tool = tool.function %}\n {%- endif %}\n {%- set tool_params = tool.parameters if tool.parameters is defined else none %}\n {%- call object_to_fields(tool_params, ' ') %}\n {{- '\\n\\ndef ' + tool.name + '(' }}\n {%- if tool_params %}\n {%- for param_name, param_fields in tool_params.properties|items %}\n {%- set param_default = param_fields.default|tojson if param_fields.default is string else param_fields.default|string if param_fields.default is defined else 'None' %}\n {{- ', ' if loop.index0 != 0 }}\n {{- param_name }}\n {{- '=' + param_default if param_name not in tool_params.required }}\n
|
||
|
|
}
|