Git Product home page Git Product logo

ollama-php's People

Contributors

evowareio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nacho-at

ollama-php's Issues

Using embeddings generated

How can I use the generated embeddings with the generateCompletion() function?
I tried setting it as an option

$embeddings = $ollamaClient->generateEmbeddings($documents, 'nomic-embed-text');
$response = $ollamaClient->generateCompletion($prompt, 'tinyllama', ['model' => 'tinyllama', 'embedding' => $embeddings]);

but that didnt work, neither did adding them in the prompt.

'Handling streaming responses.'

there's an implementation of using json-streaming over here:
https://github.com/jdecool/ollama-php-client/blob/040ed0803e2b73bbc5e14b441e59c55bacfd0559/src/Client.php#L33
https://github.com/jdecool/ollama-php-client/blob/040ed0803e2b73bbc5e14b441e59c55bacfd0559/src/Client.php#L147
https://github.com/jdecool/ollama-php-client/blob/040ed0803e2b73bbc5e14b441e59c55bacfd0559/src/Http.php#L33

I'm using their package, but would probably have used yours if it had streaming..

<?php 
require __DIR__.'/vendor/autoload.php';

use JDecool\OllamaClient\ClientBuilder;
use JDecool\OllamaClient\Client\Message;
use JDecool\OllamaClient\Client\Request\ChatRequest;

$builder = new ClientBuilder();
$client = $builder->create('http://localhost:11434');


$request = new ChatRequest('phi3:mini', [
    new Message('user', 'Why is the sky blue?'),
]);

// async
foreach ($client->chatStream($request) as $chunk) {
    //var_dump($chunk);
    $msg = $chunk->message;
    echo $msg->content;
}
print "\n";

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.