FEATURE: Support srv records for OpenAI compatible LLMs (#865)
This commit is contained in:
parent
c1fa84ad29
commit
3022d34613
|
@ -48,7 +48,14 @@ module DiscourseAi
|
|||
private
|
||||
|
||||
def model_uri
|
||||
URI(llm_model.url)
|
||||
if llm_model.url.to_s.starts_with?("srv://")
|
||||
service = DiscourseAi::Utils::DnsSrv.lookup(llm_model.url.sub("srv://", ""))
|
||||
api_endpoint = "https://#{service.target}:#{service.port}/v1/chat/completions"
|
||||
else
|
||||
api_endpoint = llm_model.url
|
||||
end
|
||||
|
||||
@uri ||= URI(api_endpoint)
|
||||
end
|
||||
|
||||
def prepare_payload(prompt, model_params, dialect)
|
||||
|
|
Loading…
Reference in New Issue