diff --git a/README.md b/README.md index 90021257..21610ba1 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ ModelConfig( alias="nv-reasoning", model="openai/gpt-oss-20b", provider="nvidia", - inference_parameters=InferenceParameters( + inference_parameters=ChatCompletionInferenceParams( temperature=0.3, top_p=0.9, max_tokens=4096, diff --git a/docs/code_reference/models.md b/docs/code_reference/models.md index 76194b4e..882e03f3 100644 --- a/docs/code_reference/models.md +++ b/docs/code_reference/models.md @@ -1,6 +1,6 @@ # Models -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. +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. For more information on how they are used, see below: diff --git a/docs/concepts/models/inference-parameters.md b/docs/concepts/models/inference-parameters.md index fc925851..4feac555 100644 --- a/docs/concepts/models/inference-parameters.md +++ b/docs/concepts/models/inference-parameters.md @@ -10,9 +10,6 @@ When you create a `ModelConfig`, you can specify inference parameters to adjust 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. -!!! warning "InferenceParameters is Deprecated" - 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. - ### Fields | Field | Type | Required | Description | diff --git a/src/data_designer/config/exports.py b/src/data_designer/config/exports.py index 3839b178..8b17e0fd 100644 --- a/src/data_designer/config/exports.py +++ b/src/data_designer/config/exports.py @@ -25,7 +25,6 @@ GenerationType, ImageContext, ImageFormat, - InferenceParameters, ManualDistribution, ManualDistributionParams, Modality, @@ -103,7 +102,6 @@ def get_config_exports() -> list[str]: InfoType.__name__, ImageContext.__name__, ImageFormat.__name__, - InferenceParameters.__name__, JudgeScoreProfilerConfig.__name__, LLMCodeColumnConfig.__name__, LLMJudgeColumnConfig.__name__, diff --git a/src/data_designer/config/models.py b/src/data_designer/config/models.py index d89c4299..13fee529 100644 --- a/src/data_designer/config/models.py +++ b/src/data_designer/config/models.py @@ -5,7 +5,7 @@ from abc import ABC, abstractmethod from enum import Enum from pathlib import Path -from typing import Any, Generic, Literal, TypeVar +from typing import Annotated, Any, Generic, Literal, TypeVar import numpy as np from pydantic import BaseModel, Field, field_validator, model_validator @@ -357,21 +357,6 @@ def _format_value(self, key: str, value: Any) -> str: return super()._format_value(key, value) -# Maintain backwards compatibility with a deprecation warning -class InferenceParameters(ChatCompletionInferenceParams): - """ - Deprecated: Use ChatCompletionInferenceParams instead. - This alias will be removed in a future version. - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - logger.warning( - "InferenceParameters is deprecated and will be removed in a future version. " - "Use ChatCompletionInferenceParams instead." - ) - super().__init__(*args, **kwargs) - - class EmbeddingInferenceParams(BaseInferenceParams): """Configuration for embedding generation parameters. @@ -395,7 +380,9 @@ def generate_kwargs(self) -> dict[str, float | int]: return result -InferenceParamsT: TypeAlias = ChatCompletionInferenceParams | EmbeddingInferenceParams | InferenceParameters +InferenceParamsT: TypeAlias = Annotated[ + ChatCompletionInferenceParams | EmbeddingInferenceParams, Field(discriminator="generation_type") +] class ModelConfig(ConfigBase): diff --git a/tests/essentials/test_init.py b/tests/essentials/test_init.py index e7b6288a..3153ac13 100644 --- a/tests/essentials/test_init.py +++ b/tests/essentials/test_init.py @@ -30,7 +30,6 @@ GenerationType, ImageContext, ImageFormat, - InferenceParameters, JudgeScoreProfilerConfig, LLMCodeColumnConfig, LLMJudgeColumnConfig, @@ -111,7 +110,6 @@ def test_model_config_imports(): """Test model configuration imports""" assert ImageContext is not None assert ImageFormat is not None - assert InferenceParameters is not None assert ChatCompletionInferenceParams is not None assert EmbeddingInferenceParams is not None assert GenerationType is not None @@ -271,7 +269,6 @@ def test_all_contains_model_configs(): """Test __all__ contains model configuration classes""" assert "ImageContext" in __all__ assert "ImageFormat" in __all__ - assert "InferenceParameters" in __all__ assert "ChatCompletionInferenceParams" in __all__ assert "EmbeddingInferenceParams" in __all__ assert "GenerationType" in __all__