mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-22 11:00:37 +00:00
standard-tests[patch]: use has_structured_output
property to engage structured output tests (#29635)
Motivation: dedicated structured output features are becoming more common, such that integrations can support structured output without supporting tool calling. Here we make two changes: 1. Update the `has_structured_output` method to default to True if a model supports tool calling (in addition to defaulting to True if `with_structured_output` is overridden). 2. Update structured output tests to engage if `has_structured_output` is True.
This commit is contained in:
@@ -133,7 +133,7 @@ class ChatModelTests(BaseStandardTests):
|
||||
return (
|
||||
self.chat_model_class.with_structured_output
|
||||
is not BaseChatModel.with_structured_output
|
||||
)
|
||||
) or self.has_tool_calling
|
||||
|
||||
@property
|
||||
def structured_output_kwargs(self) -> dict:
|
||||
@@ -293,9 +293,9 @@ class ChatModelUnitTests(ChatModelTests):
|
||||
Boolean property indicating whether the chat model supports structured
|
||||
output.
|
||||
|
||||
By default, this is determined by whether the chat model's
|
||||
``with_structured_output`` method is overridden. If the base implementation is
|
||||
intended to be used, this method should be overridden.
|
||||
By default, this is determined by whether the chat model overrides the
|
||||
``with_structured_output`` or ``bind_tools`` methods. If the base
|
||||
implementations are intended to be used, this method should be overridden.
|
||||
|
||||
See: https://python.langchain.com/docs/concepts/structured_outputs/
|
||||
|
||||
|
Reference in New Issue
Block a user