a
    ”˜ëjT
  ã                   @  s`   d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
 G dd„ deƒZG dd	„ d	eƒZd
S )zGeneration output schema.é    )Úannotations)ÚAnyÚLiteralÚOptional)ÚSerializable)Úmerge_dictsc                   @  sV   e Zd ZU dZded< dZded< d Zded< ed	d
œdd„ƒZedd
œdd„ƒZ	dS )Ú
Generationaš  A single text generation output.

    Generation represents the response from an
    `"old-fashioned" LLM <https://python.langchain.com/docs/concepts/text_llms/>__` that
    generates regular text (not chat messages).

    This model is used internally by chat model and will eventually
    be mapped to a more general `LLMResult` object, and then projected into
    an `AIMessage` object.

    LangChain users working with chat models will usually access information via
    `AIMessage` (returned from runnable interfaces) or `LLMResult` (available
    via callbacks). Please refer the `AIMessage` and `LLMResult` schema documentation
    for more information.
    ÚstrÚtextNzOptional[dict[str, Any]]Úgeneration_infozLiteral['Generation']ÚtypeÚbool)Úreturnc                 C  s   dS )z*Return True as this class is serializable.T© ©Úclsr   r   ú`/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/langchain_core/outputs/generation.pyÚis_lc_serializable(   s    zGeneration.is_lc_serializablez	list[str]c                 C  s   g d¢S )zwGet the namespace of the langchain object.

        Returns:
            ``["langchain", "schema", "output"]``
        )Z	langchainZschemaÚoutputr   r   r   r   r   Úget_lc_namespace-   s    zGeneration.get_lc_namespace)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r   Úclassmethodr   r   r   r   r   r   r      s   
r   c                   @  s    e Zd ZdZd d dœdd„ZdS )ÚGenerationChunkzIGeneration chunk, which can be concatenated with other Generation chunks.)Úotherr   c                 C  s^   t |tƒr8t| jpi |jpi ƒ}t| j|j |p2dd�S dt| ƒ› dt|ƒ› d�}t|ƒ‚dS )a*  Concatenate two ``GenerationChunk``s.

        Args:
            other: Another ``GenerationChunk`` to concatenate with.

        Raises:
            TypeError: If other is not a ``GenerationChunk``.

        Returns:
            A new ``GenerationChunk`` concatenated from self and other.
        N)r
   r   z$unsupported operand type(s) for +: 'z' and 'ú')Ú
isinstancer   r   r   r
   r   Ú	TypeError)Úselfr   r   Úmsgr   r   r   Ú__add__:   s    
þ
þzGenerationChunk.__add__N)r   r   r   r   r#   r   r   r   r   r   7   s   r   N)r   Ú
__future__r   Útypingr   r   r   Zlangchain_core.loadr   Zlangchain_core.utils._merger   r   r   r   r   r   r   Ú<module>   s   ,