3131 from mistralai import Mistral , Messages
3232 from mistralai .models .sdkerror import SDKError
3333except ImportError :
34- Mistral = None # type: ignore
35- SDKError = None # type: ignore
34+ Mistral = None
35+ SDKError = None
3636
3737
3838class MistralAILLM (LLMInterface ):
@@ -64,7 +64,7 @@ def __init__(
6464 api_key = os .getenv ("MISTRAL_API_KEY" , "" )
6565 self .client = Mistral (api_key = api_key , ** kwargs )
6666
67- def get_messages (self , input : str , chat_history : list ) -> list [Messages ]:
67+ def get_messages (self , input : str , chat_history : Optional [ list [ Any ]] = None ) -> list [Messages ]:
6868 messages = []
6969 if self .system_instruction :
7070 messages .append (SystemMessage (content = self .system_instruction ).model_dump ())
@@ -78,7 +78,7 @@ def get_messages(self, input: str, chat_history: list) -> list[Messages]:
7878 return messages
7979
8080 def invoke (
81- self , input : str , chat_history : Optional [list [dict [ str , str ] ]] = None
81+ self , input : str , chat_history : Optional [list [Any ]] = None
8282 ) -> LLMResponse :
8383 """Sends a text input to the Mistral chat completion model
8484 and returns the response's content.
@@ -110,7 +110,7 @@ def invoke(
110110 raise LLMGenerationError (e )
111111
112112 async def ainvoke (
113- self , input : str , chat_history : Optional [list [dict [ str , str ] ]] = None
113+ self , input : str , chat_history : Optional [list [Any ]] = None
114114 ) -> LLMResponse :
115115 """Asynchronously sends a text input to the MistralAI chat
116116 completion model and returns the response's content.
0 commit comments