mirror of
				https://github.com/amithkoujalgi/ollama4j.git
				synced 2025-11-04 02:20:50 +01:00 
			
		
		
		
	Compare commits
	
		
			62 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					981a033a1d | ||
| 
						 | 
					e3a8f1e153 | ||
| 
						 | 
					2cefc1e80a | ||
| 
						 | 
					275649329a | ||
| 
						 | 
					581400d44d | ||
| 
						 | 
					b0733dcd87 | ||
| 
						 | 
					148b748efb | ||
| 
						 | 
					9c52368ab2 | ||
| 
						 | 
					729dd9c41f | ||
| 
						 | 
					4b49d6004c | ||
| 
						 | 
					7fd27634d4 | ||
| 
						 | 
					ea64fc4677 | ||
| 
						 | 
					376cd28e0c | ||
| 
						 | 
					31c47c6468 | ||
| 
						 | 
					2e34a1514c | ||
| 
						 | 
					dae99e839d | ||
| 
						 | 
					877901ccff | ||
| 
						 | 
					0fec81eef7 | ||
| 
						 | 
					4dd27b3e1a | ||
| 
						 | 
					a06ededd46 | ||
| 
						 | 
					1c687831d1 | ||
| 
						 | 
					2c2750b3e1 | ||
| 
						 | 
					809efa9053 | ||
| 
						 | 
					4a7e9ac7f0 | ||
| 
						 | 
					04f9e77149 | ||
| 
						 | 
					553e7dab41 | ||
| 
						 | 
					3a75cd7e92 | ||
| 
						 | 
					c45b5de3ea | ||
| 
						 | 
					6c2b3ca206 | ||
| 
						 | 
					1ff5fbfc9f | ||
| 
						 | 
					929242cc26 | ||
| 
						 | 
					d854f82966 | ||
| 
						 | 
					585858a99a | ||
| 
						 | 
					95fa72c1ec | ||
| 
						 | 
					59015dff8f | ||
| 
						 | 
					d601ce0e1e | ||
| 
						 | 
					9820248115 | ||
| 
						 | 
					7ff040f706 | ||
| 
						 | 
					f4b83c2860 | ||
| 
						 | 
					082b708927 | ||
| 
						 | 
					8a895e02fb | ||
| 
						 | 
					b878fb7b3f | ||
| 
						 | 
					5c66d8df5f | ||
| 
						 | 
					ebd34a536d | ||
| 
						 | 
					f2c7169aca | ||
| 
						 | 
					875d1c50b0 | ||
| 
						 | 
					8c4533b704 | ||
| 
						 | 
					bb50a66d80 | ||
| 
						 | 
					e8dccd9b6a | ||
| 
						 | 
					cc1d2c4dc1 | ||
| 
						 | 
					8e93e580cd | ||
| 
						 | 
					97e3df4f44 | ||
| 
						 | 
					8b2dccdae1 | ||
| 
						 | 
					7486016e85 | ||
| 
						 | 
					1b4ad78acf | ||
| 
						 | 
					9936200dcc | ||
| 
						 | 
					5bd3573123 | ||
| 
						 | 
					761f82f321 | ||
| 
						 | 
					9ec8e5155b | ||
| 
						 | 
					47c014968d | ||
| 
						 | 
					e50b978aa0 | ||
| 
						 | 
					51a57384e1 | 
							
								
								
									
										17
									
								
								.github/workflows/maven-publish.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								.github/workflows/maven-publish.yml
									
									
									
									
										vendored
									
									
								
							@@ -5,7 +5,7 @@ name: Test and Publish Package
 | 
			
		||||
 | 
			
		||||
#on:
 | 
			
		||||
#  release:
 | 
			
		||||
#    types: [created]
 | 
			
		||||
#    types: [ "created" ]
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
@@ -40,11 +40,24 @@ jobs:
 | 
			
		||||
          server-password: MAVEN_PASSWORD
 | 
			
		||||
          gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
 | 
			
		||||
          gpg-passphrase: MAVEN_GPG_PASSPHRASE
 | 
			
		||||
      - name: Set up Maven cache
 | 
			
		||||
        uses: actions/cache@v3
 | 
			
		||||
        with:
 | 
			
		||||
          path: ~/.m2/repository
 | 
			
		||||
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
 | 
			
		||||
          restore-keys: |
 | 
			
		||||
            ${{ runner.os }}-maven-
 | 
			
		||||
      - name: Build
 | 
			
		||||
        run: mvn -B -ntp clean install
 | 
			
		||||
      - name: Publish to GitHub Packages Apache Maven
 | 
			
		||||
        #        if: >
 | 
			
		||||
        #          github.event_name != 'pull_request' &&
 | 
			
		||||
        #          github.ref_name == 'main' &&
 | 
			
		||||
        #          contains(github.event.head_commit.message, 'release')
 | 
			
		||||
        run: |
 | 
			
		||||
          git config --global user.email "koujalgi.amith@gmail.com"
 | 
			
		||||
          git config --global user.name "amithkoujalgi"
 | 
			
		||||
          mvn clean -Punit-tests release:clean release:prepare release:perform -B -Darguments="-DskipTests -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}"
 | 
			
		||||
          mvn -B -ntp -DskipTests -Pci-cd -Darguments="-DskipTests -Pci-cd" release:clean release:prepare release:perform
 | 
			
		||||
        env:
 | 
			
		||||
          MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
 | 
			
		||||
          MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,17 +1,13 @@
 | 
			
		||||
build:
 | 
			
		||||
	mvn -B clean install
 | 
			
		||||
 | 
			
		||||
ut:
 | 
			
		||||
	mvn clean test -Punit-tests
 | 
			
		||||
 | 
			
		||||
it:
 | 
			
		||||
	mvn clean verify -Pintegration-tests
 | 
			
		||||
 | 
			
		||||
build:
 | 
			
		||||
	mvn clean test install -Punit-tests
 | 
			
		||||
 | 
			
		||||
release:
 | 
			
		||||
	mvn clean -Punit-tests release:clean release:prepare release:perform -B
 | 
			
		||||
 | 
			
		||||
update-version:
 | 
			
		||||
	mvn versions:set -DnewVersion=1.0.1
 | 
			
		||||
 | 
			
		||||
deploy:
 | 
			
		||||
	mvn clean deploy -Punit-tests -Dgpg.passphrase="$GPG_PASSPHRASE" -e
 | 
			
		||||
list-releases:
 | 
			
		||||
	curl 'https://central.sonatype.com/api/internal/browse/component/versions?sortField=normalizedVersion&sortDirection=asc&page=0&size=12&filter=namespace%3Aio.github.amithkoujalgi%2Cname%3Aollama4j' \
 | 
			
		||||
      --compressed \
 | 
			
		||||
      --silent | jq '.components[].version'
 | 
			
		||||
							
								
								
									
										37
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								README.md
									
									
									
									
									
								
							@@ -53,34 +53,27 @@ for [Ollama](https://github.com/jmorganca/ollama/blob/main/docs/api.md) APIs.
 | 
			
		||||
 | 
			
		||||
#### Installation
 | 
			
		||||
 | 
			
		||||
In your Maven project, add this dependency available in:
 | 
			
		||||
 | 
			
		||||
- https://central.sonatype.com/artifact/io.github.amithkoujalgi/ollama4j
 | 
			
		||||
- [Central Repository](https://s01.oss.sonatype.org/#nexus-search;quick~ollama4j)
 | 
			
		||||
In your Maven project, add this dependency:
 | 
			
		||||
 | 
			
		||||
```xml
 | 
			
		||||
 | 
			
		||||
<dependency>
 | 
			
		||||
    <groupId>io.github.amithkoujalgi</groupId>
 | 
			
		||||
    <artifactId>ollama4j</artifactId>
 | 
			
		||||
    <version>1.0-SNAPSHOT</version>
 | 
			
		||||
    <version>1.0.20</version>
 | 
			
		||||
</dependency>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
You might want to include the Maven repository to pull the ollama4j library from. Include this in
 | 
			
		||||
your `pom.xml`:
 | 
			
		||||
https://img.shields.io/maven-central/v/io.github.amithkoujalgi/ollama4j
 | 
			
		||||
 | 
			
		||||
```xml
 | 
			
		||||
[![][lib-shield]][lib]
 | 
			
		||||
 | 
			
		||||
<repositories>
 | 
			
		||||
    <repository>
 | 
			
		||||
        <id>ollama4j-from-ossrh</id>
 | 
			
		||||
        <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
 | 
			
		||||
    </repository>
 | 
			
		||||
</repositories>
 | 
			
		||||
```
 | 
			
		||||
[lib]: https://central.sonatype.com/artifact/io.github.amithkoujalgi/ollama4j
 | 
			
		||||
 | 
			
		||||
You should also include an implementation of [SL4J](https://www.slf4j.org/) logger in your `pom.xml` file. For example,
 | 
			
		||||
[lib-shield]: https://img.shields.io/badge/ollama4j-get_latest_version-blue.svg?style=for-the-badge&labelColor=gray
 | 
			
		||||
 | 
			
		||||
You might want to include an implementation of [SL4J](https://www.slf4j.org/) logger in your `pom.xml` file. For
 | 
			
		||||
example,
 | 
			
		||||
 | 
			
		||||
Use `slf4j-jdk14` implementation:
 | 
			
		||||
 | 
			
		||||
@@ -106,14 +99,6 @@ or use `logback-classic` implementation:
 | 
			
		||||
 | 
			
		||||
or use other suitable implementations.
 | 
			
		||||
 | 
			
		||||
#### Build:
 | 
			
		||||
 | 
			
		||||
Build your project to resolve the dependencies:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
mvn clean install -U
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
You can then use the Ollama Java APIs by importing `ollama4j`:
 | 
			
		||||
 | 
			
		||||
```java
 | 
			
		||||
@@ -468,6 +453,10 @@ Run integration tests:
 | 
			
		||||
make it
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Releases
 | 
			
		||||
 | 
			
		||||
Releases (newer artifact versions) are done automatically on pushj g code to the `main` branch through GitHub Actions CI workflow.
 | 
			
		||||
 | 
			
		||||
#### Traction
 | 
			
		||||
 | 
			
		||||
[](https://star-history.com/#amithkoujalgi/ollama4j&Date)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,16 @@
 | 
			
		||||
Understanding publishing:
 | 
			
		||||
https://dzone.com/articles/how-to-publish-artifacts-to-maven-central
 | 
			
		||||
 | 
			
		||||
GPG Signing setup
 | 
			
		||||
Reference Repo:
 | 
			
		||||
https://github.com/dsibilio/badge-maker/tree/main
 | 
			
		||||
 | 
			
		||||
## GPG Setup
 | 
			
		||||
## GPG Signing setup
 | 
			
		||||
 | 
			
		||||
### GPG Setup
 | 
			
		||||
 | 
			
		||||
https://central.sonatype.org/publish/requirements/gpg/#listing-keys
 | 
			
		||||
 | 
			
		||||
### Steps
 | 
			
		||||
#### Steps
 | 
			
		||||
 | 
			
		||||
- Create key: `gpg --gen-key` and then list keys to verify: `gpg --list-keys`
 | 
			
		||||
- Distributing Your Public Key:
 | 
			
		||||
@@ -33,4 +36,19 @@ gpg --armor --export-secret-keys 88AA0C903A513340A0F3094326257A6F6F5F24A9 > ~/ol
 | 
			
		||||
 | 
			
		||||
https://central.sonatype.org/publish/publish-maven/
 | 
			
		||||
 | 
			
		||||
### Steps
 | 
			
		||||
## List release versions
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
curl 'https://central.sonatype.com/api/internal/browse/component/versions?sortField=normalizedVersion&sortDirection=desc&page=0&size=12&filter=namespace%3Aio.github.amithkoujalgi%2Cname%3Aollama4j' \
 | 
			
		||||
  --compressed \
 | 
			
		||||
  --silent | jq '.components[].version'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Deployment steps to test. [IGNORE THIS FOR PUBLISHING CONTEXT. THIS IS ONLY TO TEST STUFF OUT LOCALLY]
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
# release:
 | 
			
		||||
mvn -B clean install deploy -Punit-tests -Dgpg.passphrase="${GPG_PASSPHRASE}" -e
 | 
			
		||||
#or
 | 
			
		||||
mvn -B clean install -Punit-tests release:clean release:prepare release:perform -Dgpg.passphrase="${GPG_PASSPHRASE}" -e
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										107
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										107
									
								
								pom.xml
									
									
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
    <groupId>io.github.amithkoujalgi</groupId>
 | 
			
		||||
    <artifactId>ollama4j</artifactId>
 | 
			
		||||
    <version>1.0.5</version>
 | 
			
		||||
    <version>1.0.24</version>
 | 
			
		||||
 | 
			
		||||
    <name>Ollama4j</name>
 | 
			
		||||
    <description>Java library for interacting with Ollama API.</description>
 | 
			
		||||
@@ -39,22 +39,11 @@
 | 
			
		||||
        <connection>scm:git:git@github.com:amithkoujalgi/ollama4j.git</connection>
 | 
			
		||||
        <developerConnection>scm:git:https://github.com/amithkoujalgi/ollama4j.git</developerConnection>
 | 
			
		||||
        <url>https://github.com/amithkoujalgi/ollama4j</url>
 | 
			
		||||
        <tag>v1.0.5</tag>
 | 
			
		||||
        <tag>v1.0.24</tag>
 | 
			
		||||
    </scm>
 | 
			
		||||
 | 
			
		||||
    <build>
 | 
			
		||||
        <plugins>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.sonatype.plugins</groupId>
 | 
			
		||||
                <artifactId>nexus-staging-maven-plugin</artifactId>
 | 
			
		||||
                <version>1.6.13</version>
 | 
			
		||||
                <extensions>true</extensions>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <serverId>ossrh</serverId>
 | 
			
		||||
                    <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
 | 
			
		||||
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                <artifactId>maven-source-plugin</artifactId>
 | 
			
		||||
@@ -81,27 +70,27 @@
 | 
			
		||||
                    </execution>
 | 
			
		||||
                </executions>
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                <artifactId>maven-gpg-plugin</artifactId>
 | 
			
		||||
                <version>1.5</version>
 | 
			
		||||
                <executions>
 | 
			
		||||
                    <execution>
 | 
			
		||||
                        <id>sign-artifacts</id>
 | 
			
		||||
                        <phase>verify</phase>
 | 
			
		||||
                        <goals>
 | 
			
		||||
                            <goal>sign</goal>
 | 
			
		||||
                        </goals>
 | 
			
		||||
                        <configuration>
 | 
			
		||||
                            <!-- This is necessary for gpg to not try to use the pinentry programs -->
 | 
			
		||||
                            <gpgArguments>
 | 
			
		||||
                                <arg>--pinentry-mode</arg>
 | 
			
		||||
                                <arg>loopback</arg>
 | 
			
		||||
                            </gpgArguments>
 | 
			
		||||
                        </configuration>
 | 
			
		||||
                    </execution>
 | 
			
		||||
                </executions>
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <!--            <plugin>-->
 | 
			
		||||
            <!--                <groupId>org.apache.maven.plugins</groupId>-->
 | 
			
		||||
            <!--                <artifactId>maven-gpg-plugin</artifactId>-->
 | 
			
		||||
            <!--                <version>1.5</version>-->
 | 
			
		||||
            <!--                <executions>-->
 | 
			
		||||
            <!--                    <execution>-->
 | 
			
		||||
            <!--                        <id>sign-artifacts</id>-->
 | 
			
		||||
            <!--                        <phase>verify</phase>-->
 | 
			
		||||
            <!--                        <goals>-->
 | 
			
		||||
            <!--                            <goal>sign</goal>-->
 | 
			
		||||
            <!--                        </goals>-->
 | 
			
		||||
            <!--                        <configuration>-->
 | 
			
		||||
            <!--                            <!– This is necessary for gpg to not try to use the pinentry programs –>-->
 | 
			
		||||
            <!--                            <gpgArguments>-->
 | 
			
		||||
            <!--                                <arg>--pinentry-mode</arg>-->
 | 
			
		||||
            <!--                                <arg>loopback</arg>-->
 | 
			
		||||
            <!--                            </gpgArguments>-->
 | 
			
		||||
            <!--                        </configuration>-->
 | 
			
		||||
            <!--                    </execution>-->
 | 
			
		||||
            <!--                </executions>-->
 | 
			
		||||
            <!--            </plugin>-->
 | 
			
		||||
            <!-- Surefire Plugin for Unit Tests -->
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
@@ -143,7 +132,7 @@
 | 
			
		||||
                <artifactId>maven-release-plugin</artifactId>
 | 
			
		||||
                <version>3.0.1</version>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <goals>install</goals>
 | 
			
		||||
                    <!--                    <goals>install</goals>-->
 | 
			
		||||
                    <tagNameFormat>v@{project.version}</tagNameFormat>
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
@@ -206,6 +195,9 @@
 | 
			
		||||
                <skipUnitTests>false</skipUnitTests>
 | 
			
		||||
                <skipIntegrationTests>true</skipIntegrationTests>
 | 
			
		||||
            </properties>
 | 
			
		||||
            <activation>
 | 
			
		||||
                <activeByDefault>true</activeByDefault>
 | 
			
		||||
            </activation>
 | 
			
		||||
        </profile>
 | 
			
		||||
        <profile>
 | 
			
		||||
            <id>integration-tests</id>
 | 
			
		||||
@@ -215,6 +207,51 @@
 | 
			
		||||
                <skipIntegrationTests>false</skipIntegrationTests>
 | 
			
		||||
            </properties>
 | 
			
		||||
        </profile>
 | 
			
		||||
        <profile>
 | 
			
		||||
            <id>ci-cd</id>
 | 
			
		||||
            <properties>
 | 
			
		||||
                <test.env>unit</test.env>
 | 
			
		||||
                <skipUnitTests>true</skipUnitTests>
 | 
			
		||||
                <skipIntegrationTests>true</skipIntegrationTests>
 | 
			
		||||
            </properties>
 | 
			
		||||
            <build>
 | 
			
		||||
                <plugins>
 | 
			
		||||
                    <plugin>
 | 
			
		||||
                        <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                        <artifactId>maven-gpg-plugin</artifactId>
 | 
			
		||||
                        <version>3.1.0</version>
 | 
			
		||||
                        <executions>
 | 
			
		||||
                            <execution>
 | 
			
		||||
                                <id>sign-artifacts</id>
 | 
			
		||||
                                <phase>verify</phase>
 | 
			
		||||
                                <goals>
 | 
			
		||||
                                    <goal>sign</goal>
 | 
			
		||||
                                </goals>
 | 
			
		||||
                                <configuration>
 | 
			
		||||
                                    <!-- Prevent gpg from using pinentry programs. Fixes:
 | 
			
		||||
                                         gpg: signing failed: Inappropriate ioctl for device -->
 | 
			
		||||
                                    <gpgArguments>
 | 
			
		||||
                                        <arg>--pinentry-mode</arg>
 | 
			
		||||
                                        <arg>loopback</arg>
 | 
			
		||||
                                    </gpgArguments>
 | 
			
		||||
                                </configuration>
 | 
			
		||||
                            </execution>
 | 
			
		||||
                        </executions>
 | 
			
		||||
                    </plugin>
 | 
			
		||||
                    <plugin>
 | 
			
		||||
                        <groupId>org.sonatype.plugins</groupId>
 | 
			
		||||
                        <artifactId>nexus-staging-maven-plugin</artifactId>
 | 
			
		||||
                        <version>1.6.13</version>
 | 
			
		||||
                        <extensions>true</extensions>
 | 
			
		||||
                        <configuration>
 | 
			
		||||
                            <serverId>ossrh</serverId>
 | 
			
		||||
                            <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
 | 
			
		||||
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
 | 
			
		||||
                        </configuration>
 | 
			
		||||
                    </plugin>
 | 
			
		||||
                </plugins>
 | 
			
		||||
            </build>
 | 
			
		||||
        </profile>
 | 
			
		||||
    </profiles>
 | 
			
		||||
 | 
			
		||||
</project>
 | 
			
		||||
		Reference in New Issue
	
	Block a user