mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-12 12:59:07 +00:00
community[patch]: fix deprecation warnings on openai subclasses (#15621)
This commit is contained in:
@@ -4,9 +4,10 @@ from __future__ import annotations
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from typing import TYPE_CHECKING, Dict, Optional, Set
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Set
|
||||
|
||||
import requests
|
||||
from langchain_core._api.deprecation import suppress_langchain_deprecation_warning
|
||||
from langchain_core.messages import BaseMessage
|
||||
from langchain_core.pydantic_v1 import Field, SecretStr, root_validator
|
||||
from langchain_core.utils import convert_to_secret_str, get_from_dict_or_env
|
||||
@@ -72,6 +73,11 @@ class ChatAnyscale(ChatOpenAI):
|
||||
available_models: Optional[Set[str]] = None
|
||||
"""Available models from Anyscale API."""
|
||||
|
||||
def __init__(self, *kwargs: Any) -> None:
|
||||
# bypass deprecation warning for ChatOpenAI
|
||||
with suppress_langchain_deprecation_warning():
|
||||
super().__init__(*kwargs)
|
||||
|
||||
@staticmethod
|
||||
def get_available_models(
|
||||
anyscale_api_key: Optional[str] = None,
|
||||
|
@@ -3,8 +3,9 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import sys
|
||||
from typing import TYPE_CHECKING, Dict, Optional, Set
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Set
|
||||
|
||||
from langchain_core._api.deprecation import suppress_langchain_deprecation_warning
|
||||
from langchain_core.messages import BaseMessage
|
||||
from langchain_core.pydantic_v1 import Field, root_validator
|
||||
from langchain_core.utils import get_from_dict_or_env
|
||||
@@ -64,6 +65,11 @@ class ChatEverlyAI(ChatOpenAI):
|
||||
available_models: Optional[Set[str]] = None
|
||||
"""Available models from EverlyAI API."""
|
||||
|
||||
def __init__(self, *kwargs: Any) -> None:
|
||||
# bypass deprecation warning for ChatOpenAI
|
||||
with suppress_langchain_deprecation_warning():
|
||||
super().__init__(*kwargs)
|
||||
|
||||
@staticmethod
|
||||
def get_available_models() -> Set[str]:
|
||||
"""Get available models from EverlyAI API."""
|
||||
|
@@ -2,6 +2,7 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from langchain_core._api.deprecation import suppress_langchain_deprecation_warning
|
||||
from langchain_core.callbacks import (
|
||||
AsyncCallbackManagerForLLMRun,
|
||||
CallbackManagerForLLMRun,
|
||||
@@ -39,6 +40,11 @@ class PromptLayerChatOpenAI(ChatOpenAI):
|
||||
pl_tags: Optional[List[str]]
|
||||
return_pl_id: Optional[bool] = False
|
||||
|
||||
def __init__(self, *kwargs: Any) -> None:
|
||||
# bypass deprecation warning for ChatOpenAI
|
||||
with suppress_langchain_deprecation_warning():
|
||||
super().__init__(*kwargs)
|
||||
|
||||
@classmethod
|
||||
def is_lc_serializable(cls) -> bool:
|
||||
return False
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import datetime
|
||||
from typing import Any, List, Optional
|
||||
|
||||
from langchain_core._api.deprecation import suppress_langchain_deprecation_warning
|
||||
from langchain_core.callbacks import (
|
||||
AsyncCallbackManagerForLLMRun,
|
||||
CallbackManagerForLLMRun,
|
||||
@@ -37,6 +38,11 @@ class PromptLayerOpenAI(OpenAI):
|
||||
pl_tags: Optional[List[str]]
|
||||
return_pl_id: Optional[bool] = False
|
||||
|
||||
def __init__(self, *kwargs: Any) -> None:
|
||||
# bypass deprecation warning for ChatOpenAI
|
||||
with suppress_langchain_deprecation_warning():
|
||||
super().__init__(*kwargs)
|
||||
|
||||
@classmethod
|
||||
def is_lc_serializable(cls) -> bool:
|
||||
return False
|
||||
|
Reference in New Issue
Block a user