lib/webshaker/ai.rb in webshaker-0.0.4 vs lib/webshaker/ai.rb in webshaker-0.0.5

- old
+ new

@@ -11,18 +11,18 @@ parameters: { model: Webshaker.config.model, messages: messages(with_prompt).concat((respond_with.to_sym == :json) ? [{role: "user", content: "respond with json"}] : []), temperature: }.merge( - (respond_with == :json) ? {response_format: {type: "json_object"}} : {} + (respond_with.to_sym == :json) ? {response_format: {type: "json_object"}} : {} ) ) # Return full response from the ai client if the respond_with is set to :full return response if full_response response = response["choices"][0]["message"]["content"] - response = JSON.parse(response) if respond_with === :json + response = JSON.parse(response) if respond_with.to_sym === :json response end private