-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
from .bedrock_chat import BedrockChat | ||
from .chat_anthropic import ChatAnthropic | ||
from .chat_ollama import ChatOllama | ||
from .chat_openai import ChatOpenAI | ||
|
||
__all__ = [ | ||
"BedrockChat", | ||
"ChatAnthropic", | ||
"ChatOllama", | ||
"ChatOpenAI", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from typing import Optional | ||
from langchain_core.utils.utils import convert_to_secret_str | ||
from langchain_anthropic import ChatAnthropic as LangchainChatAnthropic | ||
|
||
from ..core import BaseChatModel | ||
|
||
|
||
class ChatAnthropic(LangchainChatAnthropic, BaseChatModel): | ||
"""A chat model based on Anthropic's language generation technology.""" | ||
|
||
def __init__( | ||
self, | ||
*, | ||
api_key: Optional[str], | ||
model_name: str = "claude-3-opus-20240229", | ||
temperature: float = 1.0, | ||
**kwargs, | ||
) -> None: | ||
""" | ||
Initialize the ChatAnthropic instance. | ||
Args: | ||
api_key (str or None): The API key for accessing the Anthropic API. | ||
model_name (str): The name of the language model to use. | ||
temperature (float): The temperature parameter controlling the randomness of the generated text. | ||
**kwargs: Additional keyword arguments to be passed to the base class constructor. | ||
""" | ||
super().__init__( | ||
anthropic_api_key=convert_to_secret_str(api_key) if api_key else None, | ||
model_name=model_name, | ||
temperature=temperature, | ||
**kwargs, | ||
) | ||
|
||
def supports_functions(self) -> bool: | ||
""" | ||
Check if the model supports additional functions beyond basic chat. | ||
Returns: | ||
bool: True if the model supports additional functions, False otherwise. | ||
""" | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters