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

Fix preferences for AI #98

Closed
3 tasks done
koppor opened this issue Aug 2, 2024 · 24 comments
Closed
3 tasks done

Fix preferences for AI #98

koppor opened this issue Aug 2, 2024 · 24 comments
Milestone

Comments

@koppor
Copy link
Collaborator

koppor commented Aug 2, 2024

image

  • (1) I did not enter any API token for Hugging face - the field should be empty then? --> Each API provider has a different token - thus, this field should be dependend on the provider
  • (2) Rename to "Enable customizing expert settings" - The current text is a bit misleading, because choosing an "AI provider" is also an "AI setting" IMHO, which one customized
  • If I change the API entpoint of misral, change back to OpenAI above and change back, my new value is lost - some old value is displayed

Dialog does not store misral URL

image

"Save"

Open again - OK

Change to "OpenAI"

Change back to "Misral"

Old URL there:

image

@koppor koppor added this to the Week 1 milestone Aug 2, 2024
@ThiloteE
Copy link
Collaborator

ThiloteE commented Aug 2, 2024

  • (2)

    "Enable customizing expert settings"

    This is not good English. "Use custom settings" would be better. Or alternatively "Customize expert settings" or "Enable custom settings". I asked a native US-English speaker.

  • (4)

    "These parameters affect how AI will answer your questions" --> rename to --> "These parameters affect how the AI will answer your questions."

@InAnYan
Copy link
Owner

InAnYan commented Aug 4, 2024

For the third point: What is the best way to do this?

The situation is: a user has filled a custom API endpoint, but then they switch to other AI provider.

I see there two options:

  1. [Current option] We replace custom values with default ones every time the AI provider is switched

Rationale: what if users switches provider, but forgets to change the API URL?

  1. For each of the provider, store their custom API URL. <------------- should this be chosen?

@InAnYan
Copy link
Owner

InAnYan commented Aug 4, 2024

This also concerns API token:

Should it be custom for every type of AI provider, or any time we change AI provider it becomes empty?

@koppor
Copy link
Collaborator Author

koppor commented Aug 4, 2024

I run now - commit e1a895bf9f4b6a3ebdc362735a7ec2d1e7b2c1b9

@koppor
Copy link
Collaborator Author

koppor commented Aug 4, 2024

Rationale: what if users switches provider, but forgets to change the API URL?

For that, we have "Reset expert settings to default". -- The best would be to have a reset button after the API-base URL to only reset that.

@koppor
Copy link
Collaborator Author

koppor commented Aug 4, 2024

2. For each of the provider, store their custom API URL. <------------- should this be chosen?

Yes.

We also need to work on the hiearchical display. Mac OS finder uses columsn for that:
Big_Sur_Finder_screenshot

In JabRef, we use indent.

image

  • Thus, "Chat model" and "API token" should have an indent"

I know that for "API base URL" and "Embedding model" this is currently hard.

I assume the user does not need to change the embedding model often? Although, this statement contradicts: #85

Maybe, "Embedding model" needs to be moved to "General" - as the user also can change the "Chat model"?

@koppor
Copy link
Collaborator Author

koppor commented Aug 4, 2024

  • I reset JabRef's preferences. Why is there an API token in "OpenAI"

image

Update This is, how JabRef's reset preferences works...

@koppor
Copy link
Collaborator Author

koppor commented Aug 4, 2024

  • There should be a help for "Chat model", too. -- The most hard thing (in the "easy" prefrences) is not documented 🤣🤣

image

(Also, the dialog would look better, because always (?) at the right side - and not disturbed by one dropdown)

@koppor
Copy link
Collaborator Author

koppor commented Aug 4, 2024

Should it be custom for every type of AI provider,

Yes.

Reason: It is very likely that I as user try more than one AI provider and fetch API keys for that. I want to switch back and forth of these providers easily.

or any time we change AI provider it becomes empty?

No.

(Furthermore, the API key of one provider should not be shared with another provider. I think, the API key exchange is not protected similar to password exchange, but sent directly to the API provider. Thus, if I use a medium-secure AI provider, my key could get compromised by them)

@InAnYan
Copy link
Owner

InAnYan commented Aug 4, 2024

Okay, I see, then for each AI provider we need to store:

  • Selected chat model
  • API token
  • API base URL

This will be an interesting challenge 😄, though it shouldn't be too hard

InAnYan added a commit to JabRef/jabref that referenced this issue Aug 4, 2024
@InAnYan
Copy link
Owner

InAnYan commented Aug 4, 2024

#98 (comment)

These points should be fixed in 637d14e

@koppor
Copy link
Collaborator Author

koppor commented Aug 4, 2024

Reply by OpenAPI if Misral key is used:

401 - message: Incorrect API key provided: dWkr3jyb********************UEyx. You can find your API key at https://platform.openai.com/account/api-keys., type: invalid_request_error, param: null, code: invalid_api_key

@koppor
Copy link
Collaborator Author

koppor commented Aug 4, 2024

#98 (comment)

These points should be fixed in 637d14e

Wrong commit link, but the two poitns are fixed

image

(The others are still open)

InAnYan added a commit to JabRef/jabref that referenced this issue Aug 6, 2024
@InAnYan
Copy link
Owner

InAnYan commented Aug 6, 2024

Okay, I've tried to fix this issue in recent commits...

Should (?) work

@InAnYan InAnYan added the status: waiting-for-feedback The submitter needs to recheck the issue or provide more information about the issue label Aug 6, 2024
@koppor
Copy link
Collaborator Author

koppor commented Aug 6, 2024

No.

image

image

@koppor koppor removed the status: waiting-for-feedback The submitter needs to recheck the issue or provide more information about the issue label Aug 6, 2024
InAnYan added a commit to JabRef/jabref that referenced this issue Aug 6, 2024
@InAnYan
Copy link
Owner

InAnYan commented Aug 6, 2024

Fixed

@InAnYan InAnYan added the status: waiting-for-feedback The submitter needs to recheck the issue or provide more information about the issue label Aug 6, 2024
@koppor
Copy link
Collaborator Author

koppor commented Aug 6, 2024

No

image

@koppor koppor removed the status: waiting-for-feedback The submitter needs to recheck the issue or provide more information about the issue label Aug 6, 2024
@koppor
Copy link
Collaborator Author

koppor commented Aug 6, 2024

547da5d

@koppor
Copy link
Collaborator Author

koppor commented Aug 6, 2024

Tried again with a preference reset. Keeps not working.

@InAnYan
Copy link
Owner

InAnYan commented Aug 6, 2024

It's stored, but not used when you send messages.

When user turns off "customize expert settings", should they be resetted?

What if I want to customize expert settings, then turn off, then return to previous parameters that I set?

@InAnYan InAnYan added the status: waiting-for-feedback The submitter needs to recheck the issue or provide more information about the issue label Aug 6, 2024
@koppor
Copy link
Collaborator Author

koppor commented Aug 6, 2024

First of all, please try to follow me slowly. Take the time to understand.

image

  1. First - Customize export settings are turned off
  2. Second - "WHAT-THE-FUCK" is a String contained in the URL
  3. Third - The AI Returns a 404, because "WHAT THE FUCK" appears in the URL

That must not happen. If the customized expoert settings are disabled, ther normal API url needs to be used

  1. Open Preferences
  2. Enable Custom expert settings
  3. Add „WHAT THE FUCK“ to the URL
  4. Save
  5. Open Preferences
  6. Disable Custom expert settings
  7. Open “AI Summary” tab
  8. Click on regenerate

@koppor
Copy link
Collaborator Author

koppor commented Aug 6, 2024

When user turns off "customize expert settings", should they be resetted?

No.

What if I want to customize expert settings, then turn off, then return to previous parameters that I set?

Currently, the preference UI renders well to the user. It just does not route the setting properly to the AI code.

@koppor koppor removed the status: waiting-for-feedback The submitter needs to recheck the issue or provide more information about the issue label Aug 6, 2024
InAnYan added a commit to JabRef/jabref that referenced this issue Aug 7, 2024
@InAnYan
Copy link
Owner

InAnYan commented Aug 7, 2024

Okay, sorry, it should be fixed now :)

Just a small change about listening to preferences change

@InAnYan InAnYan added the status: waiting-for-feedback The submitter needs to recheck the issue or provide more information about the issue label Aug 7, 2024
@koppor
Copy link
Collaborator Author

koppor commented Aug 7, 2024

Tried. Works.

@koppor koppor closed this as completed Aug 7, 2024
@koppor koppor removed the status: waiting-for-feedback The submitter needs to recheck the issue or provide more information about the issue label Aug 7, 2024
github-merge-queue bot pushed a commit to JabRef/jabref that referenced this issue Aug 14, 2024
* Fix the code from code review

* Fix from code review and create new AiChatTabWorking

* Improve chat history storage code

* More fix from code review

* Remove obsolete parameter

* Add JavaDoc comment

* Fix checkstyle

* Fix JavaDoc

* Fix more checkstyle

* More checkstyle fixes

* Fix code changes

* Improve the PR

* Rework ADR-0031 to enable to use another option

* Add many LOGGEr.trace statements

* Change "message window" to "context window"

* Fix compiler errors

* Fix issue list index issue of langchain4j

* Fix lint issue

* Update 0031-store-chats-alongside-database.md

* More tracing

* Refine logging

* Remove closing of AiChatLanguageModel (because it's not closable)

* Use external package for OpenAI API connection

* Provide a custom executor for RetrievalAugmentor

* Fix shutdown issue (I hope)

* Refactor classes

* Change BibDatabaseChatHistoryFile

* Revert BibDatabaseChatHistoryFile to old version because of langchain4j

* Make round corners for chat messages

* Refactor embeddings generation

* Refactor embeddings generation

* Refactor embeddings generation

* Fix CHANGELOG.md

* Remove jpro-mdfx

* Add comment

* Fix localizations

* Fix checkstyle and remove OpenAI from PRIVACY.md

* Remove unnecessary comments

* Fix privacy notice UI

* Introduce new ApiKeyMissingComponent

* Thanks Tobiaz Diez for writing such a good EntryEditorTab class

* Fix InAnYan/jabref issues

* Merge `build.gradle` and `settings.gradle` from main branch

* Update ADRs

* Implement rethought ADR for chat history

* Use OpenAI embedding model

* Use Deep Java embedding model

* Remove old langchain4j embedding models

* Fix checkstyle errors

* Fix checkstyle and remove old dependencies

* Fixes from code review

* Restructure

* Fix checkstyle errors

* Add API base URL parameter

* Fix localization

* Fix from code review + ADR

* Something broken

* Now MistralAI and Hugging Face work

* Fix base URL for other LLM providers

* Fix base URL for other LLM providers

* Refactor MVStore usage

* Load embedding model in background

* Bump langchain4j version

* Fix bug

* Fix checkstyle and localization

* Implement summarization

* Fix checkstyle and localization

* Improve PrivacyNoticeComponent

* Fix from code review

* Update localization

* Wrap text

* Add padding

* Fix markdown

* Use stuff algorithm

* Add GPT-4o-mini

* Make chat model editable

* Update context window size and summarization

* Fix checkstyle

* Update PrivacyNoticeComponent.fxml

* Update AI summary tab

* Fix localization

* Change order so that there is no diff

* Reorrder dependencies

* Add missing CHANGELOG.md entry

* Refine ADR-0033

* Refine ADR0034

* Fix typos

* Refine ADR-0036

* Fix ADR-0037

* Fix title case

* Fix changes in module-info.java

* Readd removed requires org.apache.httpcomponents.core5.httpcore5

* Revert change in JabRefGUI to avoid conflicts

* Remove empty lines

* Reorder entries in JabRef_en.properties

* Simplify SummariesStorage (and add test)

* Use region/endregion

* Fix position of comment

* Add comment why the event bus is needed

* Do not show exception to the user - just that an error is occurred (saves %0 in localization)

* Use "URL %0" without colon (consistency)

* Fix typos

* History has to be kept

* Remove empty lines

* Fix language (hopefully)

* Compilefix

* Simplify BibDatabaseChatHistoryManager

* Fix from code review

* Fix issue #103

* Rework embeddings cache clearing

* Fix #99 and partially #101

* Partially fixing shutdown issues and UI progress monitor issue

* Add "requires scala.library" and add "region:" / "endregion"

* More grouping (move de.saxsys.mvvmfx.validation up)

* Add alphabetical hint

* Fix InAnYan#101 and InAnYan#106

* Discard changes to settings.gradle

* Fix InAnYan#105

* Follow-up fix for InAnYan#103

* Follow-up fix for InAnYan#103

* Remove obsolete class

* Partially fix InAnYan#98

* We do need dependencies to the AI providers, don't we?

* Fix InAnYan#93

* Simplify code

* Partially fix InAnYan#92

* Fix checkstyle and localization

* Fix hyperlinks and text in ApiKeyMissingComponent

* Fixes from code review

* Fix InAnYan#120

* Remove "X% work done" messages

* Fix InAnYan#114

* Partially fix InAnYan#113

* Partially fix InAnYan#110

* Fix InAnYan#110

* Fix InAnYan#111

* Improve embedding model downloading notifications

* Fix InAnYan#124

* Fix InAnYan#122

* Fix wrong context window size when expert settings customization is turned off

* Attempt to fix InAnYan#95

* Finally fix InAnYan#105

* Fix InAnYan#108

* Attempt to fix InAnYan#98

* Fix for InAnYan#104

* Fix for InAnYan#98

* Fix for InAnYan#95 (comment)

* Fix for InAnYan#98 (comment)

* Fix for InAnYan#126

* Fix for InAnYan#115

* Fix for InAnYan#113

* Fix for InAnYan#91

* Fix for InAnYan#121

* Fix for InAnYan#112 and InAnYan#116

* Fix for InAnYan#125

* Fixes from commit comments

* Fix for InAnYan#115

* Fix for InAnYan#120

* Fix for InAnYan#132

* Fix for InAnYan#132

* Fix for InAnYan#104

* Fix for InAnYan#118

* Fix for InAnYan#114

* Fix for InAnYan#104

* Store error messages in chat history

* Make error be a ChatMessageComponent

* Implement delete messages InAnYan#136

* Fix for InAnYan#118

* Fix for InAnYan#92

* Fix checkstyle and localization. And refactoring

* Fix for InAnYan#92

* Fix for InAnYan#139

* Show "Delete message" button only when necessary

* Fix for InAnYan#83

* Update src/main/java/org/jabref/logic/ai/AiService.java

Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>

* Update src/main/java/org/jabref/logic/ai/chathistory/BibDatabaseChatHistoryManager.java

Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>

* Update src/main/java/org/jabref/logic/ai/AiService.java

Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>

* Update src/main/java/org/jabref/gui/Base.css

Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>

* Update src/main/java/org/jabref/gui/Base.css

Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>

* Fix from code review

* Partial fix for InAnYan#125

* Update colors for error message

* Fix for InAnYan#145 and InAnYan#142

* Make progress for embedding model download

* Fix checkstyle and localization

* Add workaround to get FileHistoryMenuTest running again

* Small fixes

* Revert "Small fixes"

This reverts commit 85382a1.

* Introduce AiApiKeyProvider

* Fix IDE setup instructions

* Do not load API keys on startup

* Rely on keystore encryption

* Prevent mulitple rebuilds when muliple preferences are updated

* Fix localization to be more provider independent

* Fix method names

* Add poor man's solution to notify of API key changes

* Reduce calls to key store (and fix key saving)

* Fix for InAnYan#148 and partially InAnYan#146

* Revert "Fix for InAnYan#148 and partially InAnYan#146"

This reverts commit 5fa3bb5.

* Fix for scrolling down when deleting a message

* Sort EmbeddingModel enum variants

* Fix GenerateSummaryTask progress indication

* Fix dark mode

* Add notice for embedding models size

---------

Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants