File Coverage

blib/lib/AI/Ollama/GenerateCompletionRequest.pm
Criterion Covered Total %
statement 20 24 83.3
branch n/a
condition n/a
subroutine 7 8 87.5
pod 0 1 0.0
total 27 33 81.8


line stmt bran cond sub pod time code
1             package AI::Ollama::GenerateCompletionRequest 0.05;
2             # DO NOT EDIT! This is an autogenerated file.
3              
4 1     1   21 use 5.020;
  1         4  
5 1     1   6 use Moo 2;
  1         45  
  1         8  
6 1     1   492 use experimental 'signatures';
  1         3  
  1         6  
7 1     1   190 use stable 'postderef';
  1         2  
  1         7  
8 1     1   123 use Types::Standard qw(Enum Str Bool Num Int HashRef ArrayRef);
  1         2  
  1         10  
9 1     1   3277 use MooX::TypeTiny;
  1         3  
  1         9  
10              
11 1     1   1198 use namespace::clean;
  1         3  
  1         9  
12              
13             =encoding utf8
14              
15             =head1 NAME
16              
17             AI::Ollama::GenerateCompletionRequest -
18              
19             =head1 SYNOPSIS
20              
21             my $obj = AI::Ollama::GenerateCompletionRequest->new();
22             ...
23              
24             =cut
25              
26 0     0 0   sub as_hash( $self ) {
  0            
  0            
27 0           return { $self->%* }
28             }
29              
30             =head1 PROPERTIES
31              
32             =head2 C<< context >>
33              
34             The context parameter returned from a previous request to [generateCompletion], this can be used to keep a short conversational memory.
35              
36             =cut
37              
38             has 'context' => (
39             is => 'ro',
40             isa => ArrayRef[Int],
41             );
42              
43             =head2 C<< format >>
44              
45             The format to return a response in. Currently the only accepted value is json.
46              
47             Enable JSON mode by setting the format parameter to json. This will structure the response as valid JSON.
48              
49             Note: it's important to instruct the model to use JSON in the prompt. Otherwise, the model may generate large amounts whitespace.
50              
51             =cut
52              
53             has 'format' => (
54             is => 'ro',
55             isa => Enum[
56             "json",
57             ],
58             );
59              
60             =head2 C<< images >>
61              
62             (optional) a list of Base64-encoded images to include in the message (for multimodal models such as llava)
63              
64             =cut
65              
66             has 'images' => (
67             is => 'ro',
68             isa => ArrayRef[Str],
69             );
70              
71             =head2 C<< keep_alive >>
72              
73             How long (in minutes) to keep the model loaded in memory.
74              
75             - If set to a positive duration (e.g. 20), the model will stay loaded for the provided duration.
76             - If set to a negative duration (e.g. -1), the model will stay loaded indefinitely.
77             - If set to 0, the model will be unloaded immediately once finished.
78             - If not set, the model will stay loaded for 5 minutes by default
79              
80             =cut
81              
82             has 'keep_alive' => (
83             is => 'ro',
84             isa => Int,
85             );
86              
87             =head2 C<< model >>
88              
89             The model name.
90              
91             Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama2:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
92              
93             =cut
94              
95             has 'model' => (
96             is => 'ro',
97             isa => Str,
98             required => 1,
99             );
100              
101             =head2 C<< options >>
102              
103             Additional model parameters listed in the documentation for the Modelfile such as `temperature`.
104              
105             =cut
106              
107             has 'options' => (
108             is => 'ro',
109             isa => HashRef,
110             );
111              
112             =head2 C<< prompt >>
113              
114             The prompt to generate a response.
115              
116             =cut
117              
118             has 'prompt' => (
119             is => 'ro',
120             isa => Str,
121             required => 1,
122             );
123              
124             =head2 C<< raw >>
125              
126             If `true` no formatting will be applied to the prompt and no context will be returned.
127              
128             You may choose to use the `raw` parameter if you are specifying a full templated prompt in your request to the API, and are managing history yourself.
129              
130             =cut
131              
132             has 'raw' => (
133             is => 'ro',
134             );
135              
136             =head2 C<< stream >>
137              
138             If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
139              
140             =cut
141              
142             has 'stream' => (
143             is => 'ro',
144             );
145              
146             =head2 C<< system >>
147              
148             The system prompt to (overrides what is defined in the Modelfile).
149              
150             =cut
151              
152             has 'system' => (
153             is => 'ro',
154             isa => Str,
155             );
156              
157             =head2 C<< template >>
158              
159             The full prompt or prompt template (overrides what is defined in the Modelfile).
160              
161             =cut
162              
163             has 'template' => (
164             is => 'ro',
165             isa => Str,
166             );
167              
168              
169             1;