From e11e62b8631eb620152803ec95f9daa91b273c67 Mon Sep 17 00:00:00 2001 From: Obie Fernandez Date: Wed, 24 Apr 2024 18:27:31 -0600 Subject: [PATCH] adds tool_choice option --- lib/groq/client.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/groq/client.rb b/lib/groq/client.rb index 28b692f..9b9a207 100644 --- a/lib/groq/client.rb +++ b/lib/groq/client.rb @@ -23,7 +23,7 @@ def initialize(config = {}, &faraday_middleware) end # TODO: support stream: true; or &stream block - def chat(messages, model_id: nil, tools: nil, max_tokens: nil, temperature: nil, json: false) + def chat(messages, model_id: nil, tools: nil, tool_choice: nil, max_tokens: nil, temperature: nil, json: false) unless messages.is_a?(Array) || messages.is_a?(String) raise ArgumentError, "require messages to be an Array or String" end @@ -38,6 +38,7 @@ def chat(messages, model_id: nil, tools: nil, max_tokens: nil, temperature: nil, model: model_id, messages: messages, tools: tools, + tool_choice: tool_choice, max_tokens: max_tokens || @max_tokens, temperature: temperature || @temperature, response_format: json ? {type: "json_object"} : nil