propogate kwargs fully (#6076)

This commit is contained in:
Harrison Chase 2023-06-12 22:37:55 -07:00 committed by GitHub
parent ec1a2adf9c
commit 6ac5d80286
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,9 +190,10 @@ class BaseChatModel(BaseLanguageModel, ABC):
messages: List[BaseMessage], messages: List[BaseMessage],
stop: Optional[List[str]] = None, stop: Optional[List[str]] = None,
callbacks: Callbacks = None, callbacks: Callbacks = None,
**kwargs: Any,
) -> BaseMessage: ) -> BaseMessage:
generation = self.generate( generation = self.generate(
[messages], stop=stop, callbacks=callbacks [messages], stop=stop, callbacks=callbacks, **kwargs
).generations[0][0] ).generations[0][0]
if isinstance(generation, ChatGeneration): if isinstance(generation, ChatGeneration):
return generation.message return generation.message
@ -227,7 +228,7 @@ class BaseChatModel(BaseLanguageModel, ABC):
_stop = None _stop = None
else: else:
_stop = list(stop) _stop = list(stop)
result = self([HumanMessage(content=text)], stop=_stop) result = self([HumanMessage(content=text)], stop=_stop, **kwargs)
return result.content return result.content
def predict_messages( def predict_messages(