def extract_questions()

in infra-as-code/modules/ingest-pipeline/cf-feedback-generator/lib.py [0:0]


    def extract_questions(self, qa_questions):
        """
        Extracts questions from a CCAI conversation based on provided criteria.

        Args:
            qa_questions (dict): Dictionary with the questions as key and the 
                                    instructions as values.
            target_tags (list): List of tags to filter questions.
            target_values (list): List of answer values to exclude.

        Returns:
            Tuple(dict, list): Dictionary of feedback structure and list of questions.
        """
        questions_feedback = dict()
        questions_list = []
        results = []

        for question in qa_questions:
            if any(tag in question['tags'] for tag in self.target_tags):
                if 'naValue' in question['answerValue']:
                    continue
                if question['answerValue']['boolValue'] not in self.target_values:
                    question_content = {
                        'conversation_id': question['conversation'],
                        'question_id': question['qaQuestion'],
                        'question': question['questionBody'],
                        'feedback': None
                    }
                    results.append(question_content)
                    questions_list.append(question['questionBody'])

        questions_feedback['results'] = results
        return questions_feedback, questions_list