Skip to content

Commit

Permalink
adds tool_choice option
Browse files Browse the repository at this point in the history
  • Loading branch information
obie authored and drnic committed Apr 25, 2024
1 parent 979601e commit e11e62b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/groq/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e11e62b

Please sign in to comment.