NAME
Langertha::Engine::NousResearch - Nous Research Inference API
VERSION
version 0.503
SYNOPSIS
use Langertha::Engine::NousResearch;
my $nous = Langertha::Engine::NousResearch->new(
api_key => $ENV{NOUSRESEARCH_API_KEY},
model => 'Hermes-4-70B',
);
print $nous->simple_chat('Explain the Hermes prompt format');
# Chain-of-thought reasoning (Hermes 4)
my $nous = Langertha::Engine::NousResearch->new(
api_key => $ENV{NOUSRESEARCH_API_KEY},
model => 'Hermes-4-70B',
reasoning => 1,
);
my $response = $nous->simple_chat('Solve this step by step...');
say $response; # clean answer
say $response->thinking; # chain-of-thought reasoning
# MCP tool calling (via HermesTools role)
use Future::AsyncAwait;
my $nous = Langertha::Engine::NousResearch->new(
api_key => $ENV{NOUSRESEARCH_API_KEY},
model => 'Hermes-4-70B',
mcp_servers => [$mcp],
);
my $response = await $nous->chat_with_tools_f('Add 7 and 15');
DESCRIPTION
Provides access to Nous Research's inference API. Composes Langertha::Role::OpenAICompatible with Nous's endpoint (https://inference-api.nousresearch.com/v1) and Hermes tool calling.
Available models: Hermes-4-70B (default), Hermes-4-405B, Hermes-4.3-36B.
The endpoint is a gateway that also routes many non-Hermes models (Claude, GPT, Gemini, ...) to their real backends. The tool wire is therefore chosen per model: a Hermes model (Hermes-*, DeepHermes-*) uses the Hermes prompt format, and every other slug uses native OpenAI tools. Override tool_wire_format (hermes | openai) to force either wire on any slug.
For a Hermes model, Langertha::Role::HermesTools injects tool descriptions into the system prompt as <tools> XML and parses <tool_call> tags from the model output; no server-side tool calling is required. This is also the more robust wire for Hermes 4, which intermittently emits its tool calls as <tool_call> text even when native calling is offered. The prompt cannot force a tool, so on the Hermes wire the engine does not claim tool_choice_named: "chat_f" in Langertha::Role::Chat answers a forced tool with a json_schema response_format (the schema also goes into the system prompt) and puts the parsed reply on "tool_calls" in Langertha::Response as a synthetic call. For a non-Hermes slug the tools and a forced tool_choice go out natively.
Get your API key at https://portal.nousresearch.com/ and set LANGERTHA_NOUSRESEARCH_API_KEY.
THIS API IS WORK IN PROGRESS
reasoning
reasoning => 1
Enable chain-of-thought reasoning for Hermes 4 and DeepHermes 3 models. Prepends the standard Nous reasoning system prompt that instructs the model to use <think> tags. The thinking content is automatically extracted into "thinking" in Langertha::Response by Langertha::Role::ThinkTag. This is a Hermes-model feature: on a non-Hermes slug the prompt is ignored with a warning (the gate is the model, not tool_wire_format, so forcing the openai tool wire on a genuine Hermes model still enables reasoning).
With DeepHermes 3, reasoning output appears inline as <think> tags (handled by the think tag filter). With Hermes 4 (without response prefill), reasoning appears in the reasoning_content response field (handled by native extraction).
Defaults to 0 (disabled).
reasoning_prompt
The system prompt prepended when reasoning is enabled. Defaults to the standard Nous Research reasoning prompt from the Hermes model documentation. Unless you have a specific technical reason (e.g. a different model requires a different trigger format), it is strongly recommended to keep the default.
SEE ALSO
https://nousresearch.com/ - Nous Research homepage
https://portal.nousresearch.com/api-docs - API documentation
Langertha::Role::HermesTools - Hermes-style tool calling via XML tags
Langertha::Role::OpenAICompatible - OpenAI API format role
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.