Module: Legion::Extensions::Llm::Vllm::ProviderManagementMethods

Included in:
Provider
Defined in:
lib/legion/extensions/llm/vllm/provider.rb

Overview

Public methods for vLLM management/admin endpoints. Included into Provider to keep the class body within length limits.

Instance Method Summary collapse

Instance Method Details

#reset_mm_cacheObject



29
30
31
32
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 29

def reset_mm_cache
  log.debug { 'resetting vLLM multimodal cache' }
  connection.post(reset_mm_cache_url, {}).body
end

#reset_prefix_cache(reset_running_requests: nil, reset_external: nil) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 21

def reset_prefix_cache(reset_running_requests: nil, reset_external: nil)
  log.debug do
    "resetting vLLM prefix cache reset_running_requests=#{reset_running_requests.inspect} " \
      "reset_external=#{reset_external.inspect}"
  end
  connection.post(with_query(reset_prefix_cache_url, reset_running_requests:, reset_external:), {}).body
end

#sleep(level: 1) ⇒ Object



34
35
36
37
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 34

def sleep(level: 1)
  log.debug { "putting vLLM worker to sleep level=#{level.inspect}" }
  connection.post(with_query(sleep_url, level:), {}).body
end

#versionObject



16
17
18
19
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 16

def version
  log.info { "fetching version from #{api_base}#{version_url}" }
  connection.get(version_url).body
end

#wake_up(tags: nil) ⇒ Object



39
40
41
42
43
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 39

def wake_up(tags: nil)
  log.debug { "waking vLLM worker tags=#{Array(tags).inspect}" }
  query = Array(tags).map { |tag| ['tags', tag] }
  connection.post(with_query(wake_up_url, query), {}).body
end