mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 13:55:41 +01:00
fix(LLM): mistral ignoring assistant messages (#1954)
Some checks failed
release-please / release-please (push) Has been cancelled
tests / setup (push) Has been cancelled
tests / ${{ matrix.quality-command }} (black) (push) Has been cancelled
tests / ${{ matrix.quality-command }} (mypy) (push) Has been cancelled
tests / ${{ matrix.quality-command }} (ruff) (push) Has been cancelled
tests / test (push) Has been cancelled
tests / all_checks_passed (push) Has been cancelled
Some checks failed
release-please / release-please (push) Has been cancelled
tests / setup (push) Has been cancelled
tests / ${{ matrix.quality-command }} (black) (push) Has been cancelled
tests / ${{ matrix.quality-command }} (mypy) (push) Has been cancelled
tests / ${{ matrix.quality-command }} (ruff) (push) Has been cancelled
tests / test (push) Has been cancelled
tests / all_checks_passed (push) Has been cancelled
* fix: mistral ignoring assistant messages * fix: typing * fix: fix tests
This commit is contained in:
parent
3b3e96ad6c
commit
c7212ac7cc
2 changed files with 27 additions and 19 deletions
|
|
@ -69,17 +69,21 @@ def test_tag_prompt_style_format_with_system_prompt():
|
|||
def test_mistral_prompt_style_format():
|
||||
prompt_style = MistralPromptStyle()
|
||||
messages = [
|
||||
ChatMessage(content="You are an AI assistant.", role=MessageRole.SYSTEM),
|
||||
ChatMessage(content="Hello, how are you doing?", role=MessageRole.USER),
|
||||
ChatMessage(content="A", role=MessageRole.SYSTEM),
|
||||
ChatMessage(content="B", role=MessageRole.USER),
|
||||
]
|
||||
|
||||
expected_prompt = (
|
||||
"<s>[INST] You are an AI assistant. [/INST]</s>"
|
||||
"[INST] Hello, how are you doing? [/INST]"
|
||||
)
|
||||
|
||||
expected_prompt = "<s>[INST] A\nB [/INST]"
|
||||
assert prompt_style.messages_to_prompt(messages) == expected_prompt
|
||||
|
||||
messages2 = [
|
||||
ChatMessage(content="A", role=MessageRole.SYSTEM),
|
||||
ChatMessage(content="B", role=MessageRole.USER),
|
||||
ChatMessage(content="C", role=MessageRole.ASSISTANT),
|
||||
ChatMessage(content="D", role=MessageRole.USER),
|
||||
]
|
||||
expected_prompt2 = "<s>[INST] A\nB [/INST] C</s><s>[INST] D [/INST]"
|
||||
assert prompt_style.messages_to_prompt(messages2) == expected_prompt2
|
||||
|
||||
|
||||
def test_chatml_prompt_style_format():
|
||||
prompt_style = ChatMLPromptStyle()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue