Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default prompt and remove all unnecessary new lines between entities #223

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions custom_components/llama_conversation/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,32 @@
<current_date>
<tools>: {{ tools | to_json }}
<devices>:
{% for device in devices | selectattr('area_id', 'none'): %}
{%- for device in devices | selectattr('area_id', 'none'): %}
{{ device.entity_id }} '{{ device.name }}' = {{ device.state }}{{ ([""] + device.attributes) | join(";") }}
{% endfor %}
{% for area in devices | rejectattr('area_id', 'none') | groupby('area_name') %}
{%- endfor %}
{%- for area in devices | rejectattr('area_id', 'none') | groupby('area_name') %}
## <area>: {{ area.grouper }}
{% for device in area.list %}
{%- for device in area.list %}
{{ device.entity_id }} '{{ device.name }}' = {{ device.state }};{{ device.attributes | join(";") }}
{% endfor %}
{% endfor %}"""
{%- endfor %}
{%- endfor %}"""
DEFAULT_PROMPT_BASE_LEGACY = """<persona>
<current_date>
<services>: {{ formatted_tools }}
<devices>:
{{ formatted_devices }}"""
ICL_EXTRAS = """
{% for item in response_examples %}
{%- for item in response_examples %}
{{ item.request }}
{{ item.response }}
<functioncall> {{ item.tool | to_json }}
{% endfor %}"""
{%- endfor %}"""
ICL_NO_SYSTEM_PROMPT_EXTRAS = """
{% for item in response_examples %}
{%- for item in response_examples %}
{{ item.request }}
{{ item.response }}
<functioncall> {{ item.tool | to_json }}
{% endfor %}
{%- endfor %}
<user_instruction>:"""
DEFAULT_PROMPT = DEFAULT_PROMPT_BASE + ICL_EXTRAS
CONF_CHAT_MODEL = "huggingface_model"
Expand Down Expand Up @@ -384,4 +384,4 @@
}

INTEGRATION_VERSION = "0.3.6"
EMBEDDED_LLAMA_CPP_PYTHON_VERSION = "0.2.88"
EMBEDDED_LLAMA_CPP_PYTHON_VERSION = "0.2.88"