Skip to content

Commit 01f8d88

Browse files
authored
chore: deprecate InferenceParameters (#183)
* deprecate InferenceParameters * update docs and references
1 parent 1cf5f29 commit 01f8d88

File tree

6 files changed

+6
-27
lines changed

6 files changed

+6
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ ModelConfig(
134134
alias="nv-reasoning",
135135
model="openai/gpt-oss-20b",
136136
provider="nvidia",
137-
inference_parameters=InferenceParameters(
137+
inference_parameters=ChatCompletionInferenceParams(
138138
temperature=0.3,
139139
top_p=0.9,
140140
max_tokens=4096,

docs/code_reference/models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Models
22

3-
The `models` module defines configuration objects for model-based generation. [ModelProvider](#data_designer.config.models.ModelProvider), specifies connection and authentication details for custom providers. [ModelConfig](#data_designer.config.models.ModelConfig) encapsulates model details including the model alias, identifier, and inference parameters. [InferenceParameters](#data_designer.config.models.InferenceParameters) controls model behavior through settings like `temperature`, `top_p`, and `max_tokens`, with support for both fixed values and distribution-based sampling. The module includes [ImageContext](#data_designer.config.models.ImageContext) for providing image inputs to multimodal models.
3+
The `models` module defines configuration objects for model-based generation. [ModelProvider](#data_designer.config.models.ModelProvider), specifies connection and authentication details for custom providers. [ModelConfig](#data_designer.config.models.ModelConfig) encapsulates model details including the model alias, identifier, and inference parameters. [Inference Parameters](../concepts/models/inference-parameters.md) controls model behavior through settings like `temperature`, `top_p`, and `max_tokens`, with support for both fixed values and distribution-based sampling. The module includes [ImageContext](#data_designer.config.models.ImageContext) for providing image inputs to multimodal models.
44

55
For more information on how they are used, see below:
66

docs/concepts/models/inference-parameters.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ When you create a `ModelConfig`, you can specify inference parameters to adjust
1010

1111
The `ChatCompletionInferenceParams` class controls how models generate text completions (for text, code, and structured data generation). It provides fine-grained control over generation behavior and supports both static values and dynamic distribution-based sampling.
1212

13-
!!! warning "InferenceParameters is Deprecated"
14-
The `InferenceParameters` class is deprecated and will be removed in a future version. Use `ChatCompletionInferenceParams` instead. The old `InferenceParameters` class now shows a deprecation warning when used.
15-
1613
### Fields
1714

1815
| Field | Type | Required | Description |

src/data_designer/config/exports.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
GenerationType,
2626
ImageContext,
2727
ImageFormat,
28-
InferenceParameters,
2928
ManualDistribution,
3029
ManualDistributionParams,
3130
Modality,
@@ -103,7 +102,6 @@ def get_config_exports() -> list[str]:
103102
InfoType.__name__,
104103
ImageContext.__name__,
105104
ImageFormat.__name__,
106-
InferenceParameters.__name__,
107105
JudgeScoreProfilerConfig.__name__,
108106
LLMCodeColumnConfig.__name__,
109107
LLMJudgeColumnConfig.__name__,

src/data_designer/config/models.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from abc import ABC, abstractmethod
66
from enum import Enum
77
from pathlib import Path
8-
from typing import Any, Generic, Literal, TypeVar
8+
from typing import Annotated, Any, Generic, Literal, TypeVar
99

1010
import numpy as np
1111
from pydantic import BaseModel, Field, field_validator, model_validator
@@ -357,21 +357,6 @@ def _format_value(self, key: str, value: Any) -> str:
357357
return super()._format_value(key, value)
358358

359359

360-
# Maintain backwards compatibility with a deprecation warning
361-
class InferenceParameters(ChatCompletionInferenceParams):
362-
"""
363-
Deprecated: Use ChatCompletionInferenceParams instead.
364-
This alias will be removed in a future version.
365-
"""
366-
367-
def __init__(self, *args: Any, **kwargs: Any) -> None:
368-
logger.warning(
369-
"InferenceParameters is deprecated and will be removed in a future version. "
370-
"Use ChatCompletionInferenceParams instead."
371-
)
372-
super().__init__(*args, **kwargs)
373-
374-
375360
class EmbeddingInferenceParams(BaseInferenceParams):
376361
"""Configuration for embedding generation parameters.
377362
@@ -395,7 +380,9 @@ def generate_kwargs(self) -> dict[str, float | int]:
395380
return result
396381

397382

398-
InferenceParamsT: TypeAlias = ChatCompletionInferenceParams | EmbeddingInferenceParams | InferenceParameters
383+
InferenceParamsT: TypeAlias = Annotated[
384+
ChatCompletionInferenceParams | EmbeddingInferenceParams, Field(discriminator="generation_type")
385+
]
399386

400387

401388
class ModelConfig(ConfigBase):

tests/essentials/test_init.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
GenerationType,
3131
ImageContext,
3232
ImageFormat,
33-
InferenceParameters,
3433
JudgeScoreProfilerConfig,
3534
LLMCodeColumnConfig,
3635
LLMJudgeColumnConfig,
@@ -111,7 +110,6 @@ def test_model_config_imports():
111110
"""Test model configuration imports"""
112111
assert ImageContext is not None
113112
assert ImageFormat is not None
114-
assert InferenceParameters is not None
115113
assert ChatCompletionInferenceParams is not None
116114
assert EmbeddingInferenceParams is not None
117115
assert GenerationType is not None
@@ -271,7 +269,6 @@ def test_all_contains_model_configs():
271269
"""Test __all__ contains model configuration classes"""
272270
assert "ImageContext" in __all__
273271
assert "ImageFormat" in __all__
274-
assert "InferenceParameters" in __all__
275272
assert "ChatCompletionInferenceParams" in __all__
276273
assert "EmbeddingInferenceParams" in __all__
277274
assert "GenerationType" in __all__

0 commit comments

Comments
 (0)