- Overview
- Prerequisites
- General Steps for Building & Publishing the Chatbot Library
- Importing the Chatbot Library
The Chatbot Library is a versatile and modular component of the ACCESS AI project, designed to manage and customize chatbot entities. It allows for easy integration and replacement of various elements, ensuring flexibility and adaptability. This library is particularly useful for students as it provides tailored information, reduces reliance on public large language models, and offers guidance based on specific educational contexts.
In order to run the Chatbot, the following environment variables are needed:
MISTRAL_API_KEYis the API key for the Mistral API.MISTRAL_EMBEDDING_MODELis the URL of the Mistral embedding model.MISTRAL_EMBEDDING_HOSTis the host of the Mistral embedding model.MISTRAL_LLM_MODELis the URL of the Mistral LLM model.MISTRAL_LLM_HOSTis the host of the Mistral LLM model.VECTOR_STORE_HOSTis the host of the vector store.SIMILARITY_SCORE_THRESHOLDis the similarity score threshold for the vector store.TOP_K_RESULTSis the number of top results to return from the vector store.CHATBOT_DB_URLis the URL of the chatbot database.CHATBOT_DB_USERis the username of the chatbot database.CHATBOT_DB_PASSWORDis the password of the chatbot database.
Add the following code to the build.gradle file in the root directory of the project:
{...}
plugins {
{...}
// Apply the maven-publish plugin to publish your library.
id("maven-publish")
{...}
}
{...}Add the following code to the build.gradle file in the root directory of the project:
{...}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
groupId = "ch.uzh.ifi" // replace with your preferred group ID
artifactId = "access-chatbot" // replace with your preferred artifact ID
version = "1.0.0" // replace with the chatbot version
}
}
{...}
}
{...}Before building and publishing the library, decide on the publishing method. Refer to the specific sections below for guidance on publishing to:
- A Local Repository (default)
- Github Packages
- Maven Central
After configuring, use the following command to build and publish the library:
./gradlew publish- Go to your github account settings
- Click on Developer settings
- Click on Personal access tokens
- Click on Generate new token
- Select the following scopes:
- read:packages
- write:packages
- delete:packages
- Click on Generate token
Add the following line to the gradle.properties file in the root directory of the project:
gpr.github_user=USERNAME
gpr.github_token=PERSONAL_ACCESS_TOKENReplace USERNAME with your github username and PERSONAL_ACCESS_TOKEN with the generated token.
Add the following code to the build.gradle file in the root directory of the project:
{...}
repositories {
mavenCentral()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/USERNAME/REPOSITORY")
credentials {
username = project.findProperty("gpr.github_user") as String?
password = project.findProperty("gpr.github_token") as String?
}
}
{...}
}
{...}Replace USERNAME with your github username and REPOSITORY with the name of the repository. For example, if the repository is at the following github link https://github.com/example-organisation-name-or-username/Chatbot then the maven github repository url would be https://maven.pkg.github.com/example-organisation-name-or-username/Chatbot.
- Sonatype Account: create a Sonatype JIRA account if you don't have one already
Add the following lines to the gradle.properties file in the root directory of the project
signing.gnupg.keyName=KEY_NAME
signing.gnupg.passphrase=KEY_PASSPHRASE
signing.gnupg.secretKeyRingFile=KEY_FILE
sonatypeUsername=SONATYPE_USERNAME
sonatypePassword=SONATYPE_PASSWORDReplace KEY_NAME with the name of your GPG key, KEY_PASSPHRASE with the passphrase of your GPG key, KEY_FILE with the path to your GPG key file, SONATYPE_USERNAME with your Sonatype username and SONATYPE_PASSWORD with your Sonatype password.
{...}
plugins {
id("signing")
}
{...}
repositories {
mavenCentral()
maven {
name = "SonatypeSnapshots"
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
}
maven {
name = "SonatypeStaging"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
}
{...}
}
{...}
signing {
useGpgCmd()
sign(publishing.publications)
}Add the following code to the build.gradle file in the root directory of the project
{...}
publishing {
{...}
repositories {
maven {
url = uri("${buildDir}/repo")
}
}
{...}
}
{...}- Local Repository (default)
- Github Packages
- Maven Central
Add the following code to the build.gradle file in the root directory of the project:
{...}
dependencies {
implementation("ch.uzh.ifi:access-chatbot:1.0.0")
{...}
}
{...}Add the following line to the gradle.properties file in the root directory of the project:
gpr.github_user=USERNAME
gpr.github_token=PERSONAL_ACCESS_TOKENAdd the following code to the build.gradle file in the root directory of the project:
{...}
repositories {
mavenCentral()
maven {
name = "GitHubPackages"
url = uri("MAVEN_GITHUB_URL")
credentials {
username = project.findProperty("gpr.github_user") as String?
password = project.findProperty("gpr.github_token") as String?
}
}
{...}
}
{...}Replace MAVE_GITHUB_URL with the maven github repository url you used to publish the library. In the example above, the maven github repository url is https://maven.pkg.github.com/example-organisation-name-or-username/Chatbot.
Add the following code to the build.gradle file in the root directory of the project:
{...}
repositories {
mavenCentral()
maven {
name = "SonatypeSnapshots"
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
}
{...}
}
{...}Add the following code to the build.gradle file in the root directory of the project:
{...}
repositories {
maven {
url = uri("${buildDir}/repo")
}
{...}
}
{...}