QdrantSearch: Add health checks.
This commit is contained in:
parent
ec3f3fef77
commit
f4c04e6b2d
|
@ -919,6 +919,9 @@
|
|||
qdrant_url: "http://127.0.0.1:6333/",
|
||||
qdrant_api_key: "",
|
||||
openai_url: "http://127.0.0.1:11345",
|
||||
# The healthcheck url has to be set to nil when used with the real openai
|
||||
# API, as it doesn't have a healthcheck endpoint.
|
||||
openai_healthcheck_url: "http://127.0.0.1:11345/health",
|
||||
openai_model: "snowflake/snowflake-arctic-embed-xs",
|
||||
openai_api_key: "",
|
||||
qdrant_index_configuration: %{
|
||||
|
|
|
@ -148,7 +148,9 @@ def healthcheck_endpoints do
|
|||
|> Map.put(:path, "/healthz")
|
||||
|> URI.to_string()
|
||||
|
||||
[qdrant_health]
|
||||
openai_health = Config.get([Pleroma.Search.QdrantSearch, :openai_healthcheck_url])
|
||||
|
||||
[qdrant_health, openai_health] |> Enum.filter(& &1)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -16,15 +16,29 @@ defmodule Pleroma.Search.QdrantSearchTest do
|
|||
|
||||
describe "Qdrant search" do
|
||||
test "returns the correct healthcheck endpoints" do
|
||||
# No openai healthcheck URL
|
||||
Config
|
||||
|> expect(:get, 1, fn
|
||||
|> expect(:get, 2, fn
|
||||
[Pleroma.Search.QdrantSearch, key], nil ->
|
||||
%{qdrant_url: "https://qdrant.url"}[key]
|
||||
end)
|
||||
|
||||
health_endpoints = QdrantSearch.healthcheck_endpoints()
|
||||
[health_endpoint] = QdrantSearch.healthcheck_endpoints()
|
||||
|
||||
assert "https://qdrant.url/healthz" in health_endpoints
|
||||
assert "https://qdrant.url/healthz" == health_endpoint
|
||||
|
||||
# Set openai healthcheck URL
|
||||
Config
|
||||
|> expect(:get, 2, fn
|
||||
[Pleroma.Search.QdrantSearch, key], nil ->
|
||||
%{qdrant_url: "https://qdrant.url", openai_healthcheck_url: "https://openai.url/health"}[
|
||||
key
|
||||
]
|
||||
end)
|
||||
|
||||
[_, health_endpoint] = QdrantSearch.healthcheck_endpoints()
|
||||
|
||||
assert "https://openai.url/health" == health_endpoint
|
||||
end
|
||||
|
||||
test "searches for a term by encoding it and sending it to qdrant" do
|
||||
|
|
Loading…
Reference in New Issue