Application
The backend of Sophora AI is a Spring Boot Java app with an embedded Tomcat. It offers an API interface at http://localhost:8080/api/...
Requirements
Sophora AI needs Java 21 (other versions or the use of an embedded Java upon request.) It also depends on Sophora 5 or higher (other versions upon request.)
PostgreSQL >=15 with the pgvector extension is required as well.
Configuration
To begin with configuring Sophora AI, download the example configuration:
The configuration is broken up into various parts for the different features. Follow these steps to configure Sophora AI optimally:
- Edit
application.yaml(Sophora Server connection, see the Spring Boot Sophora Commons documentation for details.) - Edit
application-database.yaml(database connection.) - Edit
application-llm.yaml(language model connections.) - Edit
application-keywords.yaml(Keywords feature.) The comments in this file will explain how document type configuration merging works. Configuration merging is used in various other feature configuration files. - Edit
application-shorten.yaml(Shorten feature.) The comments in this file will explain the length constraints configuration that is used in some feature configuration files. - Edit the rest of the files.
application-google.yaml file is optional. If absent, the Recommend Links feature will not be available.The
application-embedding-ard-recommender.yaml file is optional. If absent, the ARD Recommender will not be available for use.Preparing the Database
Before running Sophora AI for the first time, an empty PostgreSQL database must be created.
Inside the empty database, run the following commands as the superuser:
CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
Installing and Running
The Sophora AI backend consists of a single JAR file. To start Sophora AI, run the following:
java -jar JARFILE
The configuration files application*.yaml and gcp-credentials.json must be placed in the current working directory.
Using Docker
To run Sophora AI as a Docker container, use the following command.
docker run \
-p 8080:8080 \
$(find $(pwd) -maxdepth 1 -type f -name 'application*.yaml' -printf '--mount type=bind,source=%p,target=/app/config/%P ') \
--mount type=bind,source=$(pwd)/gcp-credentials.json,target=/app/gcp-credentials/credentials.json \
docker.subshell.com/sophora/ai
Note that inside the Docker container, the application will use /app/ as the current working directory. Configuration files must be mounted into /app/config/. The gcp-credentials.json file must be as /app/gcp-credentials/credentials.json.
gcp-credentials.json file is optional. If absent, the Crop Hints feature will not be available.Large Language Models
Sophora AI uses large language models for text and image processing, supporting the following provider APIs:
- OpenAI-compatible: OpenAI, xAI, Perplexity, Groq, using apps such as Ollama or LiteLLM, and other compatible APIs
- Anthropic
Use of other APIs upon request - please contact us.
Google Search (optional)
The Recommend Links feature in Sophora AI uses a Google Custom Search Engine to search the web.
application-google.yaml configuration file is optional. If absent, the Recommend Links feature will not be available.Google Cloud Platform (optional)
The Crop Hints feature in Sophora AI uses Google Cloud Vision on Google Cloud Platform. To use this feature, a gcp-credentials.json credentials file must be placed into the current directory when running the app.
gcp-credentials.json file is optional. If absent, the Crop Hints feature will not be available.ARD Recommender (optional)
The Recommend Documents feature in Sophora AI can use the ARD Recommender as a vector store instead of the internal vector store.
application-embedding-ard-recommender.yaml file is optional. If absent, the ARD Recommender will not be available for use.DeskClient
To use Sophora AI in the Sophora DeskClient you have to install the required document assistant node type. If your DeskClient contains the Document Assistant add-on, it will prompt you to do this after login as an administrator. Afterwards administrators will be able to configure AI assistants in the administration view.
Each AI assistant configuration has the following properties:
- a name for internal display in the administration view
- a label that is displayed on the tab in the AI Assistant view if there are multiple assistants for the open document
- the URL to the AI assistant
- a selection of the document types for which this AI assistant offers support
The AI assistant configuration must be published for the AI Assistant to be displayed in the AI Assistant view.