| 1 | package Langertha::Engine::DeepSeek; | ||||||||||||||||||||
| 2 | # ABSTRACT: DeepSeek API | ||||||||||||||||||||
| 3 | 5 | our $VERSION = '0.502'; | |||||||||||||||||||
| 4 | 5 | ▶ | use Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 5 | ▶ | use Carp qw( croak ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 5 | extends 'Langertha::Engine::OpenAIBase'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 5 | with 'Langertha::Role::Tools'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 2 | ▶ | 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 | 3 | ▶ | default => sub { 'https://api.deepseek.com' }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 5 | ); | |||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | sub _build_api_key { | ||||||||||||||||||||
| 22 | 1 | ▶ | my ( $self ) = @_; | ||||||||||||||||||
|
Subroutine
_build_api_key: called CC=2 SCAR=8.1
| |||||||||||||||||||||
| 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 | 1 | ▶ | sub default_model { 'deepseek-chat' } | ||||||||||||||||||
|
Subroutine
default_model: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 5 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 5 | 1; | |||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | __END__ | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | =pod | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | =encoding UTF-8 | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | =head1 NAME | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | Langertha::Engine::DeepSeek - DeepSeek API | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | =head1 VERSION | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | version 0.502 | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | =head1 SYNOPSIS | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | use Langertha::Engine::DeepSeek; | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | my $deepseek = Langertha::Engine::DeepSeek->new( | ||||||||||||||||||||
| 53 | api_key => $ENV{DEEPSEEK_API_KEY}, | ||||||||||||||||||||
| 54 | model => 'deepseek-chat', | ||||||||||||||||||||
| 55 | system_prompt => 'You are a helpful assistant', | ||||||||||||||||||||
| 56 | temperature => 0.5, | ||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | print $deepseek->simple_chat('Say something nice'); | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | =head1 DESCRIPTION | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | Provides access to DeepSeek's models via their API. Composes | ||||||||||||||||||||
| 64 | L<Langertha::Role::OpenAICompatible> with DeepSeek's endpoint | ||||||||||||||||||||
| 65 | (C<https://api.deepseek.com>) and API key handling. | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | Available models: C<deepseek-chat> (default, general-purpose), | ||||||||||||||||||||
| 68 | C<deepseek-reasoner> (chain-of-thought reasoning), and C<deepseek-v3.2> | ||||||||||||||||||||
| 69 | (thinking integrated with tool use). Embeddings and transcription are not | ||||||||||||||||||||
| 70 | supported. Dynamic model listing via C<list_models()>. | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | Get your API key at L<https://platform.deepseek.com/> and set | ||||||||||||||||||||
| 73 | C<LANGERTHA_DEEPSEEK_API_KEY> in your environment. | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | B<THIS API IS WORK IN PROGRESS> | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | =head1 SEE ALSO | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | =over | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | =item * L<https://status.deepseek.com/> - DeepSeek service status | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | =item * L<https://api-docs.deepseek.com/> - Official DeepSeek API documentation | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | =item * L<Langertha::Role::OpenAICompatible> - OpenAI API format role | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | =item * L<Langertha::Engine::Groq> - Another OpenAI-compatible engine | ||||||||||||||||||||
| 88 | |||||||||||||||||||||
| 89 | =back | ||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | =head1 SUPPORT | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | =head2 Issues | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | Please report bugs and feature requests on GitHub at | ||||||||||||||||||||
| 96 | L<https://github.com/Getty/langertha/issues>. | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | =head2 IRC | ||||||||||||||||||||
| 99 | |||||||||||||||||||||
| 100 | Join C<#langertha> on C<irc.perl.org> or message Getty directly. | ||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | =head1 CONTRIBUTING | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||||||||||||
| 105 | |||||||||||||||||||||
| 106 | =head1 AUTHOR | ||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | Torsten Raudssus <getty@cpan.org> | ||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 111 | |||||||||||||||||||||
| 112 | This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>. | ||||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 115 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | =cut | ||||||||||||||||||||