a
    ”˜ëjw`  ã                   @  sª  U d Z ddlmZ ddlZddl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mZmZmZmZmZ ddlmZ dd	lmZmZ dd
lmZ ddlmZmZ ddlmZm Z m!Z!m"Z"m#Z# ddl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- erþddl.m/Z/ G dd„ dee*e+f ƒZ0G dd„ de0e*e+f ƒZ1G dd„ de2ej3ƒZ4eƒ Z5de6d< e 7¡ Z8G dd„ de0e*e+f ƒZ9ddddœdd„Z:ddddœdd „Z;d!d"dd#œd$d%„Z<dS )&z-Runnables that can be dynamically configured.é    )ÚannotationsN)Úabstractmethod)ÚAsyncIteratorÚIteratorÚSequence)Úwraps)ÚTYPE_CHECKINGÚAnyÚCallableÚOptionalÚUnionÚcast)ÚWeakValueDictionary)Ú	BaseModelÚ
ConfigDict)Úoverride)ÚRunnableÚRunnableSerializable)ÚRunnableConfigÚensure_configÚget_config_listÚget_executor_for_configÚmerge_configs)	ÚAnyConfigurableFieldÚConfigurableFieldÚConfigurableFieldMultiOptionÚConfigurableFieldSingleOptionÚConfigurableFieldSpecÚInputÚOutputÚgather_with_concurrencyÚget_unique_config_specs)ÚGraphc                	   @  sþ  e Zd ZU dZded< dZded< edd�Zee	d	d
œdd„ƒƒZ
ee	dd
œdd„ƒƒZee	dd
œdd„ƒƒZee	dd
œdd„ƒƒZe	dKdddœdd„ƒZe	dLdddœdd„ƒZe	dMdddœdd„ƒZe	dNddd d!œd"d#„ƒZdOdd$dœd%d&„ZedPdd$dœd'd(„ƒZe	dQd)ddd*d+œd,d-„ƒZe	dRd)ddd*d+œd.d/„ƒZe	dSd0d1œd2d3d	d4d5d6œd7d8„ƒZe	dTd0d1œd2d3d	d4d5d6œd9d:„ƒZe	dUd)dd4d;d+œd<d=„ƒZe	dVd)dd4d>d+œd?d@„ƒZe	dWdAdd4d;d+œdBdC„ƒZe	dXdDdd4d>d+œdEdF„ƒZe	dGddHœdIdJ„ƒZdS )YÚDynamicRunnablezÆSerializable Runnable that can be dynamically configured.

    A DynamicRunnable should be initiated using the ``configurable_fields`` or
    ``configurable_alternatives`` method of a Runnable.
    ú#RunnableSerializable[Input, Output]ÚdefaultNúOptional[RunnableConfig]ÚconfigT)Zarbitrary_types_allowedÚbool©Úreturnc                 C  s   dS )z*Return True as this class is serializable.T© ©Úclsr+   r+   úd/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/langchain_core/runnables/configurable.pyÚis_lc_serializableD   s    z"DynamicRunnable.is_lc_serializablez	list[str]c                 C  s   g d¢S )zyGet the namespace of the langchain object.

        Returns:
            ``["langchain", "schema", "runnable"]``
        )Z	langchainZschemaÚrunnabler+   r,   r+   r+   r.   Úget_lc_namespaceJ   s    z DynamicRunnable.get_lc_namespaceztype[Input]c                 C  s   | j jS ©N)r%   Ú	InputType©Úselfr+   r+   r.   r3   T   s    zDynamicRunnable.InputTypeztype[Output]c                 C  s   | j jS r2   )r%   Ú
OutputTyper4   r+   r+   r.   r6   Y   s    zDynamicRunnable.OutputTypeztype[BaseModel]©r'   r*   c                 C  s   |   |¡\}}| |¡S r2   )ÚprepareÚget_input_schema©r5   r'   r0   r+   r+   r.   r9   ^   s    z DynamicRunnable.get_input_schemac                 C  s   |   |¡\}}| |¡S r2   )r8   Úget_output_schemar:   r+   r+   r.   r;   e   s    z!DynamicRunnable.get_output_schemar"   c                 C  s   |   |¡\}}| |¡S r2   )r8   Ú	get_graphr:   r+   r+   r.   r<   l   s    zDynamicRunnable.get_graphr	   zRunnable[Input, Output])r'   Úkwargsr*   c              	   K  s(   | j f i i | j¥dtt||ƒƒi¥¤ŽS )Nr'   )Ú	__class__Ú__dict__r   r   )r5   r'   r=   r+   r+   r.   Úwith_configq   s    ÿzDynamicRunnable.with_configú.tuple[Runnable[Input, Output], RunnableConfig]c                 C  s4   | }t |tƒr&| t|j|ƒ¡\}}q|td|ƒfS )zÿPrepare the Runnable for invocation.

        Args:
            config: The configuration to use. Defaults to None.

        Returns:
            tuple[Runnable[Input, Output], RunnableConfig]: The prepared Runnable and
            configuration.
        r   )Ú
isinstancer#   Ú_preparer   r'   r   r:   r+   r+   r.   r8   |   s    
zDynamicRunnable.preparec                 C  s   d S r2   r+   )r5   r'   r+   r+   r.   rC   �   s    zDynamicRunnable._preparer   r   )Úinputr'   r=   r*   c                 K  s"   |   |¡\}}|j||fi |¤ŽS r2   )r8   Úinvoke©r5   rD   r'   r=   r0   r+   r+   r.   rE   ’   s    zDynamicRunnable.invokec                 Ë  s(   |   |¡\}}|j||fi |¤ŽI d H S r2   )r8   ÚainvokerF   r+   r+   r.   rG   ™   s    zDynamicRunnable.ainvokeF)Úreturn_exceptionszlist[Input]z5Optional[Union[RunnableConfig, list[RunnableConfig]]]zOptional[Any]úlist[Output])Úinputsr'   rH   r=   r*   c          	   	     sè   t |t|ƒƒ}‡fdd„|D ƒ}t‡fdd„|D ƒƒrZˆjj|dd„ |D ƒfdˆiˆ ¤ŽS |sbg S ddd	d
œ‡ ‡fdd„}t|ƒdkr td||d |d ƒgƒS t|d ƒ�(}tdt| |||¡ƒƒW  d   ƒ S 1 sÚ0    Y  d S )Nc                   s   g | ]}ˆ   |¡‘qS r+   ©r8   ©Ú.0Úcr4   r+   r.   Ú
<listcomp>ª   ó    z)DynamicRunnable.batch.<locals>.<listcomp>c                 3  s   | ]\}}|ˆ j u V  qd S r2   ©r%   ©rM   ÚpÚ_r4   r+   r.   Ú	<genexpr>¬   rP   z(DynamicRunnable.batch.<locals>.<genexpr>c                 S  s   g | ]\}}|‘qS r+   r+   ©rM   rT   rN   r+   r+   r.   rO   ¯   rP   rH   rA   r   úUnion[Output, Exception]©ÚpreparedÚinput_r*   c              
     sf   | \}}ˆrNz|j ||fi ˆ ¤ŽW S  tyJ } z|W  Y d }~S d }~0 0 n|j ||fi ˆ ¤ŽS d S r2   )rE   Ú	Exception©rY   rZ   Úboundr'   Úe©r=   rH   r+   r.   rE   ·   s    z%DynamicRunnable.batch.<locals>.invokeé   rI   r   )	r   ÚlenÚallr%   Úbatchr   r   ÚlistÚmap)	r5   rJ   r'   rH   r=   ÚconfigsrY   rE   Úexecutorr+   ©r=   rH   r5   r.   rc       s$    	þýüzDynamicRunnable.batchc          	      ‹  s¬   t |t|ƒƒ}‡fdd„|D ƒ}t‡fdd„|D ƒƒr`ˆjj|dd„ |D ƒfdˆiˆ ¤ŽI d H S |shg S ddd	d
œ‡ ‡fdd„}t|||ƒ}t|d  d¡g|¢R Ž I d H S )Nc                   s   g | ]}ˆ   |¡‘qS r+   rK   rL   r4   r+   r.   rO   Õ   rP   z*DynamicRunnable.abatch.<locals>.<listcomp>c                 3  s   | ]\}}|ˆ j u V  qd S r2   rQ   rR   r4   r+   r.   rU   ×   rP   z)DynamicRunnable.abatch.<locals>.<genexpr>c                 S  s   g | ]\}}|‘qS r+   r+   rV   r+   r+   r.   rO   Ú   rP   rH   rA   r   rW   rX   c              
   “  sr   | \}}ˆrTz|j ||fi ˆ ¤ŽI d H W S  tyP } z|W  Y d }~S d }~0 0 n|j ||fi ˆ ¤ŽI d H S d S r2   )rG   r[   r\   r_   r+   r.   rG   â   s    z'DynamicRunnable.abatch.<locals>.ainvoker   Zmax_concurrency)r   ra   rb   r%   Úabatchre   r    Úget)	r5   rJ   r'   rH   r=   rf   rY   rG   Zcorosr+   rh   r.   ri   Ë   s     	þýüzDynamicRunnable.abatchzIterator[Output]c                 K  s"   |   |¡\}}|j||fi |¤ŽS r2   )r8   ÚstreamrF   r+   r+   r.   rk   ò   s    zDynamicRunnable.streamzAsyncIterator[Output]c                 K s<   |   |¡\}}|j||fi |¤Ž2 z3 d H W }|V  q"6 d S r2   )r8   Úastream©r5   rD   r'   r=   r0   Úchunkr+   r+   r.   rl   ü   s     zDynamicRunnable.astreamzIterator[Input]c                 K  s"   |   |¡\}}|j||fi |¤ŽS r2   )r8   Ú	transformrF   r+   r+   r.   ro     s    zDynamicRunnable.transformzAsyncIterator[Input]c                 K s<   |   |¡\}}|j||fi |¤Ž2 z3 d H W }|V  q"6 d S r2   )r8   Ú
atransformrm   r+   r+   r.   rp     s     zDynamicRunnable.atransformÚstr)Únamer*   c                   s>   t ˆjˆƒ‰ tˆ ƒr:tˆ ƒddddœ‡ ‡‡fdd„ƒ}|S ˆ S )Nr	   )Úargsr=   r*   c                    s  |  ¡ D ]l\}}|dkrt|tƒrd|v rt|d tƒrˆ td|ƒ¡\}}i |¥d|i¥}t|ˆƒ| i |¤Ž  S qt| ƒD ]d\}}t|tƒr~d|v r~t|d tƒr~ˆ td|ƒ¡\}}t| ƒ}|||< t|ˆƒ|i |¤Ž  S q~ˆj�rˆ ¡ \}}t|ˆƒ| i |¤ŽS ˆ | i |¤ŽS )Nr'   Úconfigurabler   )	ÚitemsrB   Údictr8   r   ÚgetattrÚ	enumeraterd   r'   )rs   r=   ÚkeyÚargr0   r'   ÚidxZargsl©Úattrrr   r5   r+   r.   Úwrapper!  s4    ÿþýÿþýz,DynamicRunnable.__getattr__.<locals>.wrapper)rw   r%   Úcallabler   )r5   rr   r~   r+   r|   r.   Ú__getattr__  s    zDynamicRunnable.__getattr__)N)N)N)N)N)N)N)N)N)N)N)N)N)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r'   r   Zmodel_configÚclassmethodr   r/   r1   Úpropertyr3   r6   r9   r;   r<   r@   r8   r   rC   rE   rG   rc   ri   rk   rl   ro   rp   r€   r+   r+   r+   r.   r#   3   s€   
ÿ ÿ ÿ þ ÿ ÿ ÿ ÿ ýû* ýû& ý	 ý
 ý	 ý
r#   c                   @  sR   e Zd ZU dZded< eddœdd„ƒZedd	d
œdd„ƒZddddœdd„Z	dS )ÚRunnableConfigurableFieldsa˜  Runnable that can be dynamically configured.

    A RunnableConfigurableFields should be initiated using the
    `configurable_fields` method of a Runnable.

    Here is an example of using a RunnableConfigurableFields with LLMs:

        .. code-block:: python

            from langchain_core.prompts import PromptTemplate
            from langchain_core.runnables import ConfigurableField
            from langchain_openai import ChatOpenAI

            model = ChatOpenAI(temperature=0).configurable_fields(
                temperature=ConfigurableField(
                    id="temperature",
                    name="LLM Temperature",
                    description="The temperature of the LLM",
                )
            )
            # This creates a RunnableConfigurableFields for a chat model.

            # When invoking the created RunnableSequence, you can pass in the
            # value for your ConfigurableField's id which in this case
            # will be change in temperature

            prompt = PromptTemplate.from_template("Pick a random number above {x}")
            chain = prompt | model

            chain.invoke({"x": 0})
            chain.invoke({"x": 0}, config={"configurable": {"temperature": 0.9}})


    Here is an example of using a RunnableConfigurableFields with HubRunnables:

        .. code-block:: python

            from langchain_core.prompts import PromptTemplate
            from langchain_core.runnables import ConfigurableField
            from langchain_openai import ChatOpenAI
            from langchain.runnables.hub import HubRunnable

            prompt = HubRunnable("rlm/rag-prompt").configurable_fields(
                owner_repo_commit=ConfigurableField(
                    id="hub_commit",
                    name="Hub Commit",
                    description="The Hub commit to pull from",
                )
            )

            prompt.invoke({"question": "foo", "context": "bar"})

            # Invoking prompt with `with_config` method

            prompt.invoke(
                {"question": "foo", "context": "bar"},
                config={"configurable": {"hub_commit": "rlm/rag-prompt-llama"}},
            )

    zdict[str, AnyConfigurableField]Úfieldsúlist[ConfigurableFieldSpec]r)   c                 C  sœ   g }t | jƒj}| j ¡ D ]j\}}t|tƒrn| t|j	|j
|jpH|| j|jpV|| jt| j|ƒ|jd�¡ q| t||| jƒ¡ q| | jj¡ t|ƒS )zœGet the configuration specs for the RunnableConfigurableFields.

        Returns:
            list[ConfigurableFieldSpec]: The configuration specs.
        ©Úidrr   ÚdescriptionÚ
annotationr%   Ú	is_shared)Útyper%   Úmodel_fieldsr‰   ru   rB   r   Úappendr   rŒ   rr   r�   rŽ   rw   r�   Úmake_options_specÚextendÚconfig_specsr!   )r5   r•   Zdefault_fieldsÚ
field_nameÚspecr+   r+   r.   r•   „  s*    

øÿÿz'RunnableConfigurableFields.config_specsr   r$   ©r=   r*   c                 K  s   | j jf i i | j¥|¥¤ŽS r2   )r%   Úconfigurable_fieldsr‰   ©r5   r=   r+   r+   r.   r™   ¥  s    z.RunnableConfigurableFields.configurable_fieldsNr&   rA   r7   c                   sÀ   t ˆ ƒ‰ dd„ ˆj ¡ D ƒ‰‡fdd„ˆ  di ¡ ¡ D ƒ}‡ fdd„ˆj ¡ D ƒ}‡ fdd„ˆj ¡ D ƒ}i |¥|¥|¥}|r¶‡fdd„ˆjj ¡ D ƒ}ˆjjf i i |¥|¥¤Žˆ fS ˆjˆ fS )Nc                 S  s   i | ]\}}|j ||f“qS r+   )rŒ   )rM   ry   r—   r+   r+   r.   Ú
<dictcomp>¯  rP   z7RunnableConfigurableFields._prepare.<locals>.<dictcomp>c                   s8   i | ]0\}}|ˆ v rt ˆ | d  tƒrˆ | d |“qS )r`   r   )rB   r   ©rM   ÚkÚv)Úspecs_by_idr+   r.   r›   °  s   þrt   c                   s<   i | ]4\}}t |tƒr||jˆ  d i ¡ |j¡p4|j “qS )rt   )rB   r   Úoptionsrj   rŒ   r%   rœ   ©r'   r+   r.   r›   µ  s   
þc                   sB   i | ]:\}‰ t ˆ tƒr|‡ fd d„ˆ di ¡ ˆ jˆ j¡D ƒ“qS )c                   s   g | ]}ˆ j | ‘qS r+   )r    )rM   Úo©rž   r+   r.   rO   »  s   ÿzBRunnableConfigurableFields._prepare.<locals>.<dictcomp>.<listcomp>rt   )rB   r   rj   rŒ   r%   )rM   r�   r¡   r£   r.   r›   º  s
   
ûþc                   s&   i | ]\}}|t ˆ jƒjv r||“qS r+   )r�   r%   r‘   rœ   r4   r+   r.   r›   É  s   þ)r   r‰   ru   rj   r%   r?   r>   )r5   r'   r™   Zconfigurable_single_optionsZconfigurable_multi_optionsrt   Zinit_paramsr+   )r'   r5   rŸ   r.   rC   «  s4    
þ
þ
ûÿþý

þþz#RunnableConfigurableFields._prepare)N)
r�   r‚   rƒ   r„   r…   r‡   r•   r   r™   rC   r+   r+   r+   r.   rˆ   C  s   
=  ÿrˆ   c                   @  s   e Zd ZdZdS )ÚStrEnumzString enum.N)r�   r‚   rƒ   r„   r+   r+   r+   r.   r¤   Ö  s   r¤   zyWeakValueDictionary[Union[ConfigurableFieldSingleOption, ConfigurableFieldMultiOption, ConfigurableField], type[StrEnum]]Ú_enums_for_specc                   @  sr   e Zd ZU dZded< ded< dZded< d	ed
< eeddœdd„ƒƒZedddœdd„ƒZ	ddddœdd„Z
dS )Ú RunnableConfigurableAlternativesaè	  Runnable that can be dynamically configured.

    A RunnableConfigurableAlternatives should be initiated using the
    `configurable_alternatives` method of a Runnable or can be
    initiated directly as well.

    Here is an example of using a RunnableConfigurableAlternatives that uses
    alternative prompts to illustrate its functionality:

        .. code-block:: python

            from langchain_core.runnables import ConfigurableField
            from langchain_openai import ChatOpenAI

            # This creates a RunnableConfigurableAlternatives for Prompt Runnable
            # with two alternatives.
            prompt = PromptTemplate.from_template(
                "Tell me a joke about {topic}"
            ).configurable_alternatives(
                ConfigurableField(id="prompt"),
                default_key="joke",
                poem=PromptTemplate.from_template("Write a short poem about {topic}"),
            )

            # When invoking the created RunnableSequence, you can pass in the
            # value for your ConfigurableField's id which in this case will either be
            # `joke` or `poem`.
            chain = prompt | ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0)

            # The `with_config` method brings in the desired Prompt Runnable in your
            # Runnable Sequence.
            chain.with_config(configurable={"prompt": "poem"}).invoke(
                {"topic": "bears"}
            )


    Equivalently, you can initialize RunnableConfigurableAlternatives directly
    and use in LCEL in the same way:

        .. code-block:: python

            from langchain_core.runnables import ConfigurableField
            from langchain_core.runnables.configurable import (
                RunnableConfigurableAlternatives,
            )
            from langchain_openai import ChatOpenAI

            prompt = RunnableConfigurableAlternatives(
                which=ConfigurableField(id="prompt"),
                default=PromptTemplate.from_template("Tell me a joke about {topic}"),
                default_key="joke",
                prefix_keys=False,
                alternatives={
                    "poem": PromptTemplate.from_template(
                        "Write a short poem about {topic}"
                    )
                },
            )
            chain = prompt | ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0)
            chain.with_config(configurable={"prompt": "poem"}).invoke(
                {"topic": "bears"}
            )

    r   ÚwhichzPdict[str, Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]]Úalternativesr%   rq   Údefault_keyr(   Úprefix_keysrŠ   r)   c              	     sâ   t �f t ˆ j¡ }rnDtˆ jjp(ˆ jjdd„ g tˆ j 	¡ ƒ¢ˆ j
‘D ƒƒ}td|ƒtˆ j< W d   ƒ n1 sp0    Y  ttˆ jjˆ jjˆ jj|ˆ j
ˆ jjd�gˆ jr¾‡ fdd„ˆ jjD ƒnˆ jj ‡ fdd„ˆ j ¡ D ƒ ƒS )Nc                 s  s   | ]}||fV  qd S r2   r+   ©rM   rž   r+   r+   r.   rU   @  s   ÿz@RunnableConfigurableAlternatives.config_specs.<locals>.<genexpr>útype[StrEnum]r‹   c                   s&   g | ]}t |ˆ jj› d ˆ j› �ƒ‘qS ©ú==)Úprefix_config_specr§   rŒ   r©   )rM   Úsr4   r+   r.   rO   T  s   ÿzARunnableConfigurableAlternatives.config_specs.<locals>.<listcomp>c                   sH   g | ]@\}}t |tƒr|jD ]&}ˆ jr>t|ˆ jj› d |› �ƒn|‘qqS r­   )rB   r   r•   rª   r¯   r§   rŒ   )rM   Zalt_keyÚaltr°   r4   r+   r.   rO   \  s   

ûÿ)Ú_enums_for_spec_lockr¥   rj   r§   r¤   rr   rŒ   rd   r¨   Úkeysr©   r   r!   r   r�   r�   rª   r%   r•   ru   )r5   Z
which_enumr+   r4   r.   r•   7  s>    þþ.úÿüþï
úìþz-RunnableConfigurableAlternatives.config_specsr   r$   r˜   c                 K  s*   | j | j| jjf i |¤Ž| j| j| jd�S )N)r§   r%   r¨   r©   rª   )r>   r§   r%   r™   r¨   r©   rª   rš   r+   r+   r.   r™   h  s    ûz4RunnableConfigurableAlternatives.configurable_fieldsNr&   rA   r7   c              	     s´   t |ƒ}| di ¡ ˆ jjˆ j¡‰ˆ jrZtdi |¥d‡ ‡fdd„| di ¡ ¡ D ƒi¥ƒ}ˆˆ jkrnˆ j|fS ˆˆ j	v ržˆ j	ˆ }t
|tƒr”||fS |ƒ |fS dˆ› �}t|ƒ‚d S )Nrt   r   c                   s,   i | ]$\}}t |ˆ jj› d ˆ› d�ƒ|“qS )r®   ú/)Ú_strremoveprefixr§   rŒ   rœ   ©r5   r§   r+   r.   r›     s   ÿz=RunnableConfigurableAlternatives._prepare.<locals>.<dictcomp>zUnknown alternative: )r   rj   r§   rŒ   r©   rª   r   ru   r%   r¨   rB   r   Ú
ValueError)r5   r'   r±   Úmsgr+   r¶   r.   rC   t  s,    ÿþþþ






z)RunnableConfigurableAlternatives._prepare)N)r�   r‚   rƒ   r„   r…   r©   r‡   r   r•   r™   rC   r+   r+   r+   r.   r¦   ä  s   
A/ ÿr¦   rq   )r°   Úprefixr*   c                 C  s   |   |¡r|  |dd¡S | S )z4str.removeprefix() is only available in Python 3.9+.Ú r`   )Ú
startswithÚreplace)r°   r¹   r+   r+   r.   rµ   ‘  s    rµ   r   )r—   r¹   r*   c                 C  s4   | j s0t|› d| j› �| j| j| j| j| j d�S | S )al  Prefix the id of a ConfigurableFieldSpec.

    This is useful when a RunnableConfigurableAlternatives is used as a
    ConfigurableField of another RunnableConfigurableAlternatives.

    Args:
        spec: The ConfigurableFieldSpec to prefix.
        prefix: The prefix to add.

    Returns:
        ConfigurableFieldSpec: The prefixed ConfigurableFieldSpec.
    r´   r‹   )r�   r   rŒ   rr   r�   rŽ   r%   )r—   r¹   r+   r+   r.   r¯   –  s    øú	ör¯   zBUnion[ConfigurableFieldSingleOption, ConfigurableFieldMultiOption]zOptional[str])r—   r�   r*   c                 C  sº   t �T t | ¡ }rn4t| jp"| jdd„ t| j ¡ ƒD ƒƒ}t	d|ƒt| < W d  ƒ n1 s^0    Y  t
| tƒr”t| j| j| jp„||| j| jd�S t| j| j| jp¦|t| | j| jd�S )aZ  Make options spec.

    Make a ConfigurableFieldSpec for a ConfigurableFieldSingleOption or
    ConfigurableFieldMultiOption.

    Args:
        spec: The ConfigurableFieldSingleOption or ConfigurableFieldMultiOption.
        description: The description to use if the spec does not have one.

    Returns:
        The ConfigurableFieldSpec.
    c                 s  s   | ]}||fV  qd S r2   r+   r«   r+   r+   r.   rU   É  rP   z$make_options_spec.<locals>.<genexpr>r¬   Nr‹   )r²   r¥   rj   r¤   rr   rŒ   rd   r    r³   r   rB   r   r   r�   r%   r�   r   )r—   r�   Úenumr+   r+   r.   r“   ³  s2    
þ,
úúr“   )=r„   Ú
__future__r   r½   Ú	threadingÚabcr   Úcollections.abcr   r   r   Ú	functoolsr   Útypingr   r	   r
   r   r   r   Úweakrefr   Zpydanticr   r   Ztyping_extensionsr   Zlangchain_core.runnables.baser   r   Zlangchain_core.runnables.configr   r   r   r   r   Zlangchain_core.runnables.utilsr   r   r   r   r   r   r   r    r!   Zlangchain_core.runnables.graphr"   r#   rˆ   rq   ÚEnumr¤   r¥   r…   ÚLockr²   r¦   rµ   r¯   r“   r+   r+   r+   r.   Ú<module>   s:    ,   	û
 .