o
    dhu                     @   sv   d dl mZ d dlmZ d dlmZmZ d dlmZm	Z	 d dl
mZ G dd deZded	ee d
e	e fddZdS )    )ChatPromptTemplate)JsonOutputParser)	BaseModelField)ListOptional)llmc                   @   s$   e Zd ZU eddZee ed< dS )IntentResultz.The decision if intent matches, otherwise null)descriptiondecisionN)__name__
__module____qualname__r   r   r   str__annotations__ r   r   V/var/www/html/aiverses.in/BackEnd/Ai_Agents/services/llm_functions/determine_intent.pyr	   
   s   
 r	   
user_input	decisionsreturnc                 C   sJ   d}t td}tjd| dj| d}|tB |B }|| |d}|S )Na  
    You are an experienced intent classifier. Based on the user's input and the available decisions, identify which decision the intent matches or not.
    If no match is found, return "null".
    
    User input: {user_input}
    Decisions: {decisions}
    )Zpydantic_objectz{format_instructions}
)template)Zformat_instructions)r   r   )r   r	   r   Zfrom_templatepartialZget_format_instructionsr   invoke)r   r   r   parserpromptchainresponser   r   r   determine_intent   s   
r   N)Zlangchain.promptsr   Zlangchain_core.output_parsersr   Zpydanticr   r   typingr   r   ZAi_Agents.models.language_modelr   r	   r   dictr   r   r   r   r   <module>   s    "