Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions src/OpenAI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/completion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
end