mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
add additional model support to chatlitellm (#10134)
--------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
de3322609e
commit
31bbe80758
@ -188,20 +188,6 @@ def _convert_message_to_dict(message: BaseMessage) -> dict:
|
|||||||
|
|
||||||
|
|
||||||
class ChatLiteLLM(BaseChatModel):
|
class ChatLiteLLM(BaseChatModel):
|
||||||
"""`LiteLLM` Chat models API.
|
|
||||||
|
|
||||||
1. The ``GOOGLE_API_KEY``` environment variable set with your API key, or
|
|
||||||
2. Pass your API key using the google_api_key kwarg to the ChatGoogle
|
|
||||||
constructor.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from langchain.chat_models import ChatGooglePalm
|
|
||||||
chat = ChatGooglePalm()
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
client: Any #: :meta private:
|
client: Any #: :meta private:
|
||||||
model: str = "gpt-3.5-turbo"
|
model: str = "gpt-3.5-turbo"
|
||||||
model_name: Optional[str] = None
|
model_name: Optional[str] = None
|
||||||
@ -302,6 +288,15 @@ class ChatLiteLLM(BaseChatModel):
|
|||||||
values["openrouter_api_key"] = get_from_dict_or_env(
|
values["openrouter_api_key"] = get_from_dict_or_env(
|
||||||
values, "openrouter_api_key", "OPENROUTER_API_KEY", default=""
|
values, "openrouter_api_key", "OPENROUTER_API_KEY", default=""
|
||||||
)
|
)
|
||||||
|
values["cohere_api_key"] = get_from_dict_or_env(
|
||||||
|
values, "cohere_api_key", "COHERE_API_KEY", default=""
|
||||||
|
)
|
||||||
|
values["huggingface_api_key"] = get_from_dict_or_env(
|
||||||
|
values, "huggingface_api_key", "HUGGINGFACE_API_KEY", default=""
|
||||||
|
)
|
||||||
|
values["together_ai_api_key"] = get_from_dict_or_env(
|
||||||
|
values, "together_ai_api_key", "TOGETHERAI_API_KEY", default=""
|
||||||
|
)
|
||||||
values["client"] = litellm
|
values["client"] = litellm
|
||||||
|
|
||||||
if values["temperature"] is not None and not 0 <= values["temperature"] <= 1:
|
if values["temperature"] is not None and not 0 <= values["temperature"] <= 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user