Skip to content

Commit

Permalink
Redirect imports with deprecation warnings to avoid errors
Browse files Browse the repository at this point in the history
  • Loading branch information
plaguss committed Oct 25, 2024
1 parent 7fce770 commit 5909d78
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/distilabel/embeddings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2023-present, Argilla, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# ruff: noqa: E402

import warnings

deprecation_message = (
"Importing from 'distilabel.embeddings' is deprecated and will be removed in a version 1.7.0. "
"Import from 'distilabel.models' instead."
)

warnings.warn(deprecation_message, DeprecationWarning, stacklevel=2)

from distilabel.models.embeddings.base import Embeddings
from distilabel.models.embeddings.sentence_transformers import (
SentenceTransformerEmbeddings,
)
from distilabel.models.embeddings.vllm import vLLMEmbeddings

__all__ = [
"Embeddings",
"SentenceTransformerEmbeddings",
"vLLMEmbeddings",
]
68 changes: 68 additions & 0 deletions src/distilabel/llms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright 2023-present, Argilla, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# ruff: noqa: E402

import warnings

deprecation_message = (
"Importing from 'distilabel.llms' is deprecated and will be removed in a version 1.7.0. "
"Import from 'distilabel.models' instead."
)

warnings.warn(deprecation_message, DeprecationWarning, stacklevel=2)

from distilabel.models.llms.anthropic import AnthropicLLM
from distilabel.models.llms.anyscale import AnyscaleLLM
from distilabel.models.llms.azure import AzureOpenAILLM
from distilabel.models.llms.base import LLM, AsyncLLM
from distilabel.models.llms.cohere import CohereLLM
from distilabel.models.llms.groq import GroqLLM
from distilabel.models.llms.huggingface import InferenceEndpointsLLM, TransformersLLM
from distilabel.models.llms.litellm import LiteLLM
from distilabel.models.llms.llamacpp import LlamaCppLLM
from distilabel.models.llms.mistral import MistralLLM
from distilabel.models.llms.moa import MixtureOfAgentsLLM
from distilabel.models.llms.ollama import OllamaLLM
from distilabel.models.llms.openai import OpenAILLM
from distilabel.models.llms.together import TogetherLLM
from distilabel.models.llms.typing import GenerateOutput, HiddenState
from distilabel.models.llms.vertexai import VertexAILLM
from distilabel.models.llms.vllm import ClientvLLM, vLLM
from distilabel.models.mixins.cuda_device_placement import CudaDevicePlacementMixin

__all__ = [
"AnthropicLLM",
"AnyscaleLLM",
"AzureOpenAILLM",
"LLM",
"AsyncLLM",
"CohereLLM",
"GroqLLM",
"InferenceEndpointsLLM",
"LiteLLM",
"LlamaCppLLM",
"MistralLLM",
"CudaDevicePlacementMixin",
"MixtureOfAgentsLLM",
"OllamaLLM",
"OpenAILLM",
"TogetherLLM",
"TransformersLLM",
"GenerateOutput",
"HiddenState",
"VertexAILLM",
"ClientvLLM",
"vLLM",
]

0 comments on commit 5909d78

Please sign in to comment.