| 1 | package Langertha::Engine::DeepSeek; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: DeepSeek API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 15 | our $VERSION = '0.503'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 15 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 15 | ▶ | use Carp qw( croak ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 15 | extends 'Langertha::Engine::OpenAIBase'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 15 | with 'Langertha::Role::Tools'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 54 | ▶ | sub _build_supported_operations {[qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_supported_operations: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | createChatCompletion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | )]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | has '+url' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 16 | ▶ | default => sub { 'https://api.deepseek.com' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 15 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | sub _build_api_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_api_key: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | return $ENV{LANGERTHA_DEEPSEEK_API_KEY} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | || croak "".(ref $self)." requires LANGERTHA_DEEPSEEK_API_KEY or api_key set"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$ENV{'LANGERTHA_DEEPSEEK_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_DEEPSEEK_API_KEY or api_key set')
MC/DC0%0/2
$ENV{'LANGERTHA_DEEPSEEK_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_DEEPSEEK_API_KEY or api_key set')
$ENV{'LANGERTHA_DEEPSEEK_API_KEY'}
croak('' . ref($self) . ' requires LANGERTHA_DEEPSEEK_API_KEY or api_key set')
Truth table33%1/3
A || B
A= $ENV{'LANGERTHA_DEEPSEEK_API_KEY'}B= croak('' . ref($self) . ' requires LANGERTHA_DEEPSEEK_API_KEY or api_key set')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 19 | ▶ | sub default_model { 'deepseek-flash' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_model: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # image_input (k266, k280, ADR 0019 k266 Update): deepseek-flash is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # DeepSeek-V4.1-Flash, natively multimodal since the 2026-09-10 release (news | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # 260910; pricing table "Vision: yes"). The legacy ids deepseek-v4-flash and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # deepseek-v4-flash-vision-exp are served by V4.1-Flash too (pricing note, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # /guides/vision). deepseek-v4-pro (V4-Pro-0813) is "Vision: not supported"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # its temporary routing to V4.1-Flash since 2026-09-14 is not a capability | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # and is deliberately not claimed. Other ids are unchecked, so the catch-all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # first row clears the flag (llm-advisor, docs only, read 2026-09-25). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 136 | ▶ | sub model_capability_corrections { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
model_capability_corrections: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 136 | qr/\A/ => { image_input => 0 }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 'deepseek-flash' => { image_input => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | qr/\Adeepseek-v4-flash(?:-vision-exp)?\z/ => { image_input => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # DeepSeek's response_format.type enum is [text, json_object] only — there is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # no json_schema on the standard endpoint (api-docs.deepseek.com, verified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # 2026-09-01; schema enforcement instead needs a forced tool with strict:true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # on the /beta base URL). Clear the json_schema flag so chat_f routes a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # json_schema request through the forced-tool path rather than shipping a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # response_format the wire rejects; json_object stays. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # parallel_tool_calls is not in the chat/completions schema, and DeepSeek's own | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # Responses guide calls it "Ignored (parallel tool calling is always enabled)": | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # clear parallel_tool_use so a parallel_tool_use=0 is dropped with a carp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # instead of sent and ignored (karr k242, docs only). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 136 | ▶ | around engine_capabilities => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 136 | my ( $orig, $self, @rest ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 136 | my $caps = $self->$orig(@rest); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 136 | delete @{$caps}{ qw( response_format_json_schema parallel_tool_use ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 136 | return $caps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 15 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # Reasoning effort diverges by DeepSeek model within the shared openai wire | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # format: the current V4 generation (deepseek-flash, deepseek-v4-pro, and the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | # temporarily-routed deepseek-v4-* aliases) takes a flat reasoning_effort | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # string; the legacy V3.2 line used a thinking:{type:enabled} toggle instead. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # Match the V3.2 family by explicit prefix — anchored, so `deepseek-v3`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # `deepseek-v3.2`, `deepseek-v3.2-exp` (etc.) hit the legacy toggle, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # retired aliases / unknown future ids default to V4 (the safe current | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # default). A bare `/v3/i` regex was rejected: it matched too widely and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # could collide with future V3.x / V3.x-y naming. (V3.2 mapping flagged for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # live re-verify.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 72 | ▶ | sub _is_deepseek_v3 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_deepseek_v3: called CC=6 SCAR=18.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 72 | my ( $model ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 72 | ▶ | return 0 unless defined $model && length $model; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $model and length $model
MC/DC0%0/2
defined $model and length $model
defined $model
length $model
Truth table33%1/3
A and B
A= defined $modelB= length $model
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 72 | ▶ | return 1 if $model eq 'deepseek-v3' || $model eq 'deepseek-v3.2'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$model eq "deepseek-v3" or $model eq "deepseek-v3.2"
MC/DC100%2/2
$model eq "deepseek-v3" or $model eq "deepseek-v3.2"
$model eq "deepseek-v3"
$model eq "deepseek-v3.2"
Truth table100%3/3
A or B
A= $model eq "deepseek-v3"B= $model eq "deepseek-v3.2"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 51 | ▶ | return 1 if $model =~ /\Adeepseek-v3(?:\.\d+)?(?:-[A-Za-z0-9._-]+)?\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 50 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # Effort set per api-docs.deepseek.com/api/create-chat-completion (verified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # 2026-09-14): the chat-completion endpoint serving deepseek-flash and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # deepseek-v4-pro accepts reasoning_effort none|low|high|max (server default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # high) with NO per-model difference; none disables thinking. The former | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # deepseek-v4-pro-only high|max clamp (drop low) was reversed by DeepSeek — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # V4 Pro service continues unchanged after 2026-09-14 — and is gone. Unknown | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # future V4 ids get the same flat set. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # This override replaces Role::ReasoningEffort::reasoning_kwargs_for and so | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # bypasses its supports()-gate (karr k204, ADR 0009): harmless while DeepSeek | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # never clears reasoning_effort -- if it ever does, add the same gate here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 93 | ▶ | sub reasoning_kwargs_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reasoning_kwargs_for: called CC=12 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 93 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # A per-request reasoning_effort control (chat_f, karr #46) beats the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # engine attribute; the rest of the model-gated placement is unchanged. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | my $e = exists $args{reasoning_effort} ? $args{reasoning_effort} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | : exists $args{effort} ? $args{effort} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 93 | ▶ | : $self->has_reasoning_effort ? $self->reasoning_effort | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 93 | ▶ | return () unless defined $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 66 | ▶ | my $model = $self->can('chat_model') ? ( $self->chat_model // '' ) : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->chat_model // ""
MC/DC0%0/1
$self->chat_model // ""
$self->chat_model
Truth table50%1/2
A
A= $self->chat_model
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 66 | ▶ | if ( _is_deepseek_v3($model) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 20 | return ( thinking => { type => 'enabled' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 46 | ▶ | return () unless $e eq 'none' || $e eq 'low' || $e eq 'high' || $e eq 'max'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
$e eq "none" or $e eq "low" or $e eq "high" or $e eq "max"
$e eq "none" or $e eq "low" or $e eq "high"
$e eq "none" or $e eq "low"
MC/DC100%4/4
$e eq "none" or $e eq "low" or $e eq "high" or $e eq "max"
$e eq "none"
$e eq "low"
$e eq "high"
$e eq "max"
Truth table100%5/5
A or B or C or D
A= $e eq "none"B= $e eq "low"C= $e eq "high"D= $e eq "max"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 34 | return ( reasoning_effort => $e ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # The thinking switch follows chat_model too, and every DeepSeek id resolves | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # the same reasoning profile, so a per-request model that crosses the V3 line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # flips it unnamed otherwise (karr k362, Role::Chat::_warn_model_override). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 8 | ▶ | around _model_scoped_wire_decisions => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 8 | my ( $orig, $self, $features, @rest ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 8 | my %decision = $self->$orig( $features, @rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | $decision{'thinking switch'} = _is_deepseek_v3( $self->chat_model ) ? 1 : 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 8 | ▶ | if $features->{reasoning}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 8 | return %decision; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 15 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 15 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | Langertha::Engine::DeepSeek - DeepSeek API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | version 0.503 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | use Langertha::Engine::DeepSeek; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | my $deepseek = Langertha::Engine::DeepSeek->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | api_key => $ENV{DEEPSEEK_API_KEY}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | model => 'deepseek-flash', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | system_prompt => 'You are a helpful assistant', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | temperature => 0.5, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | print $deepseek->simple_chat('Say something nice'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | Provides access to DeepSeek's models via their API. Composes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | L<Langertha::Role::OpenAICompatible> with DeepSeek's endpoint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | (C<https://api.deepseek.com>) and API key handling. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | Available models: C<deepseek-flash> (default; DeepSeek-V4.1-Flash, native | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | multimodal vision, 1M context) and C<deepseek-v4-pro>. The previous-generation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | C<deepseek-v4-flash> and C<deepseek-v4-flash-vision-exp> were retired on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 2026-09-10 and their ids are temporarily routed to V4.1-Flash — pin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | C<deepseek-flash> instead. The older aliases C<deepseek-chat> and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | C<deepseek-reasoner> were retired on 2026-07-24. Embeddings and transcription | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | are not supported. Dynamic model listing via C<list_models()>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | B<Reasoning effort:> the chat-completion endpoint — serving both | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | C<deepseek-flash> and C<deepseek-v4-pro> — accepts C<none>, C<low>, C<high> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | (server default) and C<max>, with B<no per-model difference>; C<none> disables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | thinking. Set it via the C<reasoning_effort> attribute or the per-request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | C<chat_f> control. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | Get your API key at L<https://platform.deepseek.com/> and set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | C<LANGERTHA_DEEPSEEK_API_KEY> in your environment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | B<THIS API IS WORK IN PROGRESS> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | =item * L<https://status.deepseek.com/> - DeepSeek service status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | =item * L<https://api-docs.deepseek.com/> - Official DeepSeek API documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | =item * L<Langertha::Role::OpenAICompatible> - OpenAI API format role | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | =item * L<Langertha::Engine::Groq> - Another OpenAI-compatible engine | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | =head2 Issues | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | Please report bugs and feature requests on GitHub at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | L<https://github.com/Getty/langertha/issues>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | =head2 IRC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | Join C<#langertha> on C<irc.perl.org> or message Getty directly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | =head1 CONTRIBUTING | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | Torsten Raudssus <getty@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||