AI-Ollama-Client

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

    my $version = $mm->parse_version($main_file);
    regen_README($main_file, $version);
    regen_EXAMPLES() if -d 'examples';
};

1;

sub WriteMakefile1 {  #Written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
    my %params=@_;
    my $eumm_version=$ExtUtils::MakeMaker::VERSION;
    $eumm_version=eval $eumm_version;
    die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
    die "License not specified" if not exists $params{LICENSE};
    if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
        #EUMM 6.5502 has problems with BUILD_REQUIRES
        $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
        delete $params{BUILD_REQUIRES};
    }
    if ($params{TEST_REQUIRES} and $eumm_version < 6.64) {
        $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{TEST_REQUIRES}} };
        delete $params{TEST_REQUIRES};

Makefile.PL  view on Meta::CPAN

    delete $params{ABSTRACT_FROM} if $] < 5.005;
    delete $params{BINARY_LOCATION} if $] < 5.005;

    WriteMakefile(%params);
}

sub regen_README {
    # README is the short version that just tells people what this is
    # and how to install it
    my( $file, $version ) = @_;
    eval {
        # Get description
        my $readme = join "\n",
            pod_section($file, 'NAME', 'no heading' ),
            pod_section($file, 'DESCRIPTION' ),
            <<VERSION,
This document describes version $version.
VERSION
            <<INSTALL,

INSTALLATION

Makefile.PL  view on Meta::CPAN

            pod_section($file, 'SEE ALSO'),
            pod_section($file, 'AUTHOR'),
            pod_section($file, 'LICENSE' ),
            pod_section($file, 'COPYRIGHT' ),
    ;
        update_file( 'README', $readme );
    };
    # README.mkdn is the documentation that will be shown as the main
    # page of the repository on Github. Hence we recreate the POD here
    # as Markdown
    eval {
        require Pod::Markdown;

        my $parser = Pod::Markdown->new();

        # Read POD from Module.pm and write to README
        $parser->parse_from_file($_[0]);
        my $readme_mkdn = <<STATUS . $parser->as_markdown;

[![Windows](https://github.com/Corion/$distbase/workflows/windows/badge.svg)](https://github.com/Corion/$distbase/actions?query=workflow%3Awindows)
[![MacOS](https://github.com/Corion/$distbase/workflows/macos/badge.svg)](https://github.com/Corion/$distbase/actions?query=workflow%3Amacos)

lib/AI/Ollama/GenerateChatCompletionResponse.pm  view on Meta::CPAN

=head2 C<< done >>

Whether the response has completed.

=cut

has 'done' => (
    is       => 'ro',
);

=head2 C<< eval_count >>

Number of tokens the response.

=cut

has 'eval_count' => (
    is       => 'ro',
    isa      => Int,
);

=head2 C<< eval_duration >>

Time in nanoseconds spent generating the response.

=cut

has 'eval_duration' => (
    is       => 'ro',
    isa      => Int,
);

=head2 C<< load_duration >>

Time spent in nanoseconds loading the model.

=cut

lib/AI/Ollama/GenerateChatCompletionResponse.pm  view on Meta::CPAN


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.

=cut

has 'model' => (
    is       => 'ro',
    isa      => Str,
);

=head2 C<< prompt_eval_count >>

Number of tokens in the prompt.

=cut

has 'prompt_eval_count' => (
    is       => 'ro',
    isa      => Int,
);

=head2 C<< prompt_eval_duration >>

Time spent in nanoseconds evaluating the prompt.

=cut

has 'prompt_eval_duration' => (
    is       => 'ro',
    isa      => Int,
);

=head2 C<< total_duration >>

Time spent generating the response.

=cut

lib/AI/Ollama/GenerateCompletionResponse.pm  view on Meta::CPAN

=head2 C<< done >>

Whether the response has completed.

=cut

has 'done' => (
    is       => 'ro',
);

=head2 C<< eval_count >>

Number of tokens the response.

=cut

has 'eval_count' => (
    is       => 'ro',
    isa      => Int,
);

=head2 C<< eval_duration >>

Time in nanoseconds spent generating the response.

=cut

has 'eval_duration' => (
    is       => 'ro',
    isa      => Int,
);

=head2 C<< load_duration >>

Time spent in nanoseconds loading the model.

=cut

lib/AI/Ollama/GenerateCompletionResponse.pm  view on Meta::CPAN


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.

=cut

has 'model' => (
    is       => 'ro',
    isa      => Str,
);

=head2 C<< prompt_eval_count >>

Number of tokens in the prompt.

=cut

has 'prompt_eval_count' => (
    is       => 'ro',
    isa      => Int,
);

=head2 C<< prompt_eval_duration >>

Time spent in nanoseconds evaluating the prompt.

=cut

has 'prompt_eval_duration' => (
    is       => 'ro',
    isa      => Int,
);

=head2 C<< response >>

The response for a given prompt with a provided model.

=cut

ollama/ollama-curated.json  view on Meta::CPAN

{"openapi":"3.0.3","components":{"schemas":{"PushModelResponse":{"properties":{"total":{"type":"integer","description":"total size of the model","example":"2142590208"},"status":{"$ref":"#/components/schemas/PushModelStatus"},"digest":{"example":"sha...

ollama/ollama-curated.yaml  view on Meta::CPAN

            type: integer
          example: [ 1, 2, 3 ]
        total_duration:
          type: integer
          description: Time spent generating the response.
          example: 5589157167
        load_duration:
          type: integer
          description: Time spent in nanoseconds loading the model.
          example: 3013701500
        prompt_eval_count:
          type: integer
          description: Number of tokens in the prompt.
          example: 46
        prompt_eval_duration:
          type: integer
          description: Time spent in nanoseconds evaluating the prompt.
          example: 1160282000
        eval_count:
          type: integer
          description: Number of tokens the response.
          example: 113
        eval_duration:
          type: integer
          description: Time in nanoseconds spent generating the response.
          example: 1325948000
    GenerateChatCompletionRequest:
      type: object
      description: Request class for the chat endpoint.
      properties:
        model:
          type: string
          description: *model_name

ollama/ollama-curated.yaml  view on Meta::CPAN

          description: Whether the response has completed.
          example: true
        total_duration:
          type: integer
          description: Time spent generating the response.
          example: 5589157167
        load_duration:
          type: integer
          description: Time spent in nanoseconds loading the model.
          example: 3013701500
        prompt_eval_count:
          type: integer
          description: Number of tokens in the prompt.
          example: 46
        prompt_eval_duration:
          type: integer
          description: Time spent in nanoseconds evaluating the prompt.
          example: 1160282000
        eval_count:
          type: integer
          description: Number of tokens the response.
          example: 113
        eval_duration:
          type: integer
          description: Time in nanoseconds spent generating the response.
          example: 1325948000
    Message:
      type: object
      description: A message in the chat endpoint
      properties:
        role:
          type: string
          description: The role of the message

scripts/music-genre-json.pl  view on Meta::CPAN

                       'Only list the musical genres.',
                       #'Answer in JSON only with an array containing objects { "genre": "the genre", "sub-genre": "the sub genre" }.',
            },
            { role => 'user', content => $prompt },
        ],
    );

    my $chat;
    my $responses = $response->get;
    repeat {
        my $check = eval {
        my ($res) = $responses->shift;
        my $info;
        if( $res ) {
            $info = $res->get;
            local $| = 1;
            #print $info->message->{content};
            $chat .= $info->message->{content};
        };

        Future::Mojo->done( $info->done || !defined $res );

t/00-load.t  view on Meta::CPAN


my $module = $module{ NAME };

require_ok( $module );

diag( sprintf "Testing %s %s, Perl %s", $module, $module->VERSION, $] );

for (sort grep /\.pm\z/, keys %INC) {
   s/\.pm\z//;
   s!/!::!g;
   eval { diag(join(' ', $_, $_->VERSION || '<unknown>')) };
}

xt/99-compile.t  view on Meta::CPAN

#!perl
use warnings;
use strict;
use File::Find;
use Test::More;
BEGIN {
    eval 'use Capture::Tiny ":all"; 1';
    if ($@) {
        plan skip_all => "Capture::Tiny needed for testing";
        exit 0;
    };
};

plan 'no_plan';

require './Makefile.PL';
# Loaded from Makefile.PL

xt/99-minimumversion.t  view on Meta::CPAN

#!perl -w
use strict;
use Test::More;

eval {
  #require Test::MinimumVersion::Fast;
  require Test::MinimumVersion;
  Test::MinimumVersion->import;
};

my @files;

if ($@) {
  plan skip_all => "Test::MinimumVersion required for testing minimum Perl version";
}

xt/99-pod.t  view on Meta::CPAN


# Check our Pod
# The test was provided by Andy Lester,
# who stole it from Brian D. Foy
# Thanks to both !

use File::Spec;
use File::Find;
use strict;

eval {
  require Test::Pod;
  Test::Pod->import;
};

require './Makefile.PL';
# Loaded from Makefile.PL
our %module = get_module_info();

my @files;

xt/99-test-prerequisites.t  view on Meta::CPAN


This test checks whether all tests still pass when the optional test
prerequisites for the test are not present.

This is done by using L<Test::Without::Module> to rerun the test while excluding
the optional prerequisite.

=cut

BEGIN {
    eval {
        require CPAN::Meta::Prereqs;
        require Parse::CPAN::Meta;
        require Perl::PrereqScanner::Lite;
        require Module::CoreList;
        require Test::Without::Module;
        require Capture::Tiny;
        Capture::Tiny->import('capture');
        require Path::Class;
        Path::Class->import('dir');
    };

xt/meta-lint.t  view on Meta::CPAN

#!perl -w

# Stolen from ChrisDolan on use.perl.org
# http://use.perl.org/comments.pl?sid=29264&cid=44309

use warnings;
use strict;
use File::Find;
use Test::More;

eval {
  #require Test::MinimumVersion::Fast;
  require Parse::CPAN::Meta;
  Parse::CPAN::Meta->import();
  require CPAN::Meta::Validator;
  CPAN::Meta::Validator->VERSION(2.15);
};
if ($@) {
  plan skip_all => "CPAN::Meta::Validator version 2.15 required for testing META files";
}
else {



( run in 3.522 seconds using v1.01-cache-2.11-cpan-98e64b0badf )