mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 14:49:29 +00:00
community[patch]: Update minimax.py (#14384)
MiniMaxChat class _generate method shoud return a ChatResult object not str Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
f5d4ce840f
commit
e9caa22d47
@ -12,7 +12,7 @@ from langchain_core.messages import (
|
|||||||
BaseMessage,
|
BaseMessage,
|
||||||
HumanMessage,
|
HumanMessage,
|
||||||
)
|
)
|
||||||
from langchain_core.outputs import ChatResult
|
from langchain_core.outputs import ChatGeneration, ChatResult
|
||||||
|
|
||||||
from langchain_community.llms.minimax import MinimaxCommon
|
from langchain_community.llms.minimax import MinimaxCommon
|
||||||
from langchain_community.llms.utils import enforce_stop_tokens
|
from langchain_community.llms.utils import enforce_stop_tokens
|
||||||
@ -81,7 +81,8 @@ class MiniMaxChat(MinimaxCommon, BaseChatModel):
|
|||||||
text = self._client.post(payload)
|
text = self._client.post(payload)
|
||||||
|
|
||||||
# This is required since the stop are not enforced by the model parameters
|
# This is required since the stop are not enforced by the model parameters
|
||||||
return text if stop is None else enforce_stop_tokens(text, stop)
|
text = text if stop is None else enforce_stop_tokens(text, stop)
|
||||||
|
return ChatResult(generations=[ChatGeneration(message=AIMessage(text))])
|
||||||
|
|
||||||
async def _agenerate(
|
async def _agenerate(
|
||||||
self,
|
self,
|
||||||
|
Loading…
Reference in New Issue
Block a user