json mode standard test (#25497)

Co-authored-by: Chester Curme <chester.curme@gmail.com>
This commit is contained in:
Bagatur
2024-12-17 10:47:34 -08:00
committed by GitHub
parent 24bf24270d
commit e4d3ccf62f
8 changed files with 127 additions and 2 deletions

View File

@@ -29,3 +29,7 @@ class TestFireworksStandard(ChatModelIntegrationTests):
self, model: BaseChatModel, my_adder_tool: BaseTool
) -> None:
super().test_tool_message_histories_list_content(model, my_adder_tool)
@property
def supports_json_mode(self) -> bool:
return True

View File

@@ -26,6 +26,10 @@ class BaseTestGroq(ChatModelIntegrationTests):
) -> None:
super().test_tool_message_histories_list_content(model, my_adder_tool)
@property
def supports_json_mode(self) -> bool:
return True
class TestGroqLlama(BaseTestGroq):
@property
@@ -41,6 +45,10 @@ class TestGroqLlama(BaseTestGroq):
"""Value to use for tool choice when used in tests."""
return "any"
@property
def supports_json_mode(self) -> bool:
return False # Not supported in streaming mode
@pytest.mark.xfail(
reason=("Fails with 'Failed to call a function. Please adjust your prompt.'")
)

View File

@@ -19,6 +19,10 @@ class TestMistralStandard(ChatModelIntegrationTests):
def chat_model_params(self) -> dict:
return {"model": "mistral-large-latest", "temperature": 0}
@property
def supports_json_mode(self) -> bool:
return True
@property
def tool_choice_value(self) -> Optional[str]:
"""Value to use for tool choice when used in tests."""

View File

@@ -22,6 +22,10 @@ class TestChatOllama(ChatModelIntegrationTests):
def supports_image_inputs(self) -> bool:
return True
@property
def supports_json_mode(self) -> bool:
return True
@pytest.mark.xfail(
reason=(
"Fails with 'AssertionError'. Ollama does not support 'tool_choice' yet."

View File

@@ -31,6 +31,10 @@ class TestAzureOpenAIStandard(ChatModelIntegrationTests):
def supports_image_inputs(self) -> bool:
return True
@property
def supports_json_mode(self) -> bool:
return True
@pytest.mark.xfail(reason="Not yet supported.")
def test_usage_metadata_streaming(self, model: BaseChatModel) -> None:
super().test_usage_metadata_streaming(model)

View File

@@ -25,6 +25,10 @@ class TestOpenAIStandard(ChatModelIntegrationTests):
def supports_image_inputs(self) -> bool:
return True
@property
def supports_json_mode(self) -> bool:
return True
@property
def supported_usage_metadata_details(
self,