forked from Mirror/ollama4j
		
	Fixes unmarshalling exception on ModelDetail
This commit is contained in:
		@@ -2,7 +2,8 @@ package io.github.amithkoujalgi.ollama4j.core.models;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 | 
					import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 | 
				
			||||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
					import com.fasterxml.jackson.annotation.JsonProperty;
 | 
				
			||||||
import java.util.Map;
 | 
					import com.fasterxml.jackson.core.JsonProcessingException;
 | 
				
			||||||
 | 
					import io.github.amithkoujalgi.ollama4j.core.utils.Utils;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
@@ -16,5 +17,14 @@ public class ModelDetail {
 | 
				
			|||||||
  private String parameters;
 | 
					  private String parameters;
 | 
				
			||||||
  private String template;
 | 
					  private String template;
 | 
				
			||||||
  private String system;
 | 
					  private String system;
 | 
				
			||||||
  private Map<String, String> details;
 | 
					  private ModelMeta details;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					  public String toString() {
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					      return Utils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
 | 
				
			||||||
 | 
					    } catch (JsonProcessingException e) {
 | 
				
			||||||
 | 
					      throw new RuntimeException(e);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ import static org.junit.jupiter.api.Assertions.*;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import io.github.amithkoujalgi.ollama4j.core.OllamaAPI;
 | 
					import io.github.amithkoujalgi.ollama4j.core.OllamaAPI;
 | 
				
			||||||
import io.github.amithkoujalgi.ollama4j.core.exceptions.OllamaBaseException;
 | 
					import io.github.amithkoujalgi.ollama4j.core.exceptions.OllamaBaseException;
 | 
				
			||||||
 | 
					import io.github.amithkoujalgi.ollama4j.core.models.ModelDetail;
 | 
				
			||||||
import io.github.amithkoujalgi.ollama4j.core.models.OllamaResult;
 | 
					import io.github.amithkoujalgi.ollama4j.core.models.OllamaResult;
 | 
				
			||||||
import io.github.amithkoujalgi.ollama4j.core.models.chat.OllamaChatMessageRole;
 | 
					import io.github.amithkoujalgi.ollama4j.core.models.chat.OllamaChatMessageRole;
 | 
				
			||||||
import io.github.amithkoujalgi.ollama4j.core.models.chat.OllamaChatRequestBuilder;
 | 
					import io.github.amithkoujalgi.ollama4j.core.models.chat.OllamaChatRequestBuilder;
 | 
				
			||||||
@@ -91,6 +92,19 @@ class TestRealAPIs {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @Test
 | 
				
			||||||
 | 
					  @Order(3)
 | 
				
			||||||
 | 
					  void testListDtails() {
 | 
				
			||||||
 | 
					    testEndpointReachability();
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					      ModelDetail modelDetails = ollamaAPI.getModelDetails(config.getModel());
 | 
				
			||||||
 | 
					      assertNotNull(modelDetails);
 | 
				
			||||||
 | 
					      System.out.println(modelDetails);
 | 
				
			||||||
 | 
					    } catch (IOException | OllamaBaseException | InterruptedException | URISyntaxException e) {
 | 
				
			||||||
 | 
					      throw new RuntimeException(e);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Test
 | 
					  @Test
 | 
				
			||||||
  @Order(3)
 | 
					  @Order(3)
 | 
				
			||||||
  void testAskModelWithDefaultOptions() {
 | 
					  void testAskModelWithDefaultOptions() {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user