| 1 | package Langertha::Engine::TSystems; | ||||||||||||||||||||
| 2 | # ABSTRACT: T-Systems AI Foundation Services (LLM Hub) | ||||||||||||||||||||
| 3 | 10 | our $VERSION = '0.503'; | |||||||||||||||||||
| 4 | 10 | ▶ | use Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 10 | ▶ | use Carp qw( croak ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 10 | extends 'Langertha::Engine::OpenAIBase'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 10 | with 'Langertha::Role::Embedding', 'Langertha::Role::Tools'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | # NOTE (karr #184 / ADR 0024): the project has no available developer key for AIFS (the | ||||||||||||||||||||
| 12 | # LANGERTHA_TSYSTEMS_API_KEY / test key is empty and none is obtainable), so this engine's wire | ||||||||||||||||||||
| 13 | # behavior -- notably whether gpt-oss-120b rejects tools + a structured-output response_format -- is | ||||||||||||||||||||
| 14 | # documentation-derived, NOT live-verified. Verify changes against docs.llmhub.t-systems.net. | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | has '+url' => ( | ||||||||||||||||||||
| 18 | lazy => 1, | ||||||||||||||||||||
| 19 | 9 | ▶ | default => sub { 'https://llm-server.llmhub.t-systems.net/v2' }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | 10 | ); | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 1 | ▶ | sub _build_api_key { | ||||||||||||||||||
|
Subroutine
_build_api_key: called CC=2 SCAR=8.1
| |||||||||||||||||||||
| 23 | 1 | my ( $self ) = @_; | |||||||||||||||||||
| 24 | return $ENV{LANGERTHA_TSYSTEMS_API_KEY} | ||||||||||||||||||||
| 25 | 1 | ▶ | || croak "".(ref $self)." requires LANGERTHA_TSYSTEMS_API_KEY or api_key set"; | ||||||||||||||||||
|
Condition33%1/3
$ENV{'LANGERTHA_TSYSTEMS_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_TSYSTEMS_API_KEY or api_key set')
MC/DC0%0/2
$ENV{'LANGERTHA_TSYSTEMS_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_TSYSTEMS_API_KEY or api_key set')
$ENV{'LANGERTHA_TSYSTEMS_API_KEY'}
croak('' . ref($self) . ' requires LANGERTHA_TSYSTEMS_API_KEY or api_key set')
Truth table33%1/3
A || B
A= $ENV{'LANGERTHA_TSYSTEMS_API_KEY'}B= croak('' . ref($self) . ' requires LANGERTHA_TSYSTEMS_API_KEY or api_key set')
| |||||||||||||||||||||
| 26 | } | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 20 | ▶ | sub default_model { 'gpt-oss-120b' } | ||||||||||||||||||
|
Subroutine
default_model: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 1 | ▶ | sub default_embedding_model { 'text-embedding-bge-m3' } | ||||||||||||||||||
|
Subroutine
default_embedding_model: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | # Docs-only engine, a dimensions field is not documented or verifiable (k319). | ||||||||||||||||||||
| 33 | 2 | ▶ | sub _embedding_dimensions_field { undef } | ||||||||||||||||||
|
Subroutine
_embedding_dimensions_field: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 17 | ▶ | sub _build_supported_operations {[qw( | ||||||||||||||||||
|
Subroutine
_build_supported_operations: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 36 | createChatCompletion | ||||||||||||||||||||
| 37 | createEmbedding | ||||||||||||||||||||
| 38 | )]} | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | # image_input (k266, ADR 0019 k266 Update): DOCS ONLY, no key exists | ||||||||||||||||||||
| 41 | # (docs.llmhub.t-systems.net/models/vision/, llm-advisor 2026-09-25). The | ||||||||||||||||||||
| 42 | # catch-all first row clears the flag (the default gpt-oss-120b makes no | ||||||||||||||||||||
| 43 | # claim); the listed vision models re-assert it. The docs spell ids | ||||||||||||||||||||
| 44 | # inconsistently (qwen-3.6-35b-fp8 vs Qwen3.6-35B-A3B-FP8), so every row is | ||||||||||||||||||||
| 45 | # case-insensitive and tolerates a missing dash before the version. The hub | ||||||||||||||||||||
| 46 | # documents gpt-5.4+/5.5/5.6-*, gemini-3.1-pro(-long-context), gemini-3.5-flash, | ||||||||||||||||||||
| 47 | # claude-opus-4.8 / claude-*-5 and GLM-5.2 as TEXT-ONLY, so the gpt-5 and | ||||||||||||||||||||
| 48 | # gemini-3 rows are pinned to the listed vision ids (gpt-5, gpt-5-mini, | ||||||||||||||||||||
| 49 | # gpt-5-codex; gemini-3-flash, gemini-3-pro[-long-context|-image]) (k280, | ||||||||||||||||||||
| 50 | # llm-advisor re-read 2026-09-25). | ||||||||||||||||||||
| 51 | 115 | ▶ | sub model_capability_corrections { | ||||||||||||||||||
|
Subroutine
model_capability_corrections: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 52 | return ( | ||||||||||||||||||||
| 53 | 115 | qr/\A/ => { image_input => 0 }, | |||||||||||||||||||
| 54 | qr/\Agemma-?4(?!\d)/i => { image_input => 1 }, | ||||||||||||||||||||
| 55 | qr/\Aglm-?5\.3-flash/i => { image_input => 1 }, | ||||||||||||||||||||
| 56 | qr/\Amistral-small-?4(?!\d)/i => { image_input => 1 }, | ||||||||||||||||||||
| 57 | qr/\Amistral-medium-?3(?!\d)/i => { image_input => 1 }, | ||||||||||||||||||||
| 58 | qr/\Aqwen-?3\.[68](?!\d)/i => { image_input => 1 }, | ||||||||||||||||||||
| 59 | qr/\Agpt-5(?:-mini|-codex)?\z/i => { image_input => 1 }, | ||||||||||||||||||||
| 60 | qr/\Aclaude-(?:[a-z]+-)?4[.-][56](?!\d)/i => { image_input => 1 }, | ||||||||||||||||||||
| 61 | qr/\Agemini-3-(?:flash|pro)\b/i => { image_input => 1 }, | ||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||
| 63 | } | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | # Model metadata probe (k281, ADR 0032): GET {url}/models (the /v2 base) lists | ||||||||||||||||||||
| 66 | # data[].meta_data.input_modalities. DOCS ONLY: the shape is from the public | ||||||||||||||||||||
| 67 | # OpenAPI document (llm-server.llmhub.t-systems.net/openapi.json); no key | ||||||||||||||||||||
| 68 | # exists to see a real answer. | ||||||||||||||||||||
| 69 | 16 | ▶ | sub model_metadata_format { 'tsystems' } | ||||||||||||||||||
|
Subroutine
model_metadata_format: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 70 | 10 | ▶ | sub model_metadata_url { $_[0]->url . $_[0]->list_models_path } | ||||||||||||||||||
|
Subroutine
model_metadata_url: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 10 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 10 | 1; | |||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | __END__ | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | =pod | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | =encoding UTF-8 | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | =head1 NAME | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | Langertha::Engine::TSystems - T-Systems AI Foundation Services (LLM Hub) | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | =head1 VERSION | ||||||||||||||||||||
| 88 | |||||||||||||||||||||
| 89 | version 0.503 | ||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | =head1 SYNOPSIS | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | use Langertha::Engine::TSystems; | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | my $tsi = Langertha::Engine::TSystems->new( | ||||||||||||||||||||
| 96 | api_key => $ENV{LANGERTHA_TSYSTEMS_API_KEY}, | ||||||||||||||||||||
| 97 | model => 'gpt-oss-120b', | ||||||||||||||||||||
| 98 | ); | ||||||||||||||||||||
| 99 | |||||||||||||||||||||
| 100 | print $tsi->simple_chat('Hello from AIFS!'); | ||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | my $vector = $tsi->simple_embedding('embed me'); | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | =head1 DESCRIPTION | ||||||||||||||||||||
| 105 | |||||||||||||||||||||
| 106 | Provides access to T-Systems' B<AI Foundation Services> (formerly LLM Hub), | ||||||||||||||||||||
| 107 | an OpenAI-compatible aggregator hosted in Germany / the EU. Composes | ||||||||||||||||||||
| 108 | L<Langertha::Role::OpenAICompatible> with the AIFS endpoint | ||||||||||||||||||||
| 109 | (C<https://llm-server.llmhub.t-systems.net/v2>) and Bearer auth. | ||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | T-Systems AIFS exposes 30+ open-source and proprietary models behind a single | ||||||||||||||||||||
| 112 | OpenAI-compatible API. Models hosted on B<T-Cloud> are processed exclusively | ||||||||||||||||||||
| 113 | in Germany (Llama 3.3, Qwen3-Next 80B, Mistral Small 4, C<gpt-oss-120b>, | ||||||||||||||||||||
| 114 | Gemma 4, plus the C<BGE-M3> / C<text-embedding-bge-m3> and Jina embeddings); | ||||||||||||||||||||
| 115 | EU-hosted hyperscaler models are processed within the EU and now include | ||||||||||||||||||||
| 116 | current frontier models — GPT-5.2 / GPT-5, Claude Sonnet 4.6 / Haiku 4.5, and | ||||||||||||||||||||
| 117 | Gemini 3 Pro / Flash. This makes AIFS a sovereign-EU route to otherwise non-EU | ||||||||||||||||||||
| 118 | frontier models. GDPR-compliant. | ||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | Get a trial API key at L<https://apikey.llmhub.t-systems.net/> and set | ||||||||||||||||||||
| 121 | C<LANGERTHA_TSYSTEMS_API_KEY> in your environment. | ||||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | L<Langertha::Role::Embedding/embedding_dimensions> is not sent (it carps | ||||||||||||||||||||
| 124 | once): AIFS does not document a C<dimensions> field for its embedding models, | ||||||||||||||||||||
| 125 | and Langertha cannot verify it without a key. | ||||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | B<THIS API IS WORK IN PROGRESS> | ||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | =head1 SEE ALSO | ||||||||||||||||||||
| 130 | |||||||||||||||||||||
| 131 | =over | ||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | =item * L<https://docs.llmhub.t-systems.net/> - Official AIFS / LLM Hub documentation | ||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | =item * L<https://apikey.llmhub.t-systems.net/> - Trial API key request | ||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | =item * L<Langertha::Role::OpenAICompatible> - OpenAI API format role | ||||||||||||||||||||
| 138 | |||||||||||||||||||||
| 139 | =item * L<Langertha::Engine::AKIOpenAI> - Another EU/Germany OpenAI-compatible engine | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | =back | ||||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | =head1 SUPPORT | ||||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | =head2 Issues | ||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | Please report bugs and feature requests on GitHub at | ||||||||||||||||||||
| 148 | L<https://github.com/Getty/langertha/issues>. | ||||||||||||||||||||
| 149 | |||||||||||||||||||||
| 150 | =head2 IRC | ||||||||||||||||||||
| 151 | |||||||||||||||||||||
| 152 | Join C<#langertha> on C<irc.perl.org> or message Getty directly. | ||||||||||||||||||||
| 153 | |||||||||||||||||||||
| 154 | =head1 CONTRIBUTING | ||||||||||||||||||||
| 155 | |||||||||||||||||||||
| 156 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||||||||||||
| 157 | |||||||||||||||||||||
| 158 | =head1 AUTHOR | ||||||||||||||||||||
| 159 | |||||||||||||||||||||
| 160 | Torsten Raudssus <getty@cpan.org> | ||||||||||||||||||||
| 161 | |||||||||||||||||||||
| 162 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 163 | |||||||||||||||||||||
| 164 | This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>. | ||||||||||||||||||||
| 165 | |||||||||||||||||||||
| 166 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 167 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 168 | |||||||||||||||||||||
| 169 | =cut | ||||||||||||||||||||