mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-15 06:26:12 +00:00
core[minor]: BaseChatModel with_structured_output implementation (#22859)
This commit is contained in:
@@ -334,7 +334,7 @@ class FakeStructuredOutputModel(BaseChatModel):
|
||||
def with_structured_output(
|
||||
self, schema: Union[Dict, Type[BaseModel]], **kwargs: Any
|
||||
) -> Runnable[LanguageModelInput, Union[Dict, BaseModel]]:
|
||||
return self | (lambda x: {"foo": self.foo})
|
||||
return RunnableLambda(lambda x: {"foo": self.foo})
|
||||
|
||||
@property
|
||||
def _llm_type(self) -> str:
|
||||
@@ -388,6 +388,3 @@ def test_fallbacks_getattr_runnable_output() -> None:
|
||||
for fallback in llm_with_fallbacks_with_tools.fallbacks
|
||||
)
|
||||
assert llm_with_fallbacks_with_tools.runnable.kwargs["tools"] == []
|
||||
|
||||
with pytest.raises(NotImplementedError):
|
||||
llm_with_fallbacks.with_structured_output({})
|
||||
|
Reference in New Issue
Block a user