mistralai[patch]: correct integration_test (#19774)

This commit is contained in:
Bagatur 2024-03-29 14:47:35 -07:00 committed by GitHub
parent ace7b66261
commit 2f5606a318
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -101,17 +101,15 @@ def test_chat_mistralai_llm_output_contains_token_usage() -> None:
assert "total_tokens" in token_usage assert "total_tokens" in token_usage
def test_chat_mistralai_streaming_llm_output_contains_token_usage() -> None: def test_chat_mistralai_streaming_llm_output_not_contain_token_usage() -> None:
"""Test llm_output contains model_name.""" """Mistral currently doesn't return token usage when streaming."""
chat = ChatMistralAI(max_tokens=10, streaming=True) chat = ChatMistralAI(max_tokens=10, streaming=True)
message = HumanMessage(content="Hello") message = HumanMessage(content="Hello")
llm_result = chat.generate([[message]]) llm_result = chat.generate([[message]])
assert llm_result.llm_output is not None assert llm_result.llm_output is not None
assert "token_usage" in llm_result.llm_output assert "token_usage" in llm_result.llm_output
token_usage = llm_result.llm_output["token_usage"] token_usage = llm_result.llm_output["token_usage"]
assert "prompt_tokens" in token_usage assert not token_usage
assert "completion_tokens" in token_usage
assert "total_tokens" in token_usage
def test_structured_output() -> None: def test_structured_output() -> None: