anthropic, mistral: return model_name in response metadata (#30048)

Took a "census" of models supported by init_chat_model-- of those that
return model names in response metadata, these were the only two that
had it keyed under `"model"` instead of `"model_name"`.
This commit is contained in:
ccurme
2025-02-28 13:56:05 -05:00
committed by GitHub
parent 9e6ffd1264
commit f8ed5007ea
4 changed files with 18 additions and 1 deletions

View File

@@ -579,7 +579,11 @@ class ChatMistralAI(BaseChatModel):
)
generations.append(gen)
llm_output = {"token_usage": token_usage, "model": self.model}
llm_output = {
"token_usage": token_usage,
"model_name": self.model,
"model": self.model, # Backwards compatability
}
return ChatResult(generations=generations, llm_output=llm_output)
def _create_message_dicts(