class_docstr: Transformer that makes a request for OpenAI Completion API for each executor.
  
     See OpenAI API Doc: https://platform.openai.com/docs/api-reference/completions/create for reference
  
     ====================== ======================
     Input Annotation types Output Annotation type
     ====================== ======================
     ``DOCUMENT``           ``DOCUMENT``
     ====================== ======================
  
     Parameters
     ----------
     model
         ID of the OpenAI model to use
     suffix
          The suffix that comes after a completion of inserted text
     maxTokens
          The maximum number of tokens to generate in the completion.
     temperature
          What sampling temperature to use, between 0 and 2
     topP
          An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass
     numberOfCompletions
          How many completions to generate for each prompt.
     logprobs
          Include the log probabilities on the logprobs most likely tokens, as well the chosen tokens.
     echo
         Echo back the prompt in addition to the completion
     stop
        Up to 4 sequences where the API will stop generating further tokens.
     presencePenalty
        Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
     frequencyPenalty
        Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
     bestOf
        Generates best_of completions server-side and returns the `best` (the one with the highest log probability per token).
     logitBias
        Modify the likelihood of specified tokens appearing in the completion.
     user
        A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
  
     Examples
     --------
     >>> import sparknlp
     >>> from sparknlp.base import *
     >>> from sparknlp.annotator import *
     >>> from sparknlp.common import *
     >>> from pyspark.ml import Pipeline
  
     >>> documentAssembler = DocumentAssembler() \
     ...     .setInputCol("text") \
     ...     .setOutputCol("document")
     >>> openai_completion = OpenAICompletion() \
     ...     .setInputCols("document") \
     ...     .setOutputCol("completion") \
     ...     .setModel("text-davinci-003") \
     ...     .setMaxTokens(100)
     >>> pipeline = Pipeline().setStages([
     ...     documentAssembler,
     ...     openai_completion
     ... ])
     >>> empty_df = spark.createDataFrame([[""]], ["text"])
     >>> sample_text= [["Generate a restaurant review."], ["Write a review for a local eatery."], ["Create a JSON with a review of a dining experience."]]
     >>> sample_df = spark.createDataFrame(sample_text).toDF("text")
     >>> sample_df.show()
     +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
     |completion                                                                                                                                                                                                                                                                                        |
     +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
     |[{document, 0, 258, 
  
  I had the pleasure of dining at La Fiorita recently, and it was a truly delightful experience! The menu boasted a wonderful selection of classic Italian dishes, all exquisitely prepared and presented. The service staff was friendly and attentive and really, {}, []}]|
     |[{document, 0, 227, 
  
  I recently visited Barbecue Joe's for dinner and it was amazing! The menu had so many items to choose from including pulled pork, smoked turkey, brisket, pork ribs, and sandwiches. I opted for the pulled pork sandwich and let, {}, []}]                               |
     |[{document, 0, 172, 
  
  { 
     "review": { 
        "overallRating": 4, 
        "reviewBody": "I enjoyed my meal at this restaurant. The food was flavourful, well-prepared and beautifully presented., {}, []}]                                                                                   |
     +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
     
class_docstr_tok: ["Transformer","that","makes","a","request","for","OpenAI","Completion","API","for","each","executor",".","See","OpenAI","API","Doc",":","https",":","\/\/platform.openai.com\/docs\/api-reference\/completions\/create","for","reference","======================","======================","Input","Annotation","types","Output","Annotation","type","======================","======================","``","DOCUMENT","``","``","DOCUMENT","``","======================","======================","Parameters","--","--","--","--","--","model","ID","of","the","OpenAI","model","to","use","suffix","The","suffix","that","comes","after","a","completion","of","inserted","text","maxTokens","The","maximum","number","of","tokens","to","generate","in","the","completion",".","temperature","What","sampling","temperature","to","use",",","between","0","and","2","topP","An","alternative","to","sampling","with","temperature",",","called","nucleus","sampling",",","where","the","model","considers","the","results","of","the","tokens","with","top_p","probability","mass","numberOfCompletions","How","many","completions","to","generate","for","each","prompt",".","logprobs","Include","the","log","probabilities","on","the","logprobs","most","likely","tokens",",","as","well","the","chosen","tokens",".","echo","Echo","back","the","prompt","in","addition","to","the","completion","stop","Up","to","4","sequences","where","the","API","will","stop","generating","further","tokens",".","presencePenalty","Number","between","-2.0","and","2.0",".","Positive","values","penalize","new","tokens","based","on","whether","they","appear","in","the","text","so","far",",","increasing","the","model","'s","likelihood","to","talk","about","new","topics",".","frequencyPenalty","Number","between","-2.0","and","2.0",".","Positive","values","penalize","new","tokens","based","on","their","existing","frequency","in","the","text","so","far",",","decreasing","the","model","'s","likelihood","to","repeat","the","same","line","verbatim",".","bestOf","Generates","best_of","completions","server-side","and","returns","the","`","best","`","(","the","one","with","the","highest","log","probability","per","token",")",".","logitBias","Modify","the","likelihood","of","specified","tokens","appearing","in","the","completion",".","user","A","unique","identifier","representing","your","end-user",",","which","can","help","OpenAI","to","monitor","and","detect","abuse",".","Examples","--","--","--","--",">",">",">","import","sparknlp",">",">",">","from","sparknlp.base","import","*",">",">",">","from","sparknlp.annotator","import","*",">",">",">","from","sparknlp.common","import","*",">",">",">","from","pyspark.ml","import","Pipeline",">",">",">","documentAssembler","=","DocumentAssembler","(",")","\\","...",".setInputCol","(","``","text","''",")","\\","...",".setOutputCol","(","``","document","''",")",">",">",">","openai_completion","=","OpenAICompletion","(",")","\\","...",".setInputCols","(","``","document","''",")","\\","...",".setOutputCol","(","``","completion","''",")","\\","...",".setModel","(","``","text-davinci-003","''",")","\\","...",".setMaxTokens","(","100",")",">",">",">","pipeline","=","Pipeline","(",")",".setStages","(","[","...","documentAssembler",",","...","openai_completion","...","]",")",">",">",">","empty_df","=","spark.createDataFrame","(","[","[","``","''","]","]",",","[","``","text","''","]",")",">",">",">","sample_text=","[","[","``","Generate","a","restaurant","review",".","``","]",",","[","``","Write","a","review","for","a","local","eatery",".","``","]",",","[","``","Create","a","JSON","with","a","review","of","a","dining","experience",".","''","]","]",">",">",">","sample_df","=","spark.createDataFrame","(","sample_text",")",".toDF","(","``","text","''",")",">",">",">","sample_df.show","(",")","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|completion","|","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","[","{","document",",","0",",","258",",","I","had","the","pleasure","of","dining","at","La","Fiorita","recently",",","and","it","was","a","truly","delightful","experience","!","The","menu","boasted","a","wonderful","selection","of","classic","Italian","dishes",",","all","exquisitely","prepared","and","presented",".","The","service","staff","was","friendly","and","attentive","and","really",",","{","}",",","[","]","}","]","|","|","[","{","document",",","0",",","227",",","I","recently","visited","Barbecue","Joe","'s","for","dinner","and","it","was","amazing","!","The","menu","had","so","many","items","to","choose","from","including","pulled","pork",",","smoked","turkey",",","brisket",",","pork","ribs",",","and","sandwiches",".","I","opted","for","the","pulled","pork","sandwich","and","let",",","{","}",",","[","]","}","]","|","|","[","{","document",",","0",",","172",",","{","``","review","''",":","{","``","overallRating","''",":","4",",","``","reviewBody","''",":","``","I","enjoyed","my","meal","at","this","restaurant",".","The","food","was","flavourful",",","well-prepared","and","beautifully","presented.",",","{","}",",","[","]","}","]","|","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+"]
code: def __init__(
      self,
      classname="com.johnsnowlabs.ml.ai.OpenAICompletion",
      java_model=None,
  ):
      super(OpenAICompletion, self).__init__(
          classname=classname, java_model=java_model
      )
      self._setDefault(
          maxTokens=16,
          temperature=1,
          topP=1,
          numberOfCompletions=1,
          echo=False,
          presencePenalty=0,
          frequencyPenalty=0,
          bestOf=1,
      )
  
file_path: spark-nlp/python/sparknlp/annotator/openai/openai_completion.py
imports: from sparknlp.common import *
label_desc: Use image node_id 15 to create a new OpenAICompletion object from inherited base classes: AnnotatorModel with example: obj = OpenAICompletion(classname, java_model)