ccbogel / QualCoder

Qualitative data analysis for text, images, audio, video. Cross platform. Python 3.10 or newer and PyQt6.
https://qualcoder.wordpress.com/
GNU Lesser General Public License v3.0
383 stars 85 forks source link

AI Features added: AI Search, Chat #939

Closed kaixxx closed 1 month ago

kaixxx commented 1 month ago

Finally, my experimental version of QualCoder with AI enhanced features (first discussed here: #875) has matured to a point where I feel somewhat comfortable suggesting a merge into the main branch.

I have added the following features:

Implementation details:

I have tried implementing the AI features in a way that does not interfere with the normal use of QualCoder. By default, the AI features are disabled. The user is asked at the first startup whether they want to enable it. If so, a wizard will guide through the setup process. This wizard can also be started later via the new “AI” menu.

To Do

Status

I have tested this version for quite a while now and hope that all the major problems are eliminated. However, I did a lot of cleanups in the code over the last couple of weeks, which might have introduced some new errors, who knows. Please take a thorough look at my suggestions and tell me if you like the new features and the way I integrated them into the existing QualCoder. I can make changes if you want. If you decide to accept the PR, I’ll promise to have a close look at the bug tracker over the next couple of weeks and try to fix any problems that might pop up.

Best Kai

closes #875

ccbogel commented 1 month ago

This is quite amazing. I guess you also tested it out with colleagues in your area. I will download and experiment with it soon.

kaixxx commented 1 month ago

Ok, I've already found the first typo that I introduced a few days ago ;) It is corrected now.

Also: I wasn't aware of the possibility to edit text in the coding window. So I made the AI functions compatible with edit mode (adapting UI, updating the vector store after editing), see last commit.

ccbogel commented 1 month ago

OK. I will merge and see. I see there will be some code conflicts to resolve.

These changes are not in the colab branch. Is the colab branch still needed?

I see you added opentelemetry - how is this being used?

The pyinstller splashscreen is still experimental and might cause problems (e.g. not go away on some OS). But OK will test this out.

I will also fix the code_text.py difflib to diff-match-patch module after the merge.

kaixxx commented 1 month ago

I have resolved the conflict, no big deal.

Is the colab branch still needed?

No, it was just for developing the collaboration features and can be deleted.

The splash screen is not from pyinstaller. I've tested that also, but the entries in the spec file are commented out because of some issues. Now, the splash screen is implemented with Qt's QtWidgets.QSplashScreen (see gui() in __main__). What I've tested is that if an error ocurres during startup, the splash screen will go away and the error message will be visible.

Opentelemetry is used by chroma_db. But I've turned telemetry off at the very top of ai_vectorstore.py by setting the according environment variables before importing chroma_db.

ccbogel commented 1 month ago

RE: Add the new libraries to the installation instructions in the readme. I would suggest that we use the requirements.txt (which I have updated) instead of listing all the necessary libraries for each operating system separately. (If needed, one can add platform specific libraries in requirements.txt by using environment markers, e.g.: `pywin32; sys_platform == 'win32') Would that be ok for you? Yes OK with me, I might add to the install instructions, to hopefully cover for all operating systems ..? : pip install -r requirements.txt

ccbogel commented 1 month ago

OK merged. Lets see how it goes.

ccbogel commented 1 month ago

@kaixx I am trying to run via PyCharm and also via the commandline on Windows 11. I am seeing into some issues. The latest is the chromadb version issue. I changed this line: chromadb==0.5.0 to chromadb>0.4.0

ccbogel commented 1 month ago

@kaixxx I see a deprecation warning for pydantic, with a suggestion for improvement: image

There is also a deprecation warning for SipPyTypeDict() that I am aware of but do not know how to resolve.