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

@@ -132,6 +132,11 @@ class ChatModelTests(BaseStandardTests):
is not BaseChatModel.with_structured_output
)
@property
def supports_json_mode(self) -> bool:
"""(bool) whether the chat model supports JSON mode."""
return False
@property
def supports_image_inputs(self) -> bool:
"""(bool) whether the chat model supports image inputs, defaults to
@@ -281,7 +286,7 @@ class ChatModelUnitTests(ChatModelTests):
output.
By default, this is determined by whether the chat model's
`with_structured_output` method is overridden. If the base implementation is
``with_structured_output`` method is overridden. If the base implementation is
intended to be used, this method should be overridden.
See: https://python.langchain.com/docs/concepts/structured_outputs/
@@ -294,6 +299,21 @@ class ChatModelUnitTests(ChatModelTests):
def has_structured_output(self) -> bool:
return True
.. dropdown:: supports_json_mode
Boolean property indicating whether the chat model supports JSON mode in
``with_structured_output``.
See: https://python.langchain.com/docs/concepts/structured_outputs/#json-mode
Example:
.. code-block:: python
@property
def supports_json_mode(self) -> bool:
return True
.. dropdown:: supports_image_inputs
Boolean property indicating whether the chat model supports image inputs.