UI/dbai_src/dbai.py [279:345]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                response = chat.send_message(
                    Part.from_function_response(
                        name=function_name,
                        response={
                            "content": api_response,
                        },
                    ),
                )
                response = response.candidates[0].content.parts[0]
                intermediate_steps.append({
                    'function_name': function_name,
                    'function_params': params,
                    'API_response': api_response,
                    'response': response
                })

            except AttributeError:
                function_calling_in_process = False

        return Response(text=response.text, interim_steps=intermediate_steps)


class NL2SQLResp:
    """NL2SQL output format class"""
    def __init__(self, nl_output, generated_sql, sql_output) -> None:
        self.nl_output = nl_output
        self.generated_sql = generated_sql
        self.sql_output = sql_output

    def __str__(self) -> str:
        return f''' NL_OUTPUT: {self.nl_output}\n
          GENERATED_SQL: {self.generated_sql}\n
          SQL_OUTPUT: {self.sql_output}'''


class DBAI_nl2sql(DBAI):  # pylint: disable=invalid-name
    """
    DBAI child class for generating NL2SQL response, instead of
    multi-turn chat-agent
    """
    def __init__(
            self,
            proj_id="proj-kous",
            dataset_id="Albertsons",
            tables_list=['camain_oracle_hcm', 'camain_ps']
            ):
        super().__init__(proj_id, dataset_id, tables_list)

        self.nl2sql_tool = Tool(
            function_declarations=[
                list_tables_func,
                get_table_metadata_func,
                sql_query_func,
            ],
        )

        self.agent = GenerativeModel("gemini-1.5-pro-001",
                                     generation_config={"temperature": 0.05},
                                     safety_settings=safety_settings,
                                     tools=[self.nl2sql_tool],
                                     )

    def get_sql(self, question):
        """
        For given question, returns the genrated SQL, result and description
        """
        chat = self.agent.start_chat()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



dbai_src/dbai.py [281:347]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                response = chat.send_message(
                    Part.from_function_response(
                        name=function_name,
                        response={
                            "content": api_response,
                        },
                    ),
                )
                response = response.candidates[0].content.parts[0]
                intermediate_steps.append({
                    'function_name': function_name,
                    'function_params': params,
                    'API_response': api_response,
                    'response': response
                })

            except AttributeError:
                function_calling_in_process = False

        return Response(text=response.text, interim_steps=intermediate_steps)


class NL2SQLResp:
    """NL2SQL output format class"""
    def __init__(self, nl_output, generated_sql, sql_output) -> None:
        self.nl_output = nl_output
        self.generated_sql = generated_sql
        self.sql_output = sql_output

    def __str__(self) -> str:
        return f''' NL_OUTPUT: {self.nl_output}\n
          GENERATED_SQL: {self.generated_sql}\n
          SQL_OUTPUT: {self.sql_output}'''


class DBAI_nl2sql(DBAI):  # pylint: disable=invalid-name
    """
    DBAI child class for generating NL2SQL response, instead of
    multi-turn chat-agent.
    """
    def __init__(
            self,
            proj_id="proj-kous",
            dataset_id="Albertsons",
            tables_list=['camain_oracle_hcm', 'camain_ps']
            ):
        super().__init__(proj_id, dataset_id, tables_list)

        self.nl2sql_tool = Tool(
            function_declarations=[
                list_tables_func,
                get_table_metadata_func,
                sql_query_func,
            ],
        )

        self.agent = GenerativeModel("gemini-1.5-pro-001",
                                     generation_config={"temperature": 0.05},
                                     safety_settings=safety_settings,
                                     tools=[self.nl2sql_tool],
                                     )

    def get_sql(self, question):
        """
        For given question, returns the genrated SQL, result and description
        """
        chat = self.agent.start_chat()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



