515. AI Utils Service
The Foretify Manager AI Utils Service is a key component that enhances the functionality of Foretellix's Advanced Interval Filter by delivering AI-powered suggestions to users as they interact with the filter.
516. Enabling the AI Utils Service in Foretify Manager
To enable AI-powered features in Foretify Manager, install and configure the AI Utils Service on a dedicated server. You must also configure the Foretify Manager Assistant with a valid access key to support AI-driven queries and suggestions.
516.1 Basic installation of Foretify Manager AI Utils Service
- Obtain a Foretify Manager installation package (tarball) and extract it to a location (e.g.,
/opt/fmanager/latest). -
Locate the
ai_utils_serviceexecutable located under/opt/fmanager/latest/server/bin/. -
Run the Foretify Manager AI Utils Service server using the command:
/opt/fmanager/latest/server/bin/ai_utils_service -
Verify that the server starts up. By default, the server listens on port 8089.
-
Configure the Foretify Manager
application.propertiesfile with the following property:ai-utils.serverUrl=http://localhost:8089/Then restart the Foretify Manager service. 6. Enable inter-service communication so Foretify Manager can communicate with the AI Utils Service.
516.2 Configuring the Foretify Manager AI Utils Service
A configuration file is provided with the installation package. You can modify the default values of the config.properties file in the path /opt/fmanager/config/ai_utils_service/ to customize the server settings:
-
Server configuration
host: Hostname or IP address the server listens on. Default:0.0.0.0.port: Port number the server listens on. Default:8089.
-
Foretify Manager configuration
host: Hostname or IP address of the Foretify Manager server. Default:localhost.port: Port number for Foretify Manager. Default:8080.https: Whether to use HTTPS when connecting. Default:true.username: Leave empty to use the default username.password: Leave empty to use the default password.
-
Database configuration
db_file_path: Path to the local cache database file.
-
Embedding configuration
assistant_key: API key for the Foretify Manager Assistant. Refer to Setting up the Assistant. Alternatively, you can set theFTX_ASSISTANT_KEYenvironment variable.
516.2.1 Example configuration file
[server]
host = 0.0.0.0
port = 8089
[fmanager]
host = localhost
port = 8080
https = true
[database]
db_file_path = DB/interval_search.db
[embeddings]
assistant_key = <assistant_key>
516.3 Deploying the Foretify Manager AI Utils Service
516.3.1 Running the AI Utils Service as a systemd service
-
Create a new systemd service file:
sudo touch /usr/lib/systemd/system/ai_utils_service.service sudo vi /usr/lib/systemd/system/ai_utils_service.service -
Create the following content in the service file:
[Unit] Description=Foretify Manager AI Utils Service Daemon [Service] WorkingDirectory=/opt/fmanager/config/ai_utils_service ExecStart=/opt/fmanager/latest/server/bin/ai_utils_service SuccessExitStatus=143 Restart=always RestartSec=30 [Install] WantedBy=multi-user.target -
Start the service:
sudo systemctl start ai_utils_service.serviceNote
Ensure that the
WorkingDirectorymatches the location of your configuration files. If your configuration files are stored in a different directory, update theWorkingDirectoryaccordingly.
516.3.2 Running the Foretify Manager AI Utils Service as a Docker container
-
Run the following script to build the
ai_utils_serviceDocker image:/opt/fmanager/latest/docker/ai_utils_service/create_image.sh -
Use the following command to run the container:
docker run -d -p 8089:8089 \ -v /opt/fmanager/config/ai_utils_service/config.properties:/app/config.properties \ -v /opt/fmanager/config/ai_utils_service/DB:/app/DB \ --network=host \ --name ai-utils-service \ --restart=always \ ai-utils-serviceExplanation of the command:
-p 8089:8089: Maps port8089from the container to the host.-v /opt/fmanager/config/ai_utils_service/config.properties:/app/config.properties: Mounts theconfig.propertiesfile into the container.-v /opt/fmanager/config/ai_utils_service/DB:/app/DB: Mounts the local database to the container for persistent cache storage.--network=host: Uses the host's network stack, allowing the container to communicate with services running on the host (e.g., Foretify Manager).ai-utils-service: The name of the Docker image to run.
-
Make sure the
config.propertiesfile correctly references the mounted database folder. For example, if the cache is stored in/opt/fmanager/config/ai_utils_service/DB, set thedb_file_pathproperty inconfig.propertiestodb_file_path=/app/DB.
516.3.3 Configuring Foretify Manager to use the AI Utils Service
-
To configure Foretify Manager to use the AI Utils Service, add the following property to the
application.propertiesfile:ai-utils.serverUrl=http://localhost:8089/ -
If the AI Utils Service is hosted on a different machine, replace
localhostwith that machine's hostname or IP address. -
If you modified the port in your
config.propertiesfile, replace8089with the updated value. -
Restart the Foretify Manager service to apply the changes.