diff --git a/lib/components/smart_prompter_interactor.ex b/lib/components/smart_prompter_interactor.ex index 22a371a..78ce2a9 100644 --- a/lib/components/smart_prompter_interactor.ex +++ b/lib/components/smart_prompter_interactor.ex @@ -14,6 +14,10 @@ defmodule Components.SmartPrompterInteractor do templates: %{ create: "api/prompt_templates" + }, + embedding: + %{ + get: "api/embedding" } } def register(username, password) do @@ -96,7 +100,7 @@ defmodule Components.SmartPrompterInteractor do |> Process.whereis() |> Agent.get(fn token -> token end) end - + # +--------+ # | Topics | # +--------+ @@ -183,4 +187,14 @@ defmodule Components.SmartPrompterInteractor do String.replace(acc, "{#{key}}", value) end) end + + # +-----------+ + # | embedding | + # +-----------+ + + def get_embedding(endpoint, content) do + token = get_session(endpoint) + path = "#{endpoint}/#{@paths.embedding.get}" + ExHttp.http_post(path, %{text: content}, token, 3) + end end