Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI functionality in JabRef #93

Merged
merged 49 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f03418b
Transfer post from Rise Up Pad
InAnYan Jun 27, 2024
9cf73aa
Insert AI questions and screenshots
InAnYan Jun 27, 2024
2419ad3
Fix wording
InAnYan Jun 27, 2024
871d486
Update 2024-07-01-AI-chatting.md
koppor Jun 27, 2024
d3ea5e0
Update 2024-07-01-AI-chatting.md
koppor Jun 27, 2024
0e7daf9
Add DOI
koppor Jun 27, 2024
e62a89f
Small changes
InAnYan Jun 27, 2024
6ad8ca4
Merge pull request #3 from koppor/patch-3
InAnYan Jun 27, 2024
fcaf0b7
Merge branch 'ai-1' into patch-1
InAnYan Jun 27, 2024
a756c53
Merge pull request #1 from koppor/patch-1
InAnYan Jun 27, 2024
9509ec1
Merge branch 'ai-1' into patch-2
InAnYan Jun 27, 2024
07aaa58
Merge pull request #2 from koppor/patch-2
InAnYan Jun 27, 2024
0025a46
Update title
InAnYan Jun 27, 2024
1e2ce47
Update 2024-07-01-AI-chatting.md
ThiloteE Jun 27, 2024
63ac7f7
Add links to AI providers
ThiloteE Jul 6, 2024
2cc8af2
Add Together.AI to list of LLM providers
ThiloteE Jul 7, 2024
62e4f34
Use tags
koppor Jul 8, 2024
913a796
Merge pull request #5 from koppor/patch-4
InAnYan Jul 8, 2024
fe39b71
Merge branch 'ai-1' into patch-1
InAnYan Jul 8, 2024
76bb644
Merge pull request #4 from ThiloteE/patch-1
InAnYan Jul 8, 2024
f40b579
Merge branch 'main' into ai-1
InAnYan Jul 8, 2024
9b99307
Merge branch 'JabRef:main' into ai-1
InAnYan Jul 19, 2024
64e87f0
Add more AI providers and summarization
InAnYan Aug 1, 2024
8f6cabc
Merge pull request #6 from InAnYan/ai-1
InAnYan Aug 3, 2024
1ee129a
Bring back list of AI providers
InAnYan Aug 3, 2024
e1c2132
Update date
InAnYan Aug 12, 2024
343ec5d
Shorten AI blog post
InAnYan Aug 13, 2024
a623ae2
Update user documentation for AI
InAnYan Aug 14, 2024
8515cf3
Fix from code review
InAnYan Aug 14, 2024
96a611d
Update and rename 2024-08-12-AI-chatting.md to 2024-08-16-AI-chatting.md
koppor Aug 15, 2024
c7070f7
Update _posts/2024-08-16-AI-chatting.md
InAnYan Aug 19, 2024
5f2d5f3
Fix from blog review
InAnYan Aug 19, 2024
0350b88
Fix writing
InAnYan Aug 19, 2024
c935f48
Lots of rewriting
ThiloteE Aug 20, 2024
86d5c15
Update _posts/2024-08-16-AI-chatting.md
ThiloteE Aug 20, 2024
54338d6
Update _posts/2024-08-16-AI-chatting.md
ThiloteE Aug 20, 2024
e3f104f
Update _posts/2024-08-16-AI-chatting.md
ThiloteE Aug 20, 2024
ab0400c
Update _posts/2024-08-16-AI-chatting.md
ThiloteE Aug 20, 2024
e3cd752
Apply suggestions from code review as batch
ThiloteE Aug 20, 2024
9265ac7
Remove ``
ThiloteE Aug 20, 2024
6c647c2
Update _posts/2024-08-16-AI-chatting.md
InAnYan Aug 21, 2024
a5c81cc
Update _posts/2024-08-16-AI-chatting.md
InAnYan Aug 21, 2024
124ff1e
Update _posts/2024-08-16-AI-chatting.md
InAnYan Aug 21, 2024
9aa550d
Update from call
InAnYan Aug 21, 2024
ba649a6
Update from call 2
InAnYan Aug 21, 2024
1b139b3
Rename 2024-08-16-AI-chatting.md to 2024-08-21-AI-chatting.md
koppor Aug 21, 2024
5072d27
Update from call 3
InAnYan Aug 21, 2024
2b3b371
Merge branch 'main' of https://github.com/InAnYan/blog.jabref.org
InAnYan Aug 21, 2024
d048874
Update from call 4
InAnYan Aug 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions _posts/2024-08-16-AI-chatting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
title: "Introducing AI Features in JabRef"
tags: [ai, gsoc]
author: "[Ruslan](https://github.com/InAnYan)"
---

My name is Ruslan and currently working on integrating AI into JabRef in the context of [Google Summer of Code 2024](https://summerofcode.withgoogle.com/).
InAnYan marked this conversation as resolved.
Show resolved Hide resolved

I am thrilled to present the cutting-edge AI capabilities now integrated into JabRef, namely the "AI Summary" and the "AI Chat" features. These Innovations are designed to revolutionize your research experience!

In short:

- **AI Summary**: With this feature, you can generate a summary of a research paper
- **AI Chat**: This feature allows you to chat with your scientific papers

## AI Summary

I have introduced a new entry editor tab named "AI Summary". Here, you can use the AI to generate a quick overview of the scientific paper.

![AI summary tab screenshot](../img/AiSummary.png)

The AI highlights the main objectives of the research, the methods used, the key findings and the conclusions.

## AI Chat

The next new entry editor tab is "AI Chat," where all the questions and answers (Q&A) happen.

In the window below, you can see the following elements:

- The chat history with your messages
- A button called "submit" that allows you to send a message (also commonly called "prompting")
- A button for clearing the chat history

![AI chat tab screenshot](../img/AiChat.png)


InAnYan marked this conversation as resolved.
Show resolved Hide resolved
Let's try it out with the following paper: "Cooper, K., Donovan, J., Waterhouse, A., & Williamson, G. (2007). Cocoa and health: a decade of research. *British Journal of Nutrition*, 99(1), 1–11. doi:[10.1017/s0007114507795296](https://doi.org/10.1017/s0007114507795296)"

Let's ask about the chocoloate.

![AI first question and answer](../img/AiQuestion1.png)

Correct! The authors discuss chocolate components extensively and how it can be a powerful antioxidant.

I was wondering, how much chocolate should a human eat? Let's ask it.

![AI second question and answer](../img/AiQuestion2.png)

*Only 40 grams?* Well, our health is our wealth. Exciting that AI helped us to uncover this information!

## How does this work?

JabRef mainly makes use of Large Language Models (LLMs).

Let's break down the dataflow:

* **Create Embeddings:** First of all, JabRef uses a smaller "embedding model" locally on your computer. This model converts the extracted chunks of text from PDFs into numerical representations called embeddings. Embeddings capture the meaning and relationships between words in a way that Large Language Models can understand.
* **Sending Data to the API:** JabRef then sends these embeddings (along with any other relevant context, such as the chat history) to an API. Think of an API as a set of rules and instructions that allow different software applications to talk to each other. If you choose an external AI service provider, such as OpenAI, Mistral or Hugging Face, the data will leave your computer. If you choose an OpenAI API compatible application that purely operates on your local computer, it is possible to store the LLM on your computer and process the data there, but some of them also allow you to make use of remote model hosting. In all cases, be it a separate application or a remote AI service provider, their particular privacy policy will apply.
* **Processing by the LLM:** The chosen AI service provider or the separate application will process the embeddings via a LLM (or a similar technology) and send a response back to JabRef, which is then displayed in the UI.

## Which AI provider should I use?

> [!Note]
> To use any of the providers, it is required to configure an API key in JabRef's preferences.
We have many integrations with AI providers, so you can choose the one you like the most 😊

There are various considerations, such as pricing, capabilities, speed, privacy policy and more (that may change at any time) to take into account that make it difficult to give a clear recommendation that will stand the test of time. I strongly recommend to look up the models pricing before you choose. Smaller models will be cheaper and faster than larger models, whereas larger models tend to outperform in terms of capabilities. In any case, here is the list of providers:

ThiloteE marked this conversation as resolved.
Show resolved Hide resolved
[OpenAI](https://platform.openai.com/docs/models).
[MistralAI](https://docs.mistral.ai/getting-started/models/)
[Huggingface](https://huggingface.co/models?pipeline_tag=text-generation&sort=trending)

ThiloteE marked this conversation as resolved.
Show resolved Hide resolved

While OpenAI deserved a spot because of its popularity, Mistral's models are high up there in the benchmarks too and they led the way in terms of releasing [open weight](https://github.com/Open-Weights/Definition) models with Apache 2.0 licenses, which should warm the heart of anybody favouring Open Source. Hugging Face is currently a little bit special, as they give you access to thousands of open weight models [for free](https://huggingface.co/docs/api-inference/index), including ones with commercially friendly licenses (Apache 2.0, MIT), however, it may take a long time for Hugging Face to allocate free computing resources, resulting in longer response times, unless you choose (and pay) for a [GPU space](https://huggingface.co/docs/hub/spaces-gpus) that is much faster at inference.

Finally, iF you are asking yourself, where can I find an API key and what is it even? Please head to the [AI user documentation](https://docs.jabref.org/ai/ai-providers-and-api-keys) to learn about how to receive a key and where to enter it in the preferences.

## AI preferences

Yes, by the way, there are some new options in the JabRef preferences, such as

- "Enable AI functionality in JabRef": by default it is turned off, so you need to check this option if you want to use the new AI features.
- "AI provider": you can choose either OpenAI, Mistral AI, or Hugging Face.
- "Chat model": choose the model you like
- "API token": here you write your API token.
- "Expert settings": the defaults provide good results. In case you would like to modify them, our [user documentation](https://docs.jabref.org/ai) provides an explanation of it.

![AI preferences](../img/AiPreferences.png)

## BONUS

Have you ever considered running a local LLM on your computer while ensuring complete privacy?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are considering running a local LLM on your computer to ensure complete privacy, check out my tutorial ...

I wrote a tutorial of how to install and use `ollama` and integrate it in JabRef.

ThiloteE marked this conversation as resolved.
Show resolved Hide resolved
You find more information at the [user documentation](https://docs.jabref.org/ai/local-llm).

## Are you curious?

Try the AI features in our [current development version](https://builds.jabref.org/main/) and explore the new functionality.

We value your opinion and want to know: What AI features would you like to see in JabRef in the future? What LLMs or other integrations would you like in upcoming versions?
Please show up in our [Feedback forum](https://discourse.jabref.org/c/feedback/3).
Binary file added img/AiChat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/AiPreferences.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/AiQuestion1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/AiQuestion2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/AiSummary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.