test_prompt_validation.py 574 Bytes
Newer Older
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3

4
5
6
7
8
9
import pytest

from vllm import LLM


def test_empty_prompt():
10
    llm = LLM(model="openai-community/gpt2", enforce_eager=True)
11
    with pytest.raises(ValueError, match='decoder prompt cannot be empty'):
12
        llm.generate([""])
13
14


Joe Runde's avatar
Joe Runde committed
15
@pytest.mark.skip_v1
16
def test_out_of_vocab_token():
17
    llm = LLM(model="openai-community/gpt2", enforce_eager=True)
18
19
    with pytest.raises(ValueError, match='out of vocabulary'):
        llm.generate({"prompt_token_ids": [999999]})