class_docstr: Test Class for OpenAI Integration Testing
class_docstr_tok: ["Test","Class","for","OpenAI","Integration","Testing"]
docstr: Wait for the predictor to be created,
  raising an exception if predictor creation fails or exceeds timeout
docstr_tok: ["Wait","for","the","predictor","to","be","created",",","raising","an","exception","if","predictor","creation","fails","or","exceeds","timeout"]
code: def wait_predictor(self, project, name, timeout=100):
      """
      Wait for the predictor to be created,
      raising an exception if predictor creation fails or exceeds timeout
      """
      for attempt in range(timeout):
          ret = self.run_sql(
              f"select * from {project}.models where name='{name}'"
          )
          if not ret.empty:
              status = ret["STATUS"][0]
              if status == "complete":
                  return
              elif status == "error":
                  raise RuntimeError(
                      "Predictor failed", ret["ERROR"][0]
                  )
          time.sleep(0.5)
      raise RuntimeError("Predictor wasn't created")
  
imports: import os
  import time
  import pytest
  import pandas
  from unittest.mock import patch
  from mindsdb_sql import parse_sql
  from mindsdb.integrations.handlers.openai_handler.openai_handler import OpenAIHandler
  from ..executor_test_base import BaseExecutorTest
label_desc: Use image node_id 3 for calling the TestOpenAI obj's underlying member method code with example usage: obj.wait_predictor(project, name, timeout) without return types