File size: 1,002 Bytes
c01955c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from exception import MyException
from src.Agents.utils.Abstract import Pipeline
from src.Agents.components.FormFiller import FormFiller
from src.Agents.models.FormFiller_model import FormFillerModel
import logging
import sys


class FormFillerPipeline(Pipeline):
    def __init__(self):
        self.ai_form_filler = FormFiller()

    async def initiate(self, formFields: str, userDetails: str) -> FormFillerModel:
        try:
            logging.info("Entered in the initiate FormFillerPipeline method")

            response = await self.ai_form_filler.fill_form(
                input_field=formFields,
                userDetails=userDetails
            )

            logging.info("Response generated successfully")
            logging.debug(f"Response: {response}")

            logging.info("Exiting from FormFillerPipeline method")
            return response

        except Exception as e:
            logging.error(f"Error in FormFillerPipeline: {e}")
            raise MyException(e, sys)