Skip to content

Commit

Permalink
Merge pull request #4077 from nulib/deploy/staging
Browse files Browse the repository at this point in the history
Deploy v9.4.3 to production
  • Loading branch information
bmquinn authored Aug 1, 2024
2 parents 73c83f5 + 98c80d4 commit d722986
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
11 changes: 7 additions & 4 deletions app/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ config :meadow, Meadow.Search.Cluster,
bulk_page_size: 200,
bulk_wait_interval: 500,
json_encoder: Ecto.Jason,
embedding_model_id: aws_secret("meadow",
dig: ["search", "embedding_model_id"],
default: nil
)
embedding_model_id:
aws_secret("meadow",
dig: ["search", "embedding_model_id"],
default: nil
),
embedding_dimensions:
aws_secret("meadow", dig: ["search", "embedding_dimensions"], default: nil)

config :meadow,
ark: %{
Expand Down
24 changes: 24 additions & 0 deletions app/lib/meadow/search/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ defmodule Meadow.Search.Config do
@moduledoc """
Convenience methods for retrieving search-specific configuration
"""
alias Meadow.Search.HTTP

require Logger

Expand Down Expand Up @@ -38,6 +39,7 @@ defmodule Meadow.Search.Config do
File.read!(settings)
|> Jason.decode!()
|> put_in(["settings", "default_pipeline"], pipeline)
|> add_embedding_dimension()

{%{settings: settings}, _} ->
File.read!(settings) |> Jason.decode!()
Expand All @@ -52,6 +54,28 @@ defmodule Meadow.Search.Config do
|> Keyword.get(:embedding_model_id)
end

def add_embedding_dimension(
%{"mappings" => %{"properties" => %{"embedding" => %{"dimension" => _}}}} = settings
) do
case embedding_model_dimensions() do
nil -> settings
_ -> insert_embedding_dimension(settings)
end
end

def insert_embedding_dimension(settings),
do:
put_in(
settings,
["mappings", "properties", "embedding", "dimension"],
embedding_model_dimensions()
)

def embedding_model_dimensions do
Application.get_env(:meadow, Meadow.Search.Cluster)
|> Keyword.get(:embedding_dimensions)
end

def index_versions do
index_configs()
|> Enum.map(& &1.version)
Expand Down
2 changes: 1 addition & 1 deletion app/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Code.require_file("lib/env.ex")
defmodule Meadow.MixProject do
use Mix.Project

@app_version "9.4.2"
@app_version "9.4.3"

def project do
[
Expand Down

0 comments on commit d722986

Please sign in to comment.