char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
3db4da56a
char/aliceai-t5-moe
1{# Alias tools -> available_tools #} 2{%- if tools and not available_tools -%} 3{%- set available_tools = tools -%} 4{%- endif -%} 5{%- if messages [ 0 ][ 'role' ] == 'system' %} 6{%- set system_message = messages [ 0 ][ 'content' ] %} 7{%- set loop_messages = messages [ 1 :] %} 8{%- else %} 9{%- set system_message = "Knowledge Cutoff Date: April 2024. Today' s Date : " + strftime_now(' %B %d , %Y ') + " . You are Granite , developed by IBM . " %} 10{%- if available_tools and documents %} 11{%- set system_message = system_message + " You are a helpful assistant with access to the following tools . When a tool is required to answer the user 's query, respond only with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request. Write the response to the user' s input by strictly aligning with the facts in the provided documents . If the information needed to answer the question is not available in the documents , inform the user that the question cannot be answered based on the available data . " %} 12{%- elif available_tools %} 13{%- set system_message = system_message + " You are a helpful assistant with access to the following tools . When a tool is required to answer the user 's query, respond only with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request." %} 14{%- elif documents %} 15{%- set system_message = system_message + " Write the response to the user' s input by strictly aligning with the facts in the provided documents . If the information needed to answer the question is not available in the documents , inform the user that the question cannot be answered based on the available data . " %} 16{%- elif thinking %} 17{%- set system_message = system_message + " You are a helpful AI assistant . 18Respond to every user query in a comprehensive and detailed way . You can write down your thoughts and reasoning process before responding . In the thought process , engage in a comprehensive cycle of analysis , summarization , exploration , reassessment , reflection , backtracing , and iteration to develop well-considered thinking process . In the response section , based on various attempts , explorations , and reflections from the thoughts section , systematically present the final solution that you deem correct . The response should summarize the thought process . Write your thoughts between < think ></ think > and write your response between < response ></ response > for each user query . " %} 19{%- else %} 20{%- set system_message = system_message + " You are a helpful AI assistant . " %} 21{%- endif %} 22{%- if ' citations ' in controls and documents %} 23{%- set system_message = system_message + ' 24Use the symbols <| start_of_cite |> and <| end_of_cite |> to indicate when a fact comes from a document in the search result , e . g <| start_of_cite |> {document_id : 1}my fact <| end_of_cite |> for a fact from document 1 . Afterwards , list all the citations with their corresponding documents in an ordered list . ' %} 25{%- endif %} 26{%- if ' hallucinations ' in controls and documents %} 27{%- set system_message = system_message + ' 28Finally , after the response is written , include a numbered list of sentences from the response with a corresponding risk value that are hallucinated and not based in the documents . ' %} 29{%- endif %} 30{%- set loop_messages = messages %} 31{%- endif %} 32{{- ' <| start_of_role |> system <| end_of_role |> ' + system_message + ' <| end_of_text |> 33' }} 34{%- if available_tools %} 35{{- ' <| start_of_role |> available_tools <| end_of_role |> ' }} 36{{- available_tools | tojson(indent=4) }} 37{{- ' <| end_of_text |> 38' }} 39{%- endif %} 40{%- if documents %} 41{%- for document in documents %} 42{{- ' <| start_of_role |> document { "document_id" : "' + document [ 'doc_id' ] | string + '" } <| end_of_role |> 43' }} 44{{- document[' text '] }} 45{{- ' <| end_of_text |> 46' }} 47{%- endfor %} 48{%- endif %} 49{%- for message in loop_messages %} 50{{- ' <| start_of_role |> ' + message[' role '] + ' <| end_of_role |> ' + message[' content '] + ' <| end_of_text |> 51' }} 52{%- if loop.last and add_generation_prompt %} 53{{- ' <| start_of_role |> assistant ' }} 54{%- if controls %} 55{{- ' ' + controls | tojson()}} 56{%- endif %} 57{{- ' <| end_of_role |> ' }} 58{% - endif %} 59{%- endfor %}