mirror of
				https://github.com/amithkoujalgi/ollama4j.git
				synced 2025-10-31 16:40:41 +01:00 
			
		
		
		
	init
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/maven-publish.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/maven-publish.yml
									
									
									
									
										vendored
									
									
								
							| @@ -31,7 +31,7 @@ jobs: | ||||
|         settings-path: ${{ github.workspace }} # location for the settings.xml file | ||||
|  | ||||
|     - name: Build with Maven | ||||
|       run: mvn -U -B clean package --file pom.xml | ||||
|       run: mvn -U -B clean verify package --file pom.xml | ||||
|  | ||||
|     - name: Set up Apache Maven Central (Overwrite settings.xml) | ||||
|       uses: actions/setup-java@v3 | ||||
|   | ||||
							
								
								
									
										16
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -41,7 +41,7 @@ | ||||
|             <plugin> | ||||
|                 <groupId>org.sonatype.plugins</groupId> | ||||
|                 <artifactId>nexus-staging-maven-plugin</artifactId> | ||||
|                 <version>1.6.7</version> | ||||
|                 <version>1.6.8</version> | ||||
|                 <extensions>true</extensions> | ||||
|                 <configuration> | ||||
|                     <serverId>ossrh</serverId> | ||||
| @@ -111,6 +111,20 @@ | ||||
|             <artifactId>httpclient5</artifactId> | ||||
|             <version>5.2.1</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>org.junit.jupiter</groupId> | ||||
|             <artifactId>junit-jupiter</artifactId> | ||||
|             <version>RELEASE</version> | ||||
|             <scope>test</scope> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>org.mockito</groupId> | ||||
|             <artifactId>mockito-core</artifactId> | ||||
|             <version>4.1.0</version> | ||||
|             <scope>test</scope> | ||||
|         </dependency> | ||||
|  | ||||
|  | ||||
|     </dependencies> | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,13 +0,0 @@ | ||||
| package io.github.amithkoujalgi.ollama4j; | ||||
|  | ||||
| public class Main { | ||||
|     public static void main(String[] args) throws Exception { | ||||
|         String host = "http://localhost:11434/"; | ||||
|         OllamaAPI ollamaAPI = new OllamaAPI(host); | ||||
|         ollamaAPI.pullModel(OllamaModel.LLAMA2); | ||||
|         String response = ollamaAPI.runSync(OllamaModel.LLAMA2, "Who are you?"); | ||||
|         System.out.println(response); | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -0,0 +1,24 @@ | ||||
| package io.github.amithkoujalgi.ollama4j; | ||||
|  | ||||
| import org.apache.hc.core5.http.ParseException; | ||||
| import org.junit.jupiter.api.Test; | ||||
| import org.mockito.Mockito; | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| import static org.mockito.Mockito.*; | ||||
|  | ||||
| public class TestMockedAPIs { | ||||
|     @Test | ||||
|     public void testMockPullModel() { | ||||
|         OllamaAPI ollamaAPI = Mockito.mock(OllamaAPI.class); | ||||
|         OllamaModel model = OllamaModel.LLAMA2; | ||||
|         try { | ||||
|             doNothing().when(ollamaAPI).pullModel(model); | ||||
|             ollamaAPI.pullModel(model); | ||||
|             verify(ollamaAPI, times(1)).pullModel(model); | ||||
|         } catch (IOException | ParseException | OllamaBaseException e) { | ||||
|             throw new RuntimeException(e); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Amith Koujalgi
					Amith Koujalgi