The local machine is very old, but that is fine, it can execute each gramps query at the expected speed of this old machine.
I the model usually does select the correct tools, and it also says what kind of tools might be missing. That is, A reply once had:
“Sorry I can not search for a family this person is a parent in.” Or “I don’t have access it know how to access that information”
Sometimes it is hallucinating responses and comes up with people that are not even in the database!
We should probably extend the descriptions of each individual tool to explain what all the nitty gritty details and fields in a person response mean to act upon that.
Hi @dsblank finally managed to add a “find_people” tool, so that we can search on people by name in the database.
I needed to also restrict the AI Model from looping, and added a final prompt after a few tries, not providing any tools anymore, to force an answer from the local running modal.
You might want to try out or just look at some of the code updates:
True about small trees. When a tree contains tens or hundreds of thousands people this won’t perform.
Also notice the summarization of the results with “desired fields”
As I found that even a result on a lastname with about 25 matching people, resulted in a huge json addition to the context window of the chat history, so we have to be careful, especially with local smaller models.
That subroutine seems to ignore some of the common name options. Will it make the chatbot too formal to recognize all the possibilities?
For instance, when searching for people who colaborate online, I might only recall their online name. So if I search a Gramps tree for kku, I’d want to find Kari Kujansuu. Some people haven’t shared their personal names. For instance, I only know CallMeDave (on the Gramps Reddit and the wiki) by that name.
Have tried the routine to search on a lot of name options, but then limit the output to the common names.
I’m a bit surprised that you mention to want to find nicknames? Usually the genealogy tree that is being searched by the tool has “real names”, maybe I’m misunderstanding the concern, or I might indeed have missed an important name field like alternate names to be found.
Other then that: when playing with the tools, also tried several small AI models, and some of those have a hard time understanding the tooling provided. That is, not all models understand when to provide the appropriate arguments for tools, it get into indefinite loops, so the mayor changes are also in the final decision: not providing the tools and force the model to provide an answer.
Hi @dsblank finally came around trying to build a Gramplet, and managed to get it working with Gemini inside Gramps.
I lend a lot of your original code, refactored a lot, took some tool chain calling out of the for loop, and tried a few other things. Gramplet development is not easy but the online documentation did help a lot.
The gramplet code has been pushed to github, and I tried to follow the development guide accordingly. Eventually was able to get the plugin to work inside the locally build gramps 6.0.4 instance.
The plugin (tar.gz) should be available for others to try out as well, but I have set it to be UNSTABLE so if you want to try it out you have to filter for the unstable version on this repo:
The additional tool that I added was to search for names - that still uses the SimpleAccess database so just filters on all people in the database - this can be very slow if you have a large database, but on my local database (about 4500 persons) it works quick.
What else do you need? You need a GEMINI api key. In the chat window you can also type “help” for the default instructions and what environment variables are to be set.
The end result is really nice and makes interactions possible like the following:
As I’m a total newby to gramps development, and also GTK development, of course I made use of AI to help me out on the code - but still tried to keep it as clean as possible. I do have a few questions on gramps development but just wanted to share this update as finally the gramplet “works” with a remote AI model, so that’s cool. I realize the code is not polished at all, and to be honest I do not know how to properly polish things like the languages, or just only push the gramplet and listings of the gramplet that I’m working on, instead of updating all language files, which I found a bit strange - anyways - any pointers would be great! If you or others want to try out this gramplet please let me know your findings!
Noted that you have a mix of 5.2 and 6.0 collections in your Addon Manager Projects
You will want to be careful to use the right version addon collection for your version of Gramps. For some (like the Isotammi collection that has dynamic versioning), it won’t matter very much. But most have registrations that are sensitive to the version.
Would it be possible to create a discussion-based source, with notes issued from the chat, and add citations for some (all?) of these (questions and) answers for use elsewhere? (But I don’t know if a discussion-based source with an LLM is a good idea in itself)
Noted that you have a mix of 5.2 and 6.0 collections in your Addon Manager Projects
I simply clonsed the addons and addons-source repo’s per the documentation, and those contain all the addons.
Should I have cloned and/or published differently? I am hesistant to remove “tar.gz” files as when I delete stuff and make a commit, then those deletions would also end up when I eventually want to do a merge request to gramps-project, right?
Let me know how to proceed - maybe by creating a separate thread in Development forum?
I think what @emyoulation means is that the screenshot of your ‘Projects’ tab shows that you are not accessing the latest version of Family Tree View. For Gramps v6 the URL for the FTV project is: https://raw.githubusercontent.com/ztlxltl/FamilyTreeView/dist/gramps60
The idea of creating references for LLM results is a great idea. In the current implementation it could be a list of function calls, like:
Look up families of person I0034
Consider families F0016, F0032, and F0056
Look up person I0089, the father of F0032
Return results based on the above
Of course those Gramps IDs could be expanded into a more useful description, and also be links to those person and family items.
And then the idea of keeping track of that dialog, and making it a note, source, or reference (or something) is a also a very interesting idea, whether good or bad
I’ll add these to items to consider for a local or server-based tool.