mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-30 15:57:20 +08:00
29 lines
761 B
Python
29 lines
761 B
Python
import pytest
|
|
|
|
from deepinfer.sampling_params import SamplingParams
|
|
|
|
|
|
def test_golden_tokens_conflict_with_structured_output() -> None:
|
|
with pytest.raises(ValueError, match="cannot be combined"):
|
|
SamplingParams(
|
|
golden_token_ids=[2],
|
|
so_args={
|
|
"schema_type": "regex",
|
|
"schema": "[0-9]+",
|
|
},
|
|
)
|
|
|
|
|
|
def test_golden_tokens_without_structured_output() -> None:
|
|
params = SamplingParams(golden_token_ids=[2])
|
|
assert params.golden_token_ids == [2]
|
|
|
|
|
|
def test_structured_output_without_golden_tokens() -> None:
|
|
so_args = {
|
|
"schema_type": "regex",
|
|
"schema": "[0-9]+",
|
|
}
|
|
params = SamplingParams(so_args=so_args)
|
|
assert params.so_args == so_args
|