File size: 997 Bytes
a16eb78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from langchain_core.messages import BaseMessage
from typing import Any, Literal, Union
class CustomMessage(BaseMessage):
    """Message from an AI.



    AIMessage is returned from a chat model as a response to a prompt.



    This message represents the output of the model and consists of both

    the raw output as returned by the model together standardized fields

    (e.g., tool calls, usage metadata) added by the LangChain framework.

    """

    

    type: Literal["custom"] = "custom"
    """The type of the message (used for deserialization). Defaults to "custom"."""

    def __init__(

        self, content: Union[str, list[Union[str, dict]]], **kwargs: Any

    ) -> None:
        """Pass in content as positional arg.



        Args:

            content: The content of the message.

            kwargs: Additional arguments to pass to the parent class.

        """
        super().__init__(content=content, **kwargs)
CustomMessage.model_rebuild()