rename llms/OpenAI/ -> llms/openai/ (#7154)

* rename OpenAI -> openai

* fix file rename

* fix rename changes

* fix organization of openai/transcription

* fix import OA fine tuning API

* fix openai ft handler

* fix handler import
This commit is contained in:
Ishaan Jaff 2024-12-10 20:14:07 -08:00 committed by GitHub
parent e903fe6038
commit bfb6891eb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 53 additions and 59 deletions

View file

@ -1134,26 +1134,26 @@ from .llms.bedrock.embed.amazon_titan_v2_transformation import (
)
from .llms.cohere.chat.transformation import CohereChatConfig
from .llms.bedrock.embed.cohere_transformation import BedrockCohereEmbeddingConfig
from .llms.OpenAI.openai import (
from .llms.openai.openai import (
OpenAIConfig,
MistralEmbeddingConfig,
DeepInfraConfig,
)
from litellm.llms.OpenAI.completion.transformation import OpenAITextCompletionConfig
from litellm.llms.openai.completion.transformation import OpenAITextCompletionConfig
from .llms.groq.chat.transformation import GroqChatConfig
from .llms.azure_ai.chat.transformation import AzureAIStudioConfig
from .llms.mistral.mistral_chat_transformation import MistralConfig
from .llms.OpenAI.chat.o1_transformation import (
from .llms.openai.chat.o1_transformation import (
OpenAIO1Config,
)
openAIO1Config = OpenAIO1Config()
from .llms.OpenAI.chat.gpt_transformation import (
from .llms.openai.chat.gpt_transformation import (
OpenAIGPTConfig,
)
openAIGPTConfig = OpenAIGPTConfig()
from .llms.OpenAI.chat.gpt_audio_transformation import (
from .llms.openai.chat.gpt_audio_transformation import (
OpenAIGPTAudioConfig,
)

View file

@ -22,7 +22,7 @@ from litellm.utils import (
)
from ..llms.azure.assistants import AzureAssistantsAPI
from ..llms.OpenAI.openai import OpenAIAssistantsAPI
from ..llms.openai.openai import OpenAIAssistantsAPI
from ..types.llms.openai import *
from ..types.router import *
from .utils import get_optional_params_add_message

View file

@ -21,7 +21,7 @@ import httpx
import litellm
from litellm import client
from litellm.llms.azure.azure import AzureBatchesAPI
from litellm.llms.OpenAI.openai import OpenAIBatchesAPI
from litellm.llms.openai.openai import OpenAIBatchesAPI
from litellm.llms.vertex_ai_and_google_ai_studio.batches.handler import (
VertexAIBatchPrediction,
)

View file

@ -40,11 +40,11 @@ from litellm.llms.databricks.cost_calculator import (
from litellm.llms.fireworks_ai.cost_calculator import (
cost_per_token as fireworks_ai_cost_per_token,
)
from litellm.llms.OpenAI.cost_calculation import (
from litellm.llms.openai.cost_calculation import (
cost_per_second as openai_cost_per_second,
)
from litellm.llms.OpenAI.cost_calculation import cost_per_token as openai_cost_per_token
from litellm.llms.OpenAI.cost_calculation import cost_router as openai_cost_router
from litellm.llms.openai.cost_calculation import cost_per_token as openai_cost_per_token
from litellm.llms.openai.cost_calculation import cost_router as openai_cost_router
from litellm.llms.together_ai.cost_calculator import get_model_params_and_category
from litellm.llms.vertex_ai_and_google_ai_studio.image_generation.cost_calculator import (
cost_calculator as vertex_ai_image_cost_calculator,

View file

@ -16,7 +16,7 @@ import httpx
import litellm
from litellm import client, get_secret_str
from litellm.llms.files_apis.azure import AzureOpenAIFilesAPI
from litellm.llms.OpenAI.openai import FileDeleted, FileObject, OpenAIFilesAPI
from litellm.llms.openai.openai import FileDeleted, FileObject, OpenAIFilesAPI
from litellm.llms.vertex_ai_and_google_ai_studio.files.handler import (
VertexAIFilesHandler,
)

View file

@ -19,11 +19,7 @@ import httpx
import litellm
from litellm._logging import verbose_logger
from litellm.llms.fine_tuning_apis.azure import AzureOpenAIFineTuningAPI
from litellm.llms.fine_tuning_apis.openai import (
FineTuningJob,
FineTuningJobCreate,
OpenAIFineTuningAPI,
)
from litellm.llms.openai.fine_tuning.handler import OpenAIFineTuningAPI, FineTuningJob, FineTuningJobCreate
from litellm.llms.fine_tuning_apis.vertex_ai import VertexFineTuningAPI
from litellm.secret_managers.main import get_secret_str
from litellm.types.llms.openai import Hyperparameters

View file

@ -476,7 +476,7 @@ class AzureAssistantsAPI(BaseLLM):
"""
Here's an example:
```
from litellm.llms.OpenAI.openai import OpenAIAssistantsAPI, MessageData
from litellm.llms.openai.openai import OpenAIAssistantsAPI, MessageData
# create thread
message: MessageData = {"role": "user", "content": "Hey, how's it going?"}

View file

@ -18,7 +18,7 @@ from typing import Any, List, Optional, Union
import litellm
from litellm.types.llms.openai import AllMessageValues, ChatCompletionUserMessage
from ...OpenAI.chat.o1_transformation import OpenAIO1Config
from ...openai.chat.o1_transformation import OpenAIO1Config
class AzureOpenAIO1Config(OpenAIO1Config):

View file

@ -3,7 +3,7 @@ from typing import Any, Callable, List, Optional, Union
from httpx._config import Timeout
from litellm.llms.bedrock.chat.invoke_handler import MockResponseIterator
from litellm.llms.OpenAI.openai import OpenAIChatCompletion
from litellm.llms.openai.openai import OpenAIChatCompletion
from litellm.types.utils import ModelResponse
from litellm.utils import CustomStreamWrapper

View file

@ -2,7 +2,7 @@ from typing import List, Optional, Tuple
import litellm
from litellm._logging import verbose_logger
from litellm.llms.OpenAI.openai import OpenAIConfig
from litellm.llms.openai.openai import OpenAIConfig
from litellm.llms.prompt_templates.common_utils import (
_audio_or_image_in_message_content,
convert_content_list_to_str,

View file

@ -16,7 +16,7 @@ from litellm.llms.custom_httpx.http_handler import (
_get_httpx_client,
get_async_httpx_client,
)
from litellm.llms.OpenAI.openai import OpenAIChatCompletion
from litellm.llms.openai.openai import OpenAIChatCompletion
from litellm.types.llms.azure_ai import ImageEmbeddingRequest
from litellm.types.utils import Embedding, EmbeddingResponse
from litellm.utils import convert_to_model_response_object, is_base64_encoded

View file

@ -20,8 +20,8 @@ from litellm.utils import (
)
from .base import BaseLLM
from .OpenAI.completion.handler import OpenAITextCompletion
from .OpenAI.completion.transformation import OpenAITextCompletionConfig
from .openai.completion.handler import OpenAITextCompletion
from .openai.completion.transformation import OpenAITextCompletionConfig
from .prompt_templates.factory import custom_prompt, prompt_factory
openai_text_completion_config = OpenAITextCompletionConfig()

View file

@ -10,7 +10,7 @@ from pydantic import BaseModel
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import ProviderField
from ...OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
from ...prompt_templates.common_utils import (
handle_messages_with_content_list_to_str_conversion,
strip_name_from_messages,

View file

@ -12,7 +12,7 @@ from litellm.secret_managers.main import get_secret_str
from litellm.types.llms.openai import AllMessageValues, ChatCompletionAssistantMessage
from ....utils import _remove_additional_properties, _remove_strict_from_schema
from ...OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
from ...prompt_templates.common_utils import (
handle_messages_with_content_list_to_str_conversion,
)

View file

@ -3,7 +3,7 @@ from typing import Literal, Optional, Tuple, Union
from litellm.secret_managers.main import get_secret_str
from ...OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
from ..embed.fireworks_ai_transformation import FireworksAIEmbeddingConfig

View file

@ -17,7 +17,7 @@ from litellm.types.llms.openai import (
ChatCompletionToolParamFunctionChunk,
)
from ...OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
class GroqChatConfig(OpenAIGPTConfig):

View file

@ -12,7 +12,7 @@ from litellm.secret_managers.main import get_secret_str
from litellm.types.llms.openai import AllMessageValues, ChatCompletionAssistantMessage
from ....utils import _remove_additional_properties, _remove_strict_from_schema
from ...OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
class HostedVLLMChatConfig(OpenAIGPTConfig):

View file

@ -12,7 +12,7 @@ from litellm.secret_managers.main import get_secret_str
from litellm.types.llms.openai import AllMessageValues, ChatCompletionAssistantMessage
from ....utils import _remove_additional_properties, _remove_strict_from_schema
from ...OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
class LMStudioChatConfig(OpenAIGPTConfig):

View file

@ -10,7 +10,7 @@ from typing import Any, Callable, List, Optional, Union
from httpx._config import Timeout
from litellm.llms.bedrock.chat.invoke_handler import MockResponseIterator
from litellm.llms.OpenAI.openai import OpenAIChatCompletion
from litellm.llms.openai.openai import OpenAIChatCompletion
from litellm.types.utils import ModelResponse
from litellm.utils import CustomStreamWrapper

View file

@ -6,11 +6,10 @@ from openai.pagination import AsyncCursorPage
from openai.types.fine_tuning import FineTuningJob
from litellm._logging import verbose_logger
from litellm.llms.base import BaseLLM
from litellm.types.llms.openai import FineTuningJobCreate
class OpenAIFineTuningAPI(BaseLLM):
class OpenAIFineTuningAPI:
"""
OpenAI methods to support for batches
"""

View file

@ -9,8 +9,7 @@ from litellm.litellm_core_utils.audio_utils.utils import get_audio_file_name
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
from litellm.types.utils import FileTypes
from litellm.utils import TranscriptionResponse, convert_to_model_response_object
from .openai import OpenAIChatCompletion
from ..openai import OpenAIChatCompletion
class OpenAIAudioTranscription(OpenAIChatCompletion):

View file

@ -14,7 +14,7 @@ from litellm.types.llms.openai import AllMessageValues, ChatCompletionAssistantM
from litellm.types.utils import ModelResponse
from ....utils import _remove_additional_properties, _remove_strict_from_schema
from ...OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
class OpenAILikeChatConfig(OpenAIGPTConfig):

View file

@ -12,7 +12,7 @@ from litellm.secret_managers.main import get_secret_str
from litellm.types.llms.openai import AllMessageValues, ChatCompletionAssistantMessage
from ....utils import _remove_additional_properties, _remove_strict_from_schema
from ...OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
class PerplexityChatConfig(OpenAIGPTConfig):

View file

@ -10,7 +10,7 @@ from typing import Optional
from litellm import get_model_info, verbose_logger
from ..OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ..openai.chat.gpt_transformation import OpenAIGPTConfig
class TogetherAIConfig(OpenAIGPTConfig):

View file

@ -12,7 +12,7 @@ from litellm.litellm_core_utils.litellm_logging import Logging
from litellm.types.llms.openai import AllMessageValues, OpenAITextCompletionUserMessage
from litellm.utils import ModelResponse
from ...OpenAI.completion.handler import OpenAITextCompletion
from ...openai.completion.handler import OpenAITextCompletion
from .transformation import TogetherAITextCompletionConfig
together_ai_text_completion_global_config = TogetherAITextCompletionConfig()

View file

@ -8,14 +8,14 @@ Docs: https://docs.together.ai/reference/completions-1
from typing import List, Union, cast
from litellm.llms.OpenAI.completion.utils import is_tokens_or_list_of_tokens
from litellm.llms.openai.completion.utils import is_tokens_or_list_of_tokens
from litellm.types.llms.openai import (
AllMessageValues,
AllPromptValues,
OpenAITextCompletionUserMessage,
)
from ...OpenAI.completion.transformation import OpenAITextCompletionConfig
from ...openai.completion.transformation import OpenAITextCompletionConfig
class TogetherAITextCompletionConfig(OpenAITextCompletionConfig):

View file

@ -11,7 +11,7 @@ from litellm.llms.custom_httpx.http_handler import (
HTTPHandler,
get_async_httpx_client,
)
from litellm.llms.OpenAI.openai import AllMessageValues
from litellm.llms.openai.openai import AllMessageValues
from litellm.types.llms.vertex_ai import (
CachedContentListAllResponseBody,
RequestBody,

View file

@ -13,7 +13,7 @@ from litellm.llms.custom_httpx.http_handler import (
_get_httpx_client,
get_async_httpx_client,
)
from litellm.llms.OpenAI.openai import HttpxBinaryResponseContent
from litellm.llms.openai.openai import HttpxBinaryResponseContent
from litellm.llms.vertex_ai_and_google_ai_studio.gemini.vertex_and_google_ai_studio_gemini import (
VertexLLM,
)

View file

@ -91,7 +91,7 @@ class VertexAIPartnerModels(VertexBase):
from google.cloud import aiplatform
from litellm.llms.anthropic.chat import AnthropicChatCompletion
from litellm.llms.OpenAI.openai import OpenAIChatCompletion
from litellm.llms.openai.openai import OpenAIChatCompletion
from litellm.llms.openai_like.chat.handler import OpenAILikeChatHandler
from litellm.llms.text_completion_codestral import CodestralTextCompletion
from litellm.llms.vertex_ai_and_google_ai_studio.gemini.vertex_and_google_ai_studio_gemini import (

View file

@ -76,7 +76,7 @@ class VertexAIModelGardenModels(VertexBase):
from google.cloud import aiplatform
from litellm.llms.anthropic.chat import AnthropicChatCompletion
from litellm.llms.OpenAI.openai import OpenAIChatCompletion
from litellm.llms.openai.openai import OpenAIChatCompletion
from litellm.llms.openai_like.chat.handler import OpenAILikeChatHandler
from litellm.llms.text_completion_codestral import CodestralTextCompletion
from litellm.llms.vertex_ai_and_google_ai_studio.gemini.vertex_and_google_ai_studio_gemini import (

View file

@ -14,7 +14,7 @@ from litellm.secret_managers.main import get_secret_str
from litellm.types.llms.openai import AllMessageValues, ChatCompletionAssistantMessage
from ....utils import _remove_additional_properties, _remove_strict_from_schema
from ...OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
class IBMWatsonXChatConfig(OpenAIGPTConfig):

View file

@ -3,7 +3,7 @@ from typing import Literal, Optional, Tuple, Union
from litellm.secret_managers.main import get_secret_str
from ...OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
XAI_API_BASE = "https://api.x.ai/v1"

View file

@ -115,10 +115,10 @@ from .llms.databricks.chat.handler import DatabricksChatCompletion
from .llms.databricks.embed.handler import DatabricksEmbeddingHandler
from .llms.groq.chat.handler import GroqChatCompletion
from .llms.huggingface_restapi import Huggingface
from .llms.OpenAI.audio_transcriptions import OpenAIAudioTranscription
from .llms.OpenAI.chat.o1_handler import OpenAIO1ChatCompletion
from .llms.OpenAI.completion.handler import OpenAITextCompletion
from .llms.OpenAI.openai import OpenAIChatCompletion
from .llms.openai.transcriptions.handler import OpenAIAudioTranscription
from .llms.openai.chat.o1_handler import OpenAIO1ChatCompletion
from .llms.openai.completion.handler import OpenAITextCompletion
from .llms.openai.openai import OpenAIChatCompletion
from .llms.openai_like.embedding.handler import OpenAILikeEmbeddingHandler
from .llms.predibase import PredibaseChatCompletion
from .llms.prompt_templates.common_utils import get_completion_messages

View file

@ -10,7 +10,7 @@ from litellm.types.router import GenericLiteLLMParams
from ..litellm_core_utils.litellm_logging import Logging as LiteLLMLogging
from ..llms.azure.realtime.handler import AzureOpenAIRealtime
from ..llms.OpenAI.realtime.handler import OpenAIRealtime
from ..llms.openai.realtime.handler import OpenAIRealtime
from ..utils import client as wrapper_client
azure_realtime = AzureOpenAIRealtime()

View file

@ -20,15 +20,15 @@ from typing_extensions import override
import litellm
from litellm import create_thread, get_thread
from litellm.llms.OpenAI.openai import (
from litellm.llms.openai.openai import (
AssistantEventHandler,
AsyncAssistantEventHandler,
AsyncCursorPage,
MessageData,
OpenAIAssistantsAPI,
)
from litellm.llms.OpenAI.openai import OpenAIMessage as Message
from litellm.llms.OpenAI.openai import SyncCursorPage, Thread
from litellm.llms.openai.openai import OpenAIMessage as Message
from litellm.llms.openai.openai import SyncCursorPage, Thread
"""
V0 Scope:

View file

@ -60,7 +60,7 @@ async def test_audio_speech_litellm(sync_mode, model, api_base, api_key):
optional_params={},
)
from litellm.llms.OpenAI.openai import HttpxBinaryResponseContent
from litellm.llms.openai.openai import HttpxBinaryResponseContent
assert isinstance(response, HttpxBinaryResponseContent)
else:
@ -78,7 +78,7 @@ async def test_audio_speech_litellm(sync_mode, model, api_base, api_key):
optional_params={},
)
from litellm.llms.OpenAI.openai import HttpxBinaryResponseContent
from litellm.llms.openai.openai import HttpxBinaryResponseContent
assert isinstance(response, HttpxBinaryResponseContent)
@ -109,7 +109,7 @@ async def test_audio_speech_litellm_vertex(sync_mode):
from types import SimpleNamespace
from litellm.llms.OpenAI.openai import HttpxBinaryResponseContent
from litellm.llms.openai.openai import HttpxBinaryResponseContent
response.stream_to_file(speech_file_path)

View file

@ -294,7 +294,7 @@ def test_provider_config_manager():
from litellm import LITELLM_CHAT_PROVIDERS, LlmProviders
from litellm.utils import ProviderConfigManager
from litellm.llms.base_llm.transformation import BaseConfig
from litellm.llms.OpenAI.chat.gpt_transformation import OpenAIGPTConfig
from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig
for provider in LITELLM_CHAT_PROVIDERS:
if provider == LlmProviders.TRITON or provider == LlmProviders.PREDIBASE:

View file

@ -178,7 +178,7 @@ async def test_audio_speech_router(mode):
optional_params={},
)
from litellm.llms.OpenAI.openai import HttpxBinaryResponseContent
from litellm.llms.openai.openai import HttpxBinaryResponseContent
assert isinstance(response, HttpxBinaryResponseContent)