Blog

Using the new Gramps Web AI Chat Assistant
author David Straub

2024-11-08

Using the new Gramps Web AI Chat Assistant

This is the second in a series of posts about the new Gramps Web AI chat assistant and it focuses on how to set it up and use it.

Before we begin

The Gramps Web AI chat assistant is a new feature with a limited initial scope. If the results feel underwhelming, please keep in mind that this is just the beginning – additional capabilities will be introduced over time.

Enabling the Chat Assistant

If you’re a tree owner, this section will tell you how to enable chat, assuming you’re on a server that has it already installed and activated. Note that chat is not rolled out on Grampshub yet (but will be soon). If you are administering your own Gramps Web server, please head to the documentation first. If you are a normal user, you can directly jump to the next section, assuming your tree owner has enabled chat.

To enable chat for your tree, two steps are necessary: first, creating the semantic search index; second, configuring the user groups that are allowed to use chat.

To create the semantic search index, head to the settings page and open the Administration tab. If all dependencies have been installed and set up properly, you should see a section “Manage the semantic search index”. If the “Status” beneath it shows 0, click on “Update semantic search index”. Note that this operation can take many hours, depending on the embedding model and the size of your tree! You can close the window and come back later – the operation will continue in the background and the progress will be shown when you come back to the page. Please execute this function only once as it consumes signficant computational resources!

In the meantime, you can navigate to the “Manage users” tab and select a user group from the dropdown “User groups allowed to use AI chat”. When you select “Everybody”, it means all registered users of your tree can use AI chat when they are logged in. Note that the same privacy restrictions as anywhere else in Gramps Web apply to the chat assistant: users in the “guest” group cannot see any data marked as private, and the chat assistant will not return answers exposing private data to them.

If you don’t see any of the options described above on the settings page, please check the “System information” tab. It should show chat: true if chat is installed and configured on the server.

Using the Chat Assistant

The chat assistant can be found under “Chat” in the main menu. To get started, type a question into the chat box at the bottom of the window and hit Enter or click the send button. After at most a few seconds, an answer should appear.

To better understand which type of questions the assistant can currently answer, it is useful to understand how it works: based on the question and natural language processing, the assistant identifies a limited number of Gramps objects that are likely to contain the answer. It then uses the information contained in those Gramps obejcts to formulate an answer. Gramps objects can be a person, family, event, place, source, citation, repository, note, or media object.

This means that the assistant can help looking for individual objects, but it is currently not able to understand more complicated logic (“which of the great-grandfathers of John Doe were born after 1875?”).

How well it can answer also depends a lot on the amount and level of detail of the data in your tree, so you will have to experiment.

Questions that could work:

  • “Who worked as carpenter?” (It will answer based on retrieved events of type occupation.)
  • “Who are the parents of John Doe?” (It will answer based on retrieved families with a child named similarly to John Doe.)
  • “Who got divorced?” (Families with an event of type divorce.)
  • “What happened in 1823 in Springfield?” (Events with a given date and place.)

As you find out what works and what doesn’t, please share your experience with the community, e.g. in the Gramps forum or even by updating the Gramps Web documentation.

By the way, if your server administrator configured Gramps Web to use multilingual models, you can talk to the chat assistant in your native language and it will answer in that language as well!

Clearing the history

By default, the chat assistant attempts to formulate an answer based on the last few questions and answers, so you can ask a follow-up question. If you want to ask something about a new topic, it is better to clear the history by clicking the “New” button in the top-left corner. This avoids possible confusion of the chat assistant by irrelevant message history.

Gramps Web currently does not allow to store the history of past conversations. The most recent conversation is remembered until you click the “New” button, but is stored locally on the device, not on the server, so is not synchronized across devices.

Interpreting results

As with most AI-based applications, keep in mind that answers can contain incorrect and misleading information. An advantage of the Gramps Web chat assistant compared to other AI assistants is that it will only answer based on information it finds in your Gramps database. So even if it can misunderstand – or fail to find – the relevant information, you can always review the original source to double-check.

When referring to Gramps objects like people, families etc., the assistant will attempt to link them in the answer, so you can directly navigate to the object by clicking on the link. Don’t worry, the answer will still be visible when you go back to the chat page.

If the assistant answers something that you think is wrong or incomplete, or it refuses to answer even if you think the answer should be contained in your Gramps database, you can better understand what’s going on by using semantic search. You can find semantic search by navigating to the normal search page in Gramps Web and selecting “semantic” instead of “full-text” in the new toggle switch in the top right corner. With semantic search enabled, enter your question into the search box and hit Enter. Gramps Web will return a list of all Gramps objects in your database, ordered by semantic similarity to your question. The reason this is useful to understand the chat assistant is because the AI model will use the content of the first couple of objects in this semantic search result to formulate its questanswerion (see the previous blog post for technical details). If the assistant can’t answer your question, it’s likely that the semantic search result returns the wrong set of objects. You can experiment with reformulating your question to see how to return more fitting results.

Summary

The Gramps Web AI chat assistant provides a new way to explore your family tree by answering questions based on data in your Gramps database. It’s designed to help with simple queries, linking directly to relevant information in your records. Your feedback to the community will help making this new tool more powerful in the future.