def parse(
        self, text: str, prompt: str | None = None, asdict: bool = True
    ) -> dict | str:
        """parse text with openai

        Args:
            text (str): the text to be parsed
            prompt (str | None, optional):
                the custom prompt. Built-in prompt will be used if no prompt is provided. \
                Defaults to None.
            asdict (bool, optional):
                whether to return the result as dict or not. \
                Defaults to True.

        Returns:
            dict | str: the parsed result.
        """
        if not prompt:
            prompt = DEFAULT_PROMPT

        params = self._prepare_params(text, prompt)

        with ThreadPoolExecutor(max_workers=1) as worker:
            future = worker.submit(openai.ChatCompletion.create, **params)
            resp = future.result()

            result = resp["choices"][0]["message"]["content"]

        if asdict:
            try:
                result = json.loads(result)
            except json.JSONDecodeError:
                logger.warning(f"Cannot parse result {result} as python dict.")

        logger.debug(f"the parsed result is: {result}")

        return result
parse text with openai

        Args:
            text (str): the text to be parsed
            prompt (str | None, optional):
                the custom prompt. Built-in prompt will be used if no prompt is provided.                 Defaults to None.
            asdict (bool, optional):
                whether to return the result as dict or not.                 Defaults to True.

        Returns:
            dict | str: the parsed result.
        
backend/src/module/parser/analyser/openai.py