diff --git a/src/OpenAI.jl b/src/OpenAI.jl index c811be8..2a999c5 100644 --- a/src/OpenAI.jl +++ b/src/OpenAI.jl @@ -8,17 +8,7 @@ const BASE_URL_v1 = "https://api.openai.com/v1" function build_params(kwargs) isempty(kwargs) && return nothing buf = IOBuffer() - write(buf, '{') - for (i, (k, v)) in enumerate(kwargs) - write(buf, '"', k, '"', ':') - if isnothing(v) - write(buf, "null") - else - write(buf, repr(v)) - end - i == length(kwargs) || write(buf, ',') - end - write(buf, '}') + JSON3.write(buf, kwargs) seekstart(buf) return buf end diff --git a/test/completion.jl b/test/completion.jl index e4a6eab..86a418b 100644 --- a/test/completion.jl +++ b/test/completion.jl @@ -6,10 +6,10 @@ r = create_completion( ENV["OPENAI_API_KEY"], r.response["data"][begin]["id"]; - prompt = "Say this is a test" + prompt = "Say \"this is a test\"" ) println(r.response["choices"][begin]["text"]) if !=(r.status, 200) @test false end -end \ No newline at end of file +end