
    C'h                         d dl mZmZmZmZ d dlmZ d dlm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 d dlmZ d d	lmZ d
ZdZ G d de      Zy)    )ListOptionalSequencecast)LLM)PromptDictType)build_tools_text)BaseQuestionGeneratorSubQuestionSubQuestionList)QueryBundle)Settings)ToolMetadata)OpenAIPydanticProgramzgpt-3.5-turbo-0613a  You are a world class state of the art agent.

You have access to multiple tools, each representing a different data source or API.
Each of the tools has a name and a description, formatted as a JSON dictionary.
The keys of the dictionary are the names of the tools and the values are the descriptions.
Your purpose is to help answer a complex user question by generating a list of sub questions that can be answered by the tools.

These are the guidelines you consider when completing your task:
* Be as specific as possible
* The sub questions should be relevant to the user question
* The sub questions should be answerable by the tools provided
* You can generate multiple sub questions for each tool
* Tools must be specified by their name, not their description
* You don't need to use a tool if you don't think it's relevant

Output the list of sub questions by calling the SubQuestionList function.

## Tools
```json
{tools_str}
```

## User Question
{query_str}
c            
           e Zd Z	 ddededdfdZeeddfdede	e
   dedd fd	       Zdefd
ZdeddfdZdee   dedee   fdZdee   dedee   fdZy)OpenAIQuestionGeneratorFprogramverbosereturnNc                      || _         || _        y )N)_program_verbose)selfr   r   s      k/home/kushmeetdev/Regenta/Chatbot/venv/lib/python3.12/site-packages/llama_index/question_gen/openai/base.py__init__z OpenAIQuestionGenerator.__init__1   s    
      prompt_template_strllmc                 v    |xs t         j                  }t        j                  t        |||      } | ||      S )N)
output_clsr   r   r   )r   r   r   from_defaultsr   )clsr   r   r   r   s        r   r!   z%OpenAIQuestionGenerator.from_defaults9   s=     !X\\'55& 3	
 7G$$r   c                 2    d| j                   j                  iS )zGet prompts.question_gen_promptr   prompt)r   s    r   _get_promptsz$OpenAIQuestionGenerator._get_promptsI   s    %t}}';';<<r   promptsc                 6    d|v r|d   | j                   _        yy)zUpdate prompts.r$   Nr%   )r   r(   s     r   _update_promptsz'OpenAIQuestionGenerator._update_promptsM   s!     G+#*+@#ADMM  ,r   toolsqueryc                     t        |      }|j                  }t        t        | j	                  ||            }|j
                  S N)	query_str	tools_str)r	   r/   r   r   r   itemsr   r+   r,   r0   r/   question_lists         r   generatez OpenAIQuestionGenerator.generateR   sA     %U+	OO	T]]Y)]T
 """r   c                    K   t        |      }|j                  }t        t        | j                  j                  ||       d {         }t        |t              sJ |j                  S 7 &wr.   )r	   r/   r   r   r   acall
isinstancer1   r2   s         r   	ageneratez!OpenAIQuestionGenerator.agenerate\   sf      %U+	OO	--%%	Y%OO
 -999""" Ps   AA-A+
'A-)F)__name__
__module____qualname__r   boolr   classmethod'DEFAULT_OPENAI_SUB_QUESTION_PROMPT_TMPLstrr   r   r!   r   r'   r*   r   r   r   r   r   r4   r8    r   r   r   r   0   s      &    
	   $K!	% % c]% 	%
 
#% %=n =B~ B$ B
#l+#4?#	k	#
#l+
#4?
#	k	
#r   r   N)typingr   r   r   r   llama_index.core.llms.llmr   llama_index.core.prompts.mixinr   %llama_index.core.question_gen.promptsr	   #llama_index.core.question_gen.typesr
   r   r   llama_index.core.schemar   llama_index.core.settingsr   llama_index.core.tools.typesr   llama_index.program.openair   DEFAULT_MODEL_NAMEr>   r   r@   r   r   <module>rK      sG    1 1 ) 9 B 
 0 . 5 <) + '<6#3 6#r   