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

Add Gemini LLM #11736

Merged
merged 6 commits into from
Sep 13, 2024
Merged

Add Gemini LLM #11736

merged 6 commits into from
Sep 13, 2024

Conversation

InAnYan
Copy link
Collaborator

@InAnYan InAnYan commented Sep 9, 2024

image

Mandatory checks

- [ ] Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
- [ ] Tests created for changes (if applicable)

@subhramit subhramit changed the title Add Gemini LLM model Add Gemini LLM Sep 9, 2024
@subhramit subhramit added the component: ai Related to AI Chat/Summarization label Sep 9, 2024
@subhramit
Copy link
Member

subhramit commented Sep 9, 2024

Unrelated red fetcher test fixed in #11737

@ThiloteE
Copy link
Member

ThiloteE commented Sep 9, 2024

Chat model and API key are not yet persistent. Each time I open the preferences, I see them being reset to nothing.
grafik

I found this through InAnYan#186

@ThiloteE
Copy link
Member

ThiloteE commented Sep 9, 2024

I also triggered this error message when switching from AI provider "mistral AI" to "Gemini":

java.lang.NullPointerException: Cannot invoke "Object.hashCode()" because "pk" is null
	at java.base/java.util.ImmutableCollections$MapN.probe(ImmutableCollections.java:1328)
	at java.base/java.util.ImmutableCollections$MapN.get(ImmutableCollections.java:1242)
	at java.base/java.util.ImmutableCollections$AbstractImmutableMap.getOrDefault(ImmutableCollections.java:1097)
	at org.jabref@100.0.0/org.jabref.gui.preferences.ai.AiTabViewModel.lambda$new$3(AiTabViewModel.java:192)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:372)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@22.0.2/javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:104)
	at javafx.base@22.0.2/javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:111)
	at javafx.base@22.0.2/javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:145)
	at javafx.base@22.0.2/javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:50)
	at org.jabref@100.0.0/org.jabref.gui.preferences.ai.AiTabViewModel.lambda$new$2(AiTabViewModel.java:165)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:372)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@22.0.2/javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)
	at javafx.base@22.0.2/javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
	at javafx.base@22.0.2/javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)
	at javafx.base@22.0.2/javafx.beans.property.ObjectProperty.setValue(ObjectProperty.java:78)
	at javafx.base@22.0.2/com.sun.javafx.binding.BidirectionalBinding$TypedGenericBidirectionalBinding.invalidated(BidirectionalBinding.java:650)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:360)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@22.0.2/javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)
	at javafx.base@22.0.2/javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
	at javafx.base@22.0.2/javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)
	at javafx.controls@22.0.2/javafx.scene.control.ComboBoxBase.setValue(ComboBoxBase.java:151)
	at javafx.controls@22.0.2/javafx.scene.control.ComboBox.updateValue(ComboBox.java:522)
	at javafx.controls@22.0.2/javafx.scene.control.ComboBox$3.changed(ComboBox.java:505)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:372)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@22.0.2/javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(ReadOnlyObjectPropertyBase.java:80)
	at javafx.base@22.0.2/javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:102)
	at javafx.base@22.0.2/javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
	at javafx.base@22.0.2/javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)
	at javafx.controls@22.0.2/javafx.scene.control.SelectionModel.setSelectedItem(SelectionModel.java:105)
	at javafx.controls@22.0.2/javafx.scene.control.ComboBox$ComboBoxSelectionModel.lambda$new$0(ComboBox.java:562)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@22.0.2/javafx.beans.property.ReadOnlyIntegerPropertyBase.fireValueChangedEvent(ReadOnlyIntegerPropertyBase.java:78)
	at javafx.base@22.0.2/javafx.beans.property.ReadOnlyIntegerWrapper.fireValueChangedEvent(ReadOnlyIntegerWrapper.java:102)
	at javafx.base@22.0.2/javafx.beans.property.IntegerPropertyBase.markInvalid(IntegerPropertyBase.java:114)
	at javafx.base@22.0.2/javafx.beans.property.IntegerPropertyBase.set(IntegerPropertyBase.java:148)
	at javafx.controls@22.0.2/javafx.scene.control.SelectionModel.setSelectedIndex(SelectionModel.java:69)
	at javafx.controls@22.0.2/javafx.scene.control.SingleSelectionModel.updateSelectedIndex(SingleSelectionModel.java:215)
	at javafx.controls@22.0.2/javafx.scene.control.SingleSelectionModel.select(SingleSelectionModel.java:149)
	at javafx.controls@22.0.2/javafx.scene.control.skin.ComboBoxListViewSkin.lambda$createListView$10(ComboBoxListViewSkin.java:571)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:360)
	at javafx.base@22.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@22.0.2/javafx.beans.property.ReadOnlyIntegerPropertyBase.fireValueChangedEvent(ReadOnlyIntegerPropertyBase.java:78)
	at javafx.base@22.0.2/javafx.beans.property.ReadOnlyIntegerWrapper.fireValueChangedEvent(ReadOnlyIntegerWrapper.java:102)
	at javafx.base@22.0.2/javafx.beans.property.IntegerPropertyBase.markInvalid(IntegerPropertyBase.java:114)
	at javafx.base@22.0.2/javafx.beans.property.IntegerPropertyBase.set(IntegerPropertyBase.java:148)
	at javafx.controls@22.0.2/javafx.scene.control.SelectionModel.setSelectedIndex(SelectionModel.java:69)
	at javafx.controls@22.0.2/javafx.scene.control.MultipleSelectionModelBase.select(MultipleSelectionModelBase.java:424)
	at javafx.controls@22.0.2/javafx.scene.control.MultipleSelectionModelBase.clearAndSelect(MultipleSelectionModelBase.java:371)
	at javafx.controls@22.0.2/javafx.scene.control.ListView$ListViewBitSetSelectionModel.clearAndSelect(ListView.java:1494)
	at javafx.controls@22.0.2/com.sun.javafx.scene.control.behavior.CellBehaviorBase.simpleSelect(CellBehaviorBase.java:287)
	at javafx.controls@22.0.2/com.sun.javafx.scene.control.behavior.CellBehaviorBase.doSelect(CellBehaviorBase.java:246)
	at javafx.controls@22.0.2/com.sun.javafx.scene.control.behavior.CellBehaviorBase.mousePressed(CellBehaviorBase.java:176)
	at javafx.controls@22.0.2/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
	at javafx.base@22.0.2/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
	at javafx.base@22.0.2/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at javafx.base@22.0.2/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at javafx.base@22.0.2/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at javafx.base@22.0.2/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at javafx.base@22.0.2/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base@22.0.2/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@22.0.2/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base@22.0.2/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@22.0.2/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base@22.0.2/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@22.0.2/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base@22.0.2/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@22.0.2/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base@22.0.2/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@22.0.2/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base@22.0.2/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at javafx.base@22.0.2/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.graphics@22.0.2/javafx.scene.Scene$MouseHandler.process(Scene.java:3985)
	at javafx.graphics@22.0.2/javafx.scene.Scene.processMouseEvent(Scene.java:1891)
	at javafx.graphics@22.0.2/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2709)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:430)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
	at javafx.graphics@22.0.2/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
	at javafx.graphics@22.0.2/com.sun.glass.ui.View.notifyMouse(View.java:937)
	at javafx.graphics@22.0.2/com.sun.glass.ui.gtk.GtkApplication.enterNestedEventLoopImpl(Native Method)
	at javafx.graphics@22.0.2/com.sun.glass.ui.gtk.GtkApplication._enterNestedEventLoop(GtkApplication.java:334)
	at javafx.graphics@22.0.2/com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:513)
	at javafx.graphics@22.0.2/com.sun.glass.ui.EventLoop.enter(EventLoop.java:107)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:656)
	at javafx.graphics@22.0.2/javafx.stage.Stage.showAndWait(Stage.java:469)
	at javafx.controls@22.0.2/javafx.scene.control.HeavyweightDialog.showAndWait(HeavyweightDialog.java:162)
	at javafx.controls@22.0.2/javafx.scene.control.Dialog.showAndWait(Dialog.java:346)
	at org.jabref@100.0.0/org.jabref.gui.JabRefDialogService.showCustomDialogAndWait(JabRefDialogService.java:332)
	at org.jabref@100.0.0/org.jabref.gui.preferences.ShowPreferencesAction.execute(ShowPreferencesAction.java:26)
	at org.jabref@100.0.0/org.jabref.gui.actions.JabRefAction.lambda$new$1(JabRefAction.java:25)
	at org.controlsfx.controls@11.2.1/org.controlsfx.control.action.Action.handle(Action.java:423)
	at org.controlsfx.controls@11.2.1/org.controlsfx.control.action.Action.handle(Action.java:64)
	at javafx.base@22.0.2/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at javafx.base@22.0.2/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at javafx.base@22.0.2/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at javafx.base@22.0.2/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base@22.0.2/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@22.0.2/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base@22.0.2/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at javafx.base@22.0.2/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.controls@22.0.2/javafx.scene.control.MenuItem.fire(MenuItem.java:459)
	at javafx.controls@22.0.2/com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1415)
	at javafx.controls@22.0.2/com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.lambda$createChildren$12(ContextMenuContent.java:1368)
	at javafx.base@22.0.2/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
	at javafx.base@22.0.2/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at javafx.base@22.0.2/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at javafx.base@22.0.2/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at javafx.base@22.0.2/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at javafx.base@22.0.2/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base@22.0.2/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@22.0.2/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base@22.0.2/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@22.0.2/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base@22.0.2/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@22.0.2/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base@22.0.2/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@22.0.2/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base@22.0.2/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.base@22.0.2/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.graphics@22.0.2/javafx.scene.Scene$MouseHandler.process(Scene.java:3985)
	at javafx.graphics@22.0.2/javafx.scene.Scene.processMouseEvent(Scene.java:1891)
	at javafx.graphics@22.0.2/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2709)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:430)
	at javafx.graphics@22.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
	at javafx.graphics@22.0.2/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
	at javafx.graphics@22.0.2/com.sun.glass.ui.View.notifyMouse(View.java:937)
	at javafx.graphics@22.0.2/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at javafx.graphics@22.0.2/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$10(GtkApplication.java:264)
	at java.base/java.lang.Thread.run(Thread.java:1583)

@InAnYan
Copy link
Collaborator Author

InAnYan commented Sep 9, 2024

TODO: ADD PRIVACY POLICY OF GOOGLE AI

@koppor koppor marked this pull request as draft September 10, 2024 04:36
@InAnYan
Copy link
Collaborator Author

InAnYan commented Sep 10, 2024

Privacy Policy added. Bugs fixed

@InAnYan InAnYan marked this pull request as ready for review September 10, 2024 09:27
# Conflicts:
#	build.gradle
@@ -44,6 +44,15 @@
</Text>
</children>
</TextFlow>
<TextFlow fx:id="geminiPrivacyTextFlow">
<children>
<Text text="%If you have chosen the Google Gemini as AI provider, the privacy policy of Google Gemini applies. You find it at %0.">
Copy link
Member

Choose a reason for hiding this comment

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

Can't we unify the l10n here and add the name of the AI provider as a parameter as well?
If you have chosen %0 as AI provider, the privacy policy of Google Gemini applies. You find it at %1.">

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

OMG! All of this time, when user clicks on privacy policy of an AI provider, they're sent to API URL!

Ahah, I'll fix this

@InAnYan
Copy link
Collaborator Author

InAnYan commented Sep 13, 2024

Ready to review

@InAnYan InAnYan requested a review from Siedlerchr September 13, 2024 09:29
Siedlerchr
Siedlerchr previously approved these changes Sep 13, 2024
@koppor koppor enabled auto-merge September 13, 2024 12:27
@koppor koppor added this pull request to the merge queue Sep 13, 2024
Merged via the queue into JabRef:main with commit 2a39416 Sep 13, 2024
27 of 28 checks passed
@koppor koppor deleted the gemini branch September 13, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ai Related to AI Chat/Summarization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants