Skip to content

Commit b82aeed

Browse files
committed
Improve naming consistency
1 parent e158e52 commit b82aeed

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

lib/trento/ai/llm_registry.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule Trento.AI.LlmRegistry do
1+
defmodule Trento.AI.LLMRegistry do
22
@moduledoc """
33
This module is responsible for managing the registry of available LLM providers and their models.
44
"""

lib/trento/ai/user_configuration.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ defmodule Trento.AI.UserConfiguration do
66

77
alias Trento.Support.Ecto.EncryptedBinary
88

9-
alias Trento.AI.LlmRegistry
9+
alias Trento.AI.LLMRegistry
1010

1111
@type t :: %__MODULE__{}
1212

1313
@primary_key false
1414
schema "ai_configurations" do
1515
field :model, :string
16-
field :provider, Ecto.Enum, values: LlmRegistry.providers()
16+
field :provider, Ecto.Enum, values: LLMRegistry.providers()
1717
field :api_key, EncryptedBinary, redact: true
1818

1919
belongs_to :user, Trento.Users.User, primary_key: true
@@ -45,11 +45,11 @@ defmodule Trento.AI.UserConfiguration do
4545
defp get_model_provider(attrs) do
4646
attrs
4747
|> Map.get(:model)
48-
|> LlmRegistry.get_model_provider()
48+
|> LLMRegistry.get_model_provider()
4949
end
5050

5151
defp validate_model(_model_field_atom, model) do
52-
if LlmRegistry.model_supported?(model) do
52+
if LLMRegistry.model_supported?(model) do
5353
[]
5454
else
5555
[model: {"is not supported", validation: :ai_model_validity}]

test/support/factory.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ defmodule Trento.Factory do
182182

183183
alias TrentoWeb.Auth.PersonalAccessToken, as: PAT
184184

185-
alias Trento.AI.{LlmRegistry, UserConfiguration}
185+
alias Trento.AI.{LLMRegistry, UserConfiguration}
186186

187187
use ExMachina.Ecto, repo: Trento.Repo
188188

@@ -1463,7 +1463,7 @@ defmodule Trento.Factory do
14631463

14641464
def random_ai_model do
14651465
:all
1466-
|> LlmRegistry.get_provider_models()
1466+
|> LLMRegistry.get_provider_models()
14671467
|> Enum.random()
14681468
end
14691469

test/trento/ai/configurations_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Trento.Ai.ConfigurationsTest do
33

44
alias Trento.Users.User
55

6-
alias Trento.AI.{Configurations, LlmRegistry, UserConfiguration}
6+
alias Trento.AI.{Configurations, LLMRegistry, UserConfiguration}
77

88
alias Trento.Factory
99

@@ -194,7 +194,7 @@ defmodule Trento.Ai.ConfigurationsTest do
194194
model = Factory.random_ai_model()
195195
api_key = Faker.String.base64()
196196

197-
expected_provider = LlmRegistry.get_model_provider(model)
197+
expected_provider = LLMRegistry.get_model_provider(model)
198198

199199
assert {:ok,
200200
%UserConfiguration{
@@ -354,7 +354,7 @@ defmodule Trento.Ai.ConfigurationsTest do
354354

355355
new_model = Factory.random_ai_model()
356356

357-
expected_provider = LlmRegistry.get_model_provider(new_model)
357+
expected_provider = LLMRegistry.get_model_provider(new_model)
358358

359359
assert {:ok,
360360
%UserConfiguration{
@@ -378,7 +378,7 @@ defmodule Trento.Ai.ConfigurationsTest do
378378
new_model = Factory.random_ai_model()
379379
new_api_key = Faker.String.base64()
380380

381-
expected_provider = LlmRegistry.get_model_provider(new_model)
381+
expected_provider = LLMRegistry.get_model_provider(new_model)
382382

383383
assert {:ok,
384384
%UserConfiguration{

test/trento/ai/llm_registry_test.exs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
defmodule Trento.AI.LlmRegistryTest do
1+
defmodule Trento.AI.LLMRegistryTest do
22
use ExUnit.Case, async: true
33

4-
alias Trento.AI.LlmRegistry
4+
alias Trento.AI.LLMRegistry
55

66
setup do
77
original_config = Application.get_env(:trento, :ai)
@@ -35,35 +35,35 @@ defmodule Trento.AI.LlmRegistryTest do
3535

3636
describe "providers/0" do
3737
test "returns the list of configured providers" do
38-
assert LlmRegistry.providers() == [:provider1, :provider2, :provider3]
38+
assert LLMRegistry.providers() == [:provider1, :provider2, :provider3]
3939
end
4040
end
4141

4242
describe "get_provider_models/1" do
4343
test "returns the list of models for a given provider" do
44-
assert LlmRegistry.get_provider_models(:provider1) == [
44+
assert LLMRegistry.get_provider_models(:provider1) == [
4545
"model1",
4646
"model2"
4747
]
4848

49-
assert LlmRegistry.get_provider_models(:provider2) == [
49+
assert LLMRegistry.get_provider_models(:provider2) == [
5050
"model3",
5151
"model4"
5252
]
5353

54-
assert LlmRegistry.get_provider_models(:provider3) == [
54+
assert LLMRegistry.get_provider_models(:provider3) == [
5555
"model5",
5656
"model6"
5757
]
5858
end
5959

6060
test "returns an empty list for an unknown provider" do
61-
assert LlmRegistry.get_provider_models(:unknown) == []
62-
assert LlmRegistry.get_provider_models("foo") == []
61+
assert LLMRegistry.get_provider_models(:unknown) == []
62+
assert LLMRegistry.get_provider_models("foo") == []
6363
end
6464

6565
test "returns all available models" do
66-
assert LlmRegistry.get_provider_models(:all) == [
66+
assert LLMRegistry.get_provider_models(:all) == [
6767
"model1",
6868
"model2",
6969
"model3",
@@ -76,23 +76,23 @@ defmodule Trento.AI.LlmRegistryTest do
7676

7777
describe "get_model_provider/1" do
7878
test "returns the provider for a given model" do
79-
assert LlmRegistry.get_model_provider("model6") == :provider3
80-
assert LlmRegistry.get_model_provider("model1") == :provider1
79+
assert LLMRegistry.get_model_provider("model6") == :provider3
80+
assert LLMRegistry.get_model_provider("model1") == :provider1
8181
end
8282

8383
test "returns nil for an unknown model" do
84-
assert LlmRegistry.get_model_provider("unknown-model") == nil
84+
assert LLMRegistry.get_model_provider("unknown-model") == nil
8585
end
8686
end
8787

8888
describe "model_supported?/1" do
8989
test "returns true for a supported model" do
90-
assert LlmRegistry.model_supported?("model1") == true
91-
assert LlmRegistry.model_supported?("model6") == true
90+
assert LLMRegistry.model_supported?("model1") == true
91+
assert LLMRegistry.model_supported?("model6") == true
9292
end
9393

9494
test "returns false for an unsupported model" do
95-
assert LlmRegistry.model_supported?("unknown-model") == false
95+
assert LLMRegistry.model_supported?("unknown-model") == false
9696
end
9797
end
9898
end

test/trento/ai_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule Trento.AiTest do
1+
defmodule Trento.AITest do
22
use ExUnit.Case
33

44
alias Trento.AI

0 commit comments

Comments
 (0)