33from pydantic import Discriminator, Field, Tag
34
35▶from langchain_core.exceptions import ErrorCode, create_message
36from langchain_core.messages.ai import AIMessage, AIMessageChunk
37from langchain_core.messages.base import BaseMessage, BaseMessageChunk
· · ·
60
61 _HAS_LANGCHAIN_TEXT_SPLITTERS = True
62▶except ImportError:
63 _HAS_LANGCHAIN_TEXT_SPLITTERS = False
64
· · ·
77 f"with a 'type' attribute. Instead got type {type(v)}."
78 )
79▶ raise TypeError(msg)
80 if not isinstance(result, str):
81 msg = f"Expected 'type' to be a str, got {type(result).__name__}"
· · ·
82▶ raise TypeError(msg)
83 return result
84
· · ·
267
268 Raises:
269▶ ValueError: If an unsupported message type is encountered.
270 """
271 if isinstance(m, HumanMessage):
+ 49 more matches in this file