Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: LLM::Azure not applying full default_options #746

Merged
merged 1 commit into from
Aug 30, 2024
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
3 changes: 3 additions & 0 deletions lib/langchain/llm/azure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ def initialize(
)
@defaults = DEFAULTS.merge(default_options)
chat_parameters.update(
model: {default: @defaults[:chat_completion_model_name]},
logprobs: {},
top_logprobs: {},
n: {default: @defaults[:n]},
temperature: {default: @defaults[:temperature]},
user: {}
)
chat_parameters.ignore(:top_k)
Expand Down
20 changes: 20 additions & 0 deletions spec/langchain/llm/azure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,25 @@
expect(result.chat_client.api_type).to eq(:azure)
end
end

context "with custom default_options" do
let(:subject) do
described_class.new(
api_key: "123",
llm_options: {api_type: :azure},
default_options: {
completion_model_name: "gpt-4o-mini",
n: 2,
temperature: 0.5
}
)
end

it "updates chat_parameters with correct arguments", focus: true do
expect(subject.chat_parameters[:model]).to eq("gpt-4o-mini")
expect(subject.chat_parameters[:n]).to eq(2)
expect(subject.chat_parameters[:temperature]).to eq(0.5)
end
end
end
end