Package io.intino.alexandria.ollama
Class OllamaHttpClient
java.lang.Object
io.intino.alexandria.ollama.OllamaHttpClient
- All Implemented Interfaces:
Ollama,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.intino.alexandria.ollama.Ollama
Ollama.StreamResponse<T> -
Constructor Summary
ConstructorsConstructorDescriptionOllamaHttpClient(String baseUrl) OllamaHttpClient(String baseUrl, Duration timeout) OllamaHttpClient(String baseUrl, Duration timeout, HttpClient httpClient) -
Method Summary
Modifier and TypeMethodDescriptionbaseUrl()voidcall(HttpRequest request) <T extends OllamaResponse>
Tcall(HttpRequest request, Class<T> responseType) <T extends OllamaResponse>
Ollama.StreamResponse<T> callStream(HttpRequest request, Class<T> responseType) chat(OllamaChatRequest chatRequest) chatStream(OllamaChatRequest chatRequest) voidclose()voidcopy(OllamaCopyRequest copyRequest) voidcreateBlob(File file) voidcreateBlob(File file, String digest) createModel(OllamaCreateModelRequest createModelRequest) createModelStream(OllamaCreateModelRequest createModelRequest) voidembed(OllamaEmbedRequest embedRequest) embedFloats(OllamaEmbedRequest embedRequest) booleanexistsBlob(String digest) generate(OllamaGenerateRequest generateRequest) generateStream(OllamaGenerateRequest generateRequest) getCommonHeader(String name) list()ps()pull(OllamaPullRequest pullRequest) pullStream(OllamaPullRequest pullRequest) push(OllamaPushRequest pushRequest) pushStream(OllamaPushRequest pushRequest) removeCommonHeader(String name) setCommonHeader(String name, String value) setCommonHeaders(Map<String, String> headers) show(OllamaShowRequest showRequest) timeout()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.intino.alexandria.ollama.Ollama
chat, chat, chatStream, chatStream, deleteIfExists, exists, generate, generateStream, pull, pullIfNotExists, pullStream, show
-
Constructor Details
-
OllamaHttpClient
public OllamaHttpClient() -
OllamaHttpClient
-
OllamaHttpClient
-
OllamaHttpClient
-
-
Method Details
-
chat
- Specified by:
chatin interfaceOllama- Throws:
OllamaAPIException
-
chatStream
public Ollama.StreamResponse<OllamaChatResponse> chatStream(OllamaChatRequest chatRequest) throws OllamaAPIException - Specified by:
chatStreamin interfaceOllama- Throws:
OllamaAPIException
-
generate
public OllamaGenerateResponse generate(OllamaGenerateRequest generateRequest) throws OllamaAPIException - Specified by:
generatein interfaceOllama- Throws:
OllamaAPIException
-
generateStream
public Ollama.StreamResponse<OllamaGenerateResponse> generateStream(OllamaGenerateRequest generateRequest) throws OllamaAPIException - Specified by:
generateStreamin interfaceOllama- Throws:
OllamaAPIException
-
embed
public OllamaEmbedResponse.OfDouble embed(OllamaEmbedRequest embedRequest) throws OllamaAPIException - Specified by:
embedin interfaceOllama- Throws:
OllamaAPIException
-
embedFloats
public OllamaEmbedResponse.OfFloat embedFloats(OllamaEmbedRequest embedRequest) throws OllamaAPIException - Specified by:
embedFloatsin interfaceOllama- Throws:
OllamaAPIException
-
createModel
public OllamaCreateModelResponse createModel(OllamaCreateModelRequest createModelRequest) throws OllamaAPIException - Specified by:
createModelin interfaceOllama- Throws:
OllamaAPIException
-
createModelStream
public Ollama.StreamResponse<OllamaCreateModelResponse> createModelStream(OllamaCreateModelRequest createModelRequest) throws OllamaAPIException - Specified by:
createModelStreamin interfaceOllama- Throws:
OllamaAPIException
-
list
- Specified by:
listin interfaceOllama- Throws:
OllamaAPIException
-
show
- Specified by:
showin interfaceOllama- Throws:
OllamaAPIException
-
pull
- Specified by:
pullin interfaceOllama- Throws:
OllamaAPIException
-
pullStream
public Ollama.StreamResponse<OllamaPullResponse> pullStream(OllamaPullRequest pullRequest) throws OllamaAPIException - Specified by:
pullStreamin interfaceOllama- Throws:
OllamaAPIException
-
push
- Specified by:
pushin interfaceOllama- Throws:
OllamaAPIException
-
pushStream
public Ollama.StreamResponse<OllamaPushResponse> pushStream(OllamaPushRequest pushRequest) throws OllamaAPIException - Specified by:
pushStreamin interfaceOllama- Throws:
OllamaAPIException
-
ps
- Specified by:
psin interfaceOllama- Throws:
OllamaAPIException
-
copy
- Specified by:
copyin interfaceOllama- Throws:
OllamaAPIException
-
delete
- Specified by:
deletein interfaceOllama- Throws:
OllamaAPIException
-
existsBlob
- Specified by:
existsBlobin interfaceOllama- Throws:
OllamaAPIException
-
createBlob
- Specified by:
createBlobin interfaceOllama- Throws:
OllamaAPIExceptionFileNotFoundException
-
createBlob
- Specified by:
createBlobin interfaceOllama- Throws:
OllamaAPIExceptionFileNotFoundException
-
call
public <T extends OllamaResponse> T call(HttpRequest request, Class<T> responseType) throws OllamaAPIException - Throws:
OllamaAPIException
-
call
- Throws:
OllamaAPIException
-
callStream
public <T extends OllamaResponse> Ollama.StreamResponse<T> callStream(HttpRequest request, Class<T> responseType) throws OllamaAPIException - Throws:
OllamaAPIException
-
baseUrl
-
timeout
-
timeout
-
commonHeaders
-
setCommonHeaders
-
getCommonHeader
-
setCommonHeader
- Specified by:
setCommonHeaderin interfaceOllama
-
removeCommonHeader
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceOllama
-