Skip to content

Commit f651c86

Browse files
committed
Fix models listing to restrict to some models
1 parent 2372123 commit f651c86

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/ruby_llm/providers/azure_openai/models.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,26 @@ module AzureOpenAI
77
module Models
88
extend OpenAI::Models
99

10+
KNOWN_MODELS = [
11+
'gpt-4o'
12+
].freeze
13+
1014
module_function
1115

1216
def models_url
1317
'models?api-version=2024-10-21'
1418
end
19+
20+
def parse_list_models_response(response, slug, capabilities)
21+
# select the known models only since this list from Azure OpenAI is
22+
# very long
23+
response.body['data'].select! do |m|
24+
KNOWN_MODELS.include?(m['id'])
25+
end
26+
# Use the OpenAI processor for the list, keeping in mind that pricing etc
27+
# won't be correct
28+
super
29+
end
1530
end
1631
end
1732
end

0 commit comments

Comments
 (0)