1- from typing import Any , AsyncGenerator , Dict , List
1+ from typing import Any , AsyncGenerator
22
33import cohere
44
@@ -42,40 +42,40 @@ def __init__(self, **kwargs: Any):
4242 ),
4343 )
4444
45- @classmethod
46- def name (cls ) -> str :
45+ @staticmethod
46+ def name () -> str :
4747 return "Bedrock"
4848
49- @classmethod
50- def env_vars (cls ) -> List [str ]:
49+ @staticmethod
50+ def env_vars () -> list [str ]:
5151 return [
5252 BEDROCK_ACCESS_KEY_ENV_VAR ,
5353 BEDROCK_SECRET_KEY_ENV_VAR ,
5454 BEDROCK_SESSION_TOKEN_ENV_VAR ,
5555 BEDROCK_REGION_NAME_ENV_VAR ,
5656 ]
5757
58- @classmethod
59- def rerank_enabled (cls ) -> bool :
58+ @staticmethod
59+ def rerank_enabled () -> bool :
6060 return False
6161
6262 @classmethod
63- def list_models (cls ) -> List [str ]:
63+ def list_models (cls ) -> list [str ]:
6464 if not cls .is_available ():
6565 return []
6666
6767 return cls .DEFAULT_MODELS
6868
69- @classmethod
70- def is_available (cls ) -> bool :
69+ @staticmethod
70+ def is_available () -> bool :
7171 return (
7272 BedrockDeployment .access_key is not None
7373 and BedrockDeployment .secret_access_key is not None
7474 and BedrockDeployment .session_token is not None
7575 and BedrockDeployment .region_name is not None
7676 )
7777
78- async def invoke_chat (self , chat_request : CohereChatRequest ) -> Any :
78+ async def invoke_chat (self , chat_request : CohereChatRequest , ** kwargs : Any ) -> Any :
7979 # bedrock accepts a subset of the chat request fields
8080 bedrock_chat_req = chat_request .model_dump (
8181 exclude = {"tools" , "conversation_id" , "model" , "stream" }, exclude_none = True
@@ -101,6 +101,6 @@ async def invoke_chat_stream(
101101 yield to_dict (event )
102102
103103 async def invoke_rerank (
104- self , query : str , documents : List [ Dict [ str , Any ]] , ctx : Context
104+ self , query : str , documents : list [ str ] , ctx : Context , ** kwargs : Any
105105 ) -> Any :
106106 return None
0 commit comments