Skip to content

Commit

Permalink
Retain promises, move from "Object" to "HashRef" as type
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Maischein committed Apr 14, 2024
1 parent 3aaf548 commit ea08bfb
Show file tree
Hide file tree
Showing 21 changed files with 37 additions and 37 deletions.
22 changes: 11 additions & 11 deletions lib/AI/Ollama/Client/Impl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use AI::Ollama::RequestOptions;
=cut

# this should be more configurable, and potentially you don't want validation?!
# XXX this should be more configurable, and potentially you don't want validation?!
has 'schema' => (
is => 'lazy',
default => sub {
Expand All @@ -70,7 +70,7 @@ has 'ua' => (

has 'server' => (
is => 'lazy',
default => sub { 'http://localhost:11434/api' },
default => sub { 'http://localhost:11434/api' }, # XXX pull from OpenAPI file instead
);

=head1 METHODS
Expand Down Expand Up @@ -143,7 +143,7 @@ sub checkBlob( $self, %options ) {
# An unknown/unhandled response, likely an error
$res->fail($resp);
}
});
})->retain;

# Start our transaction
$tx = $self->ua->start_p($tx)->then(sub($tx) {
Expand Down Expand Up @@ -225,7 +225,7 @@ sub createBlob( $self, %options ) {
# An unknown/unhandled response, likely an error
$res->fail($resp);
}
});
})->retain;

# Start our transaction
$tx = $self->ua->start_p($tx)->then(sub($tx) {
Expand Down Expand Up @@ -472,7 +472,7 @@ sub copyModel( $self, %options ) {
# An unknown/unhandled response, likely an error
$res->fail($resp);
}
});
})->retain;

# Start our transaction
$tx = $self->ua->start_p($tx)->then(sub($tx) {
Expand Down Expand Up @@ -677,7 +677,7 @@ sub deleteModel( $self, %options ) {
# An unknown/unhandled response, likely an error
$res->fail($resp);
}
});
})->retain;

# Start our transaction
$tx = $self->ua->start_p($tx)->then(sub($tx) {
Expand Down Expand Up @@ -776,7 +776,7 @@ sub generateEmbedding( $self, %options ) {
# An unknown/unhandled response, likely an error
$res->fail($resp);
}
});
})->retain;

# Start our transaction
$tx = $self->ua->start_p($tx)->then(sub($tx) {
Expand Down Expand Up @@ -1066,7 +1066,7 @@ sub pullModel( $self, %options ) {
# An unknown/unhandled response, likely an error
$res->fail($resp);
}
});
})->retain;

# Start our transaction
$tx = $self->ua->start_p($tx)->then(sub($tx) {
Expand Down Expand Up @@ -1165,7 +1165,7 @@ sub pushModel( $self, %options ) {
# An unknown/unhandled response, likely an error
$res->fail($resp);
}
});
})->retain;

# Start our transaction
$tx = $self->ua->start_p($tx)->then(sub($tx) {
Expand Down Expand Up @@ -1256,7 +1256,7 @@ sub showModelInfo( $self, %options ) {
# An unknown/unhandled response, likely an error
$res->fail($resp);
}
});
})->retain;

# Start our transaction
$tx = $self->ua->start_p($tx)->then(sub($tx) {
Expand Down Expand Up @@ -1332,7 +1332,7 @@ sub listModels( $self, %options ) {
# An unknown/unhandled response, likely an error
$res->fail($resp);
}
});
})->retain;

# Start our transaction
$tx = $self->ua->start_p($tx)->then(sub($tx) {
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/CopyModelRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/CreateModelRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/CreateModelResponse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/DeleteModelRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
6 changes: 3 additions & 3 deletions lib/AI/Ollama/GenerateChatCompletionRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down Expand Up @@ -63,7 +63,7 @@ The messages of the chat, this can be used to keep a chat memory

has 'messages' => (
is => 'ro',
isa => ArrayRef[Object],
isa => ArrayRef[HashRef],
required => 1,
);

Expand All @@ -89,7 +89,7 @@ Additional model parameters listed in the documentation for the Modelfile such a

has 'options' => (
is => 'ro',
isa => Object,
isa => HashRef,
);

=head2 C<< stream >>
Expand Down
4 changes: 2 additions & 2 deletions lib/AI/Ollama/GenerateChatCompletionResponse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down Expand Up @@ -86,7 +86,7 @@ A message in the chat endpoint

has 'message' => (
is => 'ro',
isa => Object,
isa => HashRef,
);

=head2 C<< model >>
Expand Down
4 changes: 2 additions & 2 deletions lib/AI/Ollama/GenerateCompletionRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down Expand Up @@ -99,7 +99,7 @@ Additional model parameters listed in the documentation for the Modelfile such a

has 'options' => (
is => 'ro',
isa => Object,
isa => HashRef,
);

=head2 C<< prompt >>
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/GenerateCompletionResponse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
4 changes: 2 additions & 2 deletions lib/AI/Ollama/GenerateEmbeddingRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down Expand Up @@ -46,7 +46,7 @@ Additional model parameters listed in the documentation for the Modelfile such a

has 'options' => (
is => 'ro',
isa => Object,
isa => HashRef,
);

=head2 C<< prompt >>
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/GenerateEmbeddingResponse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/Message.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/Model.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/ModelInfo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/ModelInfoRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
4 changes: 2 additions & 2 deletions lib/AI/Ollama/ModelsResponse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down Expand Up @@ -32,7 +32,7 @@ List of models available locally.

has 'models' => (
is => 'ro',
isa => ArrayRef[Object],
isa => ArrayRef[HashRef],
);


Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/PullModelRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/PullModelResponse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/PushModelRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/PushModelResponse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion lib/AI/Ollama/RequestOptions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.020;
use Moo 2;
use experimental 'signatures';
use stable 'postderef';
use Types::Standard qw(Str Bool Num Int Object ArrayRef);
use Types::Standard qw(Str Bool Num Int ArrayRef HashRef);
use MooX::TypeTiny;

=head1 NAME
Expand Down

0 comments on commit ea08bfb

Please sign in to comment.