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

[Bug] Cannot resolve string concatenation like '[xxx]' #1215

Open
TIIEHenry opened this issue Oct 24, 2024 · 0 comments
Open

[Bug] Cannot resolve string concatenation like '[xxx]' #1215

TIIEHenry opened this issue Oct 24, 2024 · 0 comments

Comments

@TIIEHenry
Copy link

{% if messages[0]['role'] == 'system' %}
{% set loop_messages = messages[1:] %}
{% set system_message = messages[0]['content'] %}
{% elif USE_DEFAULT_PROMPT == true and not '<>' in messages[0]['content'] %}
{% set loop_messages = messages %}
{% set system_message = 'DEFAULT_SYSTEM_MESSAGE' %}
{% else %}
{% set loop_messages = messages %}
{% set system_message = false %}
{% endif %}
{% for message in loop_messages %}
{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}
{% endif %}
{% if loop.index0 == 0 and system_message != false %}
{% set content = '<>\n' + system_message + '\n<>\n\n' + message['content'] %}
{% else %}
{% set content = message['content'] %}
{% endif %}
{% if message['role'] == 'user' %}
{{ bos_token + '[INST] ' + content.strip() + ' [/INST]' }}
{% elif message['role'] == 'system' %}
{{ '<>\n' + content.strip() + '\n<>\n\n' }}
{% elif message['role'] == 'assistant' %}
{{ ' ' + content.strip() + ' ' + eos_token }}
{% endif %}
{% endfor %}
[TemplateError{severity=FATAL, reason=SYNTAX_ERROR, item=OTHER, message='java.beans.IntrospectionException: Method not found: getChars', fieldName='bos_token + '[INST] ' + content.strip() + ' [/INST]'', lineno=21, startPosition=-1, scopeDepth=2, category=UNKNOWN, categoryErrors=null}, TemplateError{severity=FATAL, reason=SYNTAX_ERROR, item=OTHER, message='java.beans.IntrospectionException: Method not found: getChars', fieldName='' ' + content.strip() + ' ' + eos_token', lineno=25, startPosition=-1, scopeDepth=2, category=UNKNOWN, categoryErrors=null}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant