NAME

Langertha::VLLMHook::Config - Loader for vLLM-Hook model_configs/*.json files

VERSION

version 0.503

SYNOPSIS

use Langertha::VLLMHook::Config;
use Langertha::Engine::VLLMHook;

my $cfg = Langertha::VLLMHook::Config->new(
    file => 'model_configs/hidden_states/Qwen2.5-3B-Instruct.json',
);

my $engine = Langertha::Engine::VLLMHook->new(
    url        => 'http://localhost:8770/v1',
    vllm_xargs => $cfg->xargs,
);

DESCRIPTION

Parses the JSON model configuration files shipped with vLLM-Hook (https://github.com/IBM/vLLM-Hook) and turns them into the vllm_xargs HashRef that Langertha::Engine::VLLMHook sends on the wire.

Three config shapes are recognised, mirroring vLLM-Hook's own HookClient._load_config / _build_extra_body:

  • Attention tracker / CoRer — has params.important_heads (and optionally hookq.hookq_mode). Maps to worker qk, emitting output_qk.

  • Hidden states — has a top-level hidden_states block. Maps to worker hidden_states, emitting output_hidden_states.

  • Activation steering — has a top-level steering block. Maps to worker steer, emitting steer.

Nested values in the produced xargs are already JSON-encoded as strings, because vLLM's vllm_xargs only accepts scalar values — so the result can be handed straight to "vllm_xargs" in Langertha::Engine::VLLMHook.

file

Path to a vLLM-Hook model_configs/*.json file. Either file or data must be supplied. When file is set, data is loaded from it lazily.

data

The parsed config as a HashRef. Built from file when not supplied directly. Pass data explicitly to construct a config from an in-memory structure (useful for tests).

worker

my $worker = $cfg->worker;   # 'qk' | 'hidden_states' | 'steer' | undef

Returns the vLLM-Hook worker name implied by the config (the value you would set as VLLM_HOOK_WORKER when starting vllm serve). Determined from the structural keys present, falling back to model_info.provider. Returns undef when the shape is not recognised.

model_id

my $id = $cfg->model_id;

Returns model_info.model_id from the config, or undef when absent.

xargs

my $xargs = $cfg->xargs;

Returns the vllm_xargs HashRef ready for Langertha::Engine::VLLMHook. Nested values (the layer/heads map, the layers list, the full steering dict) are returned as JSON strings, since vllm_xargs only carries scalars. Returns an empty HashRef for an unrecognised config.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.