docstr: loads persisted embeddings model and gets embeddings on input text column(s)
docstr_tok: ["loads","persisted","embeddings","model","and","gets","embeddings","on","input","text","column","(","s",")"]
code: def predict(self, df, args=None):
      """loads persisted embeddings model and gets embeddings on input text column(s)"""
  
      args = self.model_storage.json_get("args")
  
      if (
          isinstance(df["content"].iloc[0], list)
          and len(df["content"]) == 1
      ):
          # allow user to pass in a list of strings in where clause
          # i.e where content = ['hello', 'world'] or where content = (select content from some_db.some_table)
          input_df = df.copy()
          df = pd.DataFrame(
              data={"content": input_df["content"].iloc[0]}
          )
  
      # get text columns if specified
      if isinstance(args["text_columns"], str):
          columns = [args["text_columns"]]
  
      elif isinstance(args["text_columns"], list):
          columns = args["text_columns"]
  
      elif args["text_columns"] is None:
          # assume all columns are text columns
          logger.info(
              "No text columns specified, assuming all columns are text columns"
          )
          columns = df.columns.tolist()
  
      else:
          raise ValueError(
              f"Invalid value for text_columns: {args['text_columns']}"
          )
  
      documents = df_to_documents(df=df, page_content_columns=columns)
  
      content = [doc.page_content for doc in documents]
      metadata = [doc.metadata for doc in documents]
  
      model = load_embeddings_model(args["embeddings_model_name"])
  
      embeddings = model.embed_documents(texts=content)
  
      embeddings_df = pd.DataFrame(
          data={
              "content": content,
              "embeddings": embeddings,
              "metadata": metadata,
          }
      )
  
      return embeddings_df
  
file_path: mindsdb/mindsdb/integrations/handlers/sentence_transformers_handler/sentence_transformers_handler.py
imports: from typing import Optional
  import pandas
  from mindsdb.integrations.handlers.sentence_transformers_handler.settings import Parameters
  from mindsdb.integrations.handlers.rag_handler.settings import load_embeddings_model, df_to_documents
  from mindsdb.integrations.libs.base import BaseMLEngine
  from mindsdb.utilities import log
label_desc: Use image node_id 3 for calling the SentenceTransformersHandler obj's underlying member method code with example usage: obj.predict(df, args) and returns: embeddings_df