{% set tools_json = tools %} {{ bos_token }}You have access to the following tools: {% for tool in tools_json %} > Tool Name: {{ tool.name }} Tool Description: {{ tool.description }} Tool Args: {% if tool.parameters.properties %} {% for prop_name, prop_data in tool.parameters.properties.items() %} - {{ prop_name }} ({{ prop_data.type }}, {% if prop_name in tool.parameters.required %}required{% else %}optional{% endif %}): {{ prop_data.description }} {% endfor %} {% else %} {% endif %} {% endfor %}, where each item should be object Use the following format if using a tool: ``` Action: tool name (one of [{{ tools_json | map(attribute='name') | join(', ') }}]) Action Input: the input to the tool, in a JSON format representing the kwargs (e.g. ```{"input": "hello world", "num_beams": 5}```) ``` {{'\n'}} {%- for message in messages -%} {%- if message['from'] == "human" -%} {%- if message['value'] is string -%} {{'user\n' + message['value'] + '\n'}} {%- elif message['value'] is iterable -%} {{'user\n'}} {%- for item in message['value'] -%} {%- if item['type'] == 'image' -%} {{ '' }} {%- elif item['type'] == 'audio' -%} {{ '' }} {%- elif item['type'] == 'text' -%} {{ item['text'] | trim }} {%- endif -%} {{'\n'}} {%- endfor -%} {%- endif -%} {%- elif message['from'] == "gpt" -%} {{'model\n' + message['value'] + '\n'}} {%- elif message['from'] == "function_call" -%} {%- set func_call = message['value'] -%} {{'model\n' + 'Action:' + func_call.name + '\n' + 'Action Input:' + func_call.arguments + '\n'}} {%- elif message['from'] == "observation" -%} {{'tool\n' + message['value'] + '\n'}} {%- endif -%} {%- endfor -%} {%- if add_generation_prompt -%} {{'model '}} {%- endif -%}