From fc7e6586f535088fa6e4a2cb71013658fa0c0e1e Mon Sep 17 00:00:00 2001 From: Christopher Creutzig <89011131+ccreutzi@users.noreply.github.com> Date: Thu, 25 Jul 2024 09:05:40 +0200 Subject: [PATCH] =?UTF-8?q?Ollama=20should=20have=20=E2=84=A2,=20not=20?= =?UTF-8?q?=C2=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- +llms/+internal/callOllamaChatAPI.m | 2 +- README.md | 2 +- doc/Ollama.md | 2 +- examples/CreateSimpleOllamaChatBot.mlx | Bin 6134 -> 6140 bytes ...ugmentedGenerationUsingOllamaAndMATLAB.mlx | Bin 6103 -> 6089 bytes ollamaChat.m | 2 +- 6 files changed, 4 insertions(+), 4 deletions(-) diff --git a/+llms/+internal/callOllamaChatAPI.m b/+llms/+internal/callOllamaChatAPI.m index 31a1616..4596231 100644 --- a/+llms/+internal/callOllamaChatAPI.m +++ b/+llms/+internal/callOllamaChatAPI.m @@ -1,7 +1,7 @@ function [text, message, response] = callOllamaChatAPI(model, messages, nvp) % This function is undocumented and will change in a future release -%callOllamaChatAPI Calls the Ollama® chat completions API. +%callOllamaChatAPI Calls the Ollama™ chat completions API. % % MESSAGES and FUNCTIONS should be structs matching the json format % required by the Ollama Chat Completions API. diff --git a/README.md b/README.md index 96b2412..4bcf377 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Open in MATLAB Online](https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg)](https://matlab.mathworks.com/open/github/v1?repo=matlab-deep-learning/llms-with-matlab) [![View Large Language Models (LLMs) with MATLAB on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/163796-large-language-models-llms-with-matlab) -This repository contains code to connect MATLAB to the [OpenAI™ Chat Completions API](https://platform.openai.com/docs/guides/text-generation/chat-completions-api) (which powers ChatGPT™), OpenAI Images API (which powers DALL·E™), [Azure® OpenAI Service](https://learn.microsoft.com/en-us/azure/ai-services/openai/), and both local and nonlocal [Ollama®](https://ollama.com/) models. This allows you to leverage the natural language processing capabilities of large language models directly within your MATLAB environment. +This repository contains code to connect MATLAB to the [OpenAI™ Chat Completions API](https://platform.openai.com/docs/guides/text-generation/chat-completions-api) (which powers ChatGPT™), OpenAI Images API (which powers DALL·E™), [Azure® OpenAI Service](https://learn.microsoft.com/en-us/azure/ai-services/openai/), and both local and nonlocal [Ollama™](https://ollama.com/) models. This allows you to leverage the natural language processing capabilities of large language models directly within your MATLAB environment. ## Requirements diff --git a/doc/Ollama.md b/doc/Ollama.md index 6721e12..110a869 100644 --- a/doc/Ollama.md +++ b/doc/Ollama.md @@ -1,6 +1,6 @@ # Ollama -This repository contains code to connect MATLAB to an [Ollama®](https://ollama.com) server, running large language models (LLMs). +This repository contains code to connect MATLAB to an [Ollama™](https://ollama.com) server, running large language models (LLMs). To use local models with Ollama, you will need to install and start an Ollama server, and “pull” models into it. Please follow the Ollama documentation for details. You should be familiar with the limitations and risks associated with using this technology, and you agree that you shall be solely responsible for full compliance with any terms that may apply to your use of any specific model. diff --git a/examples/CreateSimpleOllamaChatBot.mlx b/examples/CreateSimpleOllamaChatBot.mlx index 64f9b31d0c55b7da55372b78a93dc66c7b0136b6..b87d21b4b5a46bd703b74cae8d70a0d2ff35581e 100644 GIT binary patch delta 2344 zcmV+@3D@@aFZ?gC#R3Vb%{IcJ1^@uolg1X79giO%awRe*0TuuwtIs`2570yOC_PDc0YX2P9NUfQi63NGM%VG&NUqNFK?sjx4VQ;HaC59%?tuku_Jf_J%TD%%Gklh0qJpxB8CzR8SLdUnG~<4VSs^2h8piS}8F z5@xCbT}gs)0ezdc3YoO11-bDNVQ}OC2V;e%EoRaoemppRJ9zoe-!N1~!Qh-_e=ocZQqMx-Uj=3HocNs# z;YZS!qa+O6uTh&ny>A9*GR~_64dI}X653*Ex?hsFuW+16ghC~lLrJR?NI^GkFjbs_ zFfM?FxXOyE02UvJRV8iPQGv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){p(2b8^Sd-tFnO0CNYck;u$DA#q)onZWUYH9nf z)BUJ~bb|<@lW!Ipv!@Be2L3d{S% z&VxRzBwc{I0ttyADt4ALZ7pKQvJGkf9yhe1Ko=~nd**07w^;5~i$1_Q+36A|F~tb9 z=o+cFC4R0~(HtY^xo&vdX(;gl97fA(QV7FDXW`Ly2CSFhP%vr7gemdPd&3BEVh4)5 zI1oC7o6aik!_#hmiQ(dnZ-JzgPKg4~8}2zd3L`Tb@k!Z;QEA?7I|v#5hOb6aA8#c9R}+Malbs0* z+(UzcgMICGPF}LxyLyGIl%{z^r%{sDbjEHLEX`jF@@xJZhf{@$Hu8VctfmW=&lsIw zNY8>$CHd23HTeXyu@VFV1V@*>Ym>PYHh()0!Y~Yk_x=jgJxyw81yTqb8xlf1MijLM zs=iQC5d3=*S`Z7H{oVP_a`C7uxRbF(+swl_5+P8NwRzE;=izRe4OOHq0b}m+s~(4zqrX=HfE<9rByzZ2w9>|V>sW~R9MN7UNTAW8nq-#*=uTIna?7+lQ6IXv-FcA>1aw_3#_p3E>o zF_!!b1Ihor{{oY)6^aSme*yHI1^@uvlR*|z0fdv379O-0v0RR9Q0ssIT00000 z000010000009O%{co7|wJQom?0T&tptCJiTN&>VKlg$zvlY97mVEYry~j0675w n04M+e00000009610001?6qC&o85C*6f00000zDZyW diff --git a/examples/RetrievalAugmentedGenerationUsingOllamaAndMATLAB.mlx b/examples/RetrievalAugmentedGenerationUsingOllamaAndMATLAB.mlx index c248ba065de7ec7dab65074271a283b1acdb84aa..c7f0776edfe5b1eb93fe2cba19feadb55fe7f3f4 100644 GIT binary patch delta 3065 zcmVk#R3T%MPJ9T2mk=Clgv%wRF}=GG>IPRICj5p&bliBR|!>NMsSkLj$l zf6!@=q}mt8fL$DQ`rYoUPRyn9h~-oVOS&fRXOg)e(c*5VN)qU(;8(nl2rukqfjE{7Rs?NBn0~$MLg#J{r7(uR{=X7ogIzd z6D#W&ra9XOq!Ksw(L$ZgrD5WR#|apif4N>5h971%%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