Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 1.5 KB

README.md

File metadata and controls

57 lines (38 loc) · 1.5 KB

OLLAMA Java Client

Model Description

OllamaService

The OllamaService interface provide the interaction with the ollama web service.

public interface OllamaService {
    CompletionResponse completion(CompletionRequest completionRequest);

    TagsResponse getTags();

    ShowResponse show(ShowRequest showRequest);

    void copy(CopyRequest copyRequest);

    void delete(String modelName);

    void streamingCompletion(CompletionRequest completionRequest, StreamResponseProcessor<String> handler);

    EmbeddingResponse embed(EmbeddingRequest embeddingRequest);
}

OllamaServiceFactory

The OllamaServiceFactory class is responsible for creating instances of the OllamaService. It provides builder methods to create an instance of the service with the specified configuration.

public class OllamaServiceFactory {
    public static OllamaService create(OllamaProperties properties) { // ...
    }

    public static OllamaService create(OllamaProperties properties, Gson gson) { // ...
    }
}

StreamResponseProcessor

The StreamResponseProcessor interface provides methods to process streaming completion responses.

public interface StreamResponseProcessor<T> {
    void processStreamItem(T item);

    void processCompletion(T fullResponse);

    void processError(Throwable throwable);
}