Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
OllamaEmbedRequest.java
Go to the documentation of this file.
1/*
2 * Ollama4j - Java library for interacting with Ollama server.
3 * Copyright (c) 2025 Amith Koujalgi and contributors.
4 *
5 * Licensed under the MIT License (the "License");
6 * you may not use this file except in compliance with the License.
7 *
8*/
9package io.github.ollama4j.models.embed;
10
11import static io.github.ollama4j.utils.Utils.getObjectMapper;
12
13import com.fasterxml.jackson.annotation.JsonProperty;
14import com.fasterxml.jackson.core.JsonProcessingException;
15import java.util.List;
16import java.util.Map;
17import lombok.*;
18
19@SuppressWarnings("NullableProblems")
20@Data
21@RequiredArgsConstructor
22@NoArgsConstructor
23public class OllamaEmbedRequest {
24 @NonNull private String model;
25
26 @NonNull private List<String> input;
27
28 private Map<String, Object> options;
29
30 @JsonProperty(value = "keep_alive")
31 private String keepAlive;
32
33 @JsonProperty(value = "truncate")
34 private Boolean truncate = true;
35
36 @Override
37 public String toString() {
38 try {
39 return getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
40 } catch (JsonProcessingException e) {
41 throw new RuntimeException(e);
42 }
43 }
44}