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

Ollama, Mistral AI, etc. #7296

Merged
merged 45 commits into from
Mar 17, 2024
Merged

Ollama, Mistral AI, etc. #7296

merged 45 commits into from
Mar 17, 2024

Conversation

haraldschilly
Copy link
Contributor

@haraldschilly haraldschilly commented Feb 22, 2024

Description

  • selecting a model in the dialog is now a dropdown, plus some small changes
    • this dropdown is used in account settings/others
  • add dynamic frontend configuration for arbitrary ollama models
    • with that, backend logic to deal with arbitrary ollama-[model] models
    • my main test for this ended up to be google's gamma model
  • many enhancements, refactorings and cleanups for LLM overall. This does not change the actual naming schema of the models, yet. This PR is already too complex.
  • Slight changes to the system prompt:
    • it now depends on the vendor/model
    • in the future it might even depend on the file type (path)
  • Many changes and fixes for the AI Formula generator
  • Adding GPT-4 Turbo as yet another paid option
    • Since the minimum commitment is >$5, I've also added an "8k" variant of it. That way, the limits are lower, less "dangerous" to use
  • adding Mistral models and the "Large" one is a paid model
    • The big issue with mistral is their badly coded lib. I had to fork it: https://github.com/sagemathinc/mistralai-client-js
    • and then figure out how to tell langchain to use it. The package.json config looks odd, I have the feeling there there is a bug related to using this in a workspace. In any case, once this is fixed upstream, this bandaid has to go away.
  • fixing disable some AI integration instructor course setting seems to disable everything now #7341

testing

chat with GPT4 turbo (deliberately bad language on my side!) and testing reply-continuation.

Screenshot from 2024-03-15 16-27-26

Screenshot from 2024-03-15 16-27-44

I can also select an LLM in the slate editor in a chat input

course

  1. partially disabled: explain cell and fix-error does work, and also replies
  2. partially disabled: AI formula does say it is disabled
  3. fully disabled: no explain button, no fix-error button
  4. base case: no AI tools disabled: yes, students can do all of this

Ollama

This is the main part before this PR escalated: there is now a config parameter, which contains a dict of {[model name]: {config params}, ... } which is described in the description of that admin field and also has some detailed checks. The main point is, you can chat with any model that is available via the ollama api, you can have several ollama instances, and for each of them several models.

configuration example
Screenshot from 2024-03-15 17-19-08

and with that, there is a @gemma chat, a displayed name, a description, and of course it streams answers like the others

Screenshot from 2024-03-15 17-20-40

status

ok, the latest with this PR is everything is tested and works, but there seems to be a problem with the mistral lib itself, and modifying what fetch does. this is a bit ugly.

This seems to be the root cause: mistralai/client-js#42

Checklist:

  • Testing instructions are provided, if not obvious
  • Release instructions are provided, if not obvious

@haraldschilly haraldschilly force-pushed the support-ollama-api branch 2 times, most recently from 932140d to fda426d Compare February 22, 2024 15:07
@haraldschilly haraldschilly force-pushed the support-ollama-api branch 2 times, most recently from e06b06e to 5b78197 Compare February 23, 2024 14:11
@haraldschilly haraldschilly force-pushed the support-ollama-api branch 2 times, most recently from 34824c9 to fbd281f Compare February 27, 2024 18:38
…add ollama description, and fix bug with ai-formula (no project context)
@haraldschilly haraldschilly force-pushed the support-ollama-api branch 6 times, most recently from 37b0791 to bd8e6e1 Compare March 8, 2024 17:06
@haraldschilly haraldschilly force-pushed the support-ollama-api branch 2 times, most recently from 69ca9a2 to 783ce97 Compare March 15, 2024 15:43
@haraldschilly haraldschilly force-pushed the support-ollama-api branch 2 times, most recently from 45d995a to 8e45e47 Compare March 17, 2024 13:05
@haraldschilly haraldschilly force-pushed the support-ollama-api branch 7 times, most recently from dab80a5 to 055cbb9 Compare March 17, 2024 19:00
@haraldschilly haraldschilly marked this pull request as ready for review March 17, 2024 19:21
@haraldschilly
Copy link
Contributor Author

this is super long and I stumbled over many obstacles. however, I'm now at a point where I think it's fine to merge. I didn't do all the refactoring I wanted to do, but at least a lot of things are collected in one place now. Further details are in the first message.

@williamstein williamstein merged commit 0b15762 into master Mar 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants