class OpenAI::Client

Defined in:

openai/client.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(api_key : String, default_engine : String = "davinci") #

[View source]

Instance Method Detail

def api_key=(api_key : String) #

[View source]
def completions(prompt : String | Nil = nil, max_tokens : Int32 | Nil = nil, temperature : Float64 | Nil = nil, top_p : Float64 | Nil = nil, n : Int32 | Nil = nil, logprobs : Int32 | Nil = nil, echo : Bool | Nil = nil, stop : String | Nil | Array(String) = nil, presence_penalty : Float64 | Nil = nil, frequency_penalty : Float64 | Nil = nil, engine : String = default_engine) #

[View source]
def completions(prompt : String | Nil = nil, max_tokens : Int32 | Nil = nil, temperature : Float64 | Nil = nil, top_p : Float64 | Nil = nil, n : Int32 | Nil = nil, logprobs : Int32 | Nil = nil, echo : Bool | Nil = nil, stop : String | Nil | Array(String) = nil, presence_penalty : Float64 | Nil = nil, frequency_penalty : Float64 | Nil = nil, engine : String = default_engine, &block : Completion -> _) #

[View source]
def default_engine : String #

[View source]
def default_engine=(default_engine : String) #

[View source]
def engine(id : String = default_engine) #

[View source]
def engines #

[View source]
def last_response : LastResponse | Nil #

[View source]
def search(documents : Array(String), query : String, engine : String = default_engine) #

[View source]