Skip to content

Commit ef2f01a

Browse files
MiriamScharnkeccreutzi
authored andcommitted
Update README.md
1 parent 1c9e534 commit ef2f01a

File tree

1 file changed

+76
-41
lines changed

1 file changed

+76
-41
lines changed

Diff for: README.md

+76-41
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,102 @@
1+
12
# Large Language Models (LLMs) with MATLAB
23

34
[![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)
45

5-
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.
6+
Large Language Models (LLMs) with MATLAB lets you connect to large language model APIs using MATLAB®.
7+
8+
9+
You can connect to:
610

7-
## Requirements
11+
- [OpenAI® Chat Completions API](https://platform.openai.com/docs/guides/text-generation/chat-completions-api) — For example, connect to ChatGPT™.
12+
- [OpenAI Images API](https://platform.openai.com/docs/guides/images) — For example, connect to DALL·E™.
13+
- [Azure® OpenAI Service](https://learn.microsoft.com/en-us/azure/ai-services/openai/) — Connect to OpenAI models from Azure.
14+
- [Ollama™](https://ollama.com/) — Connect to models locally or nonlocally.
815

9-
### MathWorks Products (https://www.mathworks.com)
16+
Using this add-on, you can:
1017

11-
- Requires MATLAB release R2024a or newer.
12-
- Some examples require Text Analytics Toolbox™.
18+
- Generate responses to natural language prompts.
19+
- Manage chat history.
20+
- Generate JSON\-formatted and structured output.
21+
- Use tool calling.
22+
- Generate, edit, and describe images.
1323

14-
### 3rd Party Products:
24+
For more information about the features in this add-on, see the documentation in the [`doc`](/doc) directory.
1525

16-
- For OpenAI connections: An active OpenAI API subscription and API key.
17-
- For Azure OpenAI Services: An active Azure subscription with OpenAI access, deployment, and API key.
18-
- For Ollama: An Ollama installation.
26+
# Installation
1927

20-
## Setup
28+
Using this add-on requires MATLAB R2024a or newer.
2129

22-
See these pages for instructions specific to the 3rd party product selected:
30+
## Use MATLAB Online
2331

24-
* [OpenAI](doc/OpenAI.md)
25-
* [Azure](doc/Azure.md)
26-
* [Ollama](doc/Ollama.md)
32+
You can use the add-on in MATLAB Online™ by clicking this link: [![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)
2733

34+
In MATLAB Online, you can connect to OpenAI and Azure. To connect to Ollama, use an installed version of MATLAB and install the add\-on using the Add\-On Explorer or by cloning the GitHub™ repository.
2835

29-
### MATLAB Online
36+
## Install using Add\-On Explorer
3037

31-
To use this repository with MATLAB Online, click [![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)
38+
The recommended way of using the add-on on an installed version of MATLAB is to use the Add\-On Explorer.
3239

40+
1. In MATLAB, go to the **Home** tab, and in the **Environment** section, click the **Add\-Ons** icon.
41+
2. In the Add\-On Explorer, search for "Large Language Models (LLMs) with MATLAB".
42+
3. Select **Install**.
43+
## Install by Cloning GitHub Repository
3344

34-
### MATLAB Desktop
45+
Alternatively, to use the add-on on an installed version of MATLAB, you can clone the GitHub repository. In the MATLAB Command Window, run this command:
3546

36-
To use this repository with a local installation of MATLAB, first clone the repository.
47+
```
48+
>> !git clone https://github.com/matlab-deep-learning/llms-with-matlab.git
49+
```
3750

38-
1. In the system command prompt, run:
51+
To run code from the add-on outside of the installation directory, if you install the add-on by cloning the GitHub repository, then you must add the path to the installation directory.
3952

40-
```bash
41-
git clone https://github.com/matlab-deep-learning/llms-with-matlab.git
42-
```
43-
44-
2. Open MATLAB and navigate to the directory where you cloned the repository.
53+
```
54+
>> addpath("path/to/llms-with-matlab")
55+
```
56+
# Get Started with External APIs
4557

46-
3. Add the directory to the MATLAB path.
58+
For more information about how to connect to the different APIs from MATLAB, including installation requirements, see:
59+
- [OpenAI](/doc/OpenAI.md)
60+
- [Azure OpenAI Service](/doc/Azure.md)
61+
- [Ollama](/doc/Ollama.md)
4762

48-
```matlab
49-
addpath('path/to/llms-with-matlab');
50-
```
63+
# Examples
5164

52-
## Examples
53-
To learn how to use this in your workflows, see [Examples](/examples/).
65+
- [Process Generated Text in Real Time by Using ChatGPT in Streaming Mode](/examples/ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode.md)
66+
- [Process Generated Text in Real Time by Using Ollama in Streaming Mode](/examples/ProcessGeneratedTextinRealTimebyUsingOllamainStreamingMode.md)
67+
- [Summarize Large Documents Using ChatGPT and MATLAB](/examples/SummarizeLargeDocumentsUsingChatGPTandMATLAB.md) (requires Text Analytics Toolbox™)
68+
- [Create Simple ChatBot](/examples/CreateSimpleChatBot.md) (requires Text Analytics Toolbox)
69+
- [Create Simple Ollama ChatBot](/examples/CreateSimpleOllamaChatBot.md)
70+
- [Analyze Scientific Papers Using ChatGPT Function Calls](/examples/AnalyzeScientificPapersUsingFunctionCalls.md)
71+
- [Analyze Sentiment in Text Using ChatGPT and Structured Output](/examples/AnalyzeSentimentinTextUsingChatGPTwithStructuredOutput.md)
72+
- [Analyze Text Data Using Parallel Function Calls with ChatGPT](/examples/AnalyzeTextDataUsingParallelFunctionCallwithChatGPT.md)
73+
- [Analyze Text Data Using Parallel Function Calls with Ollama](/examples/AnalyzeTextDataUsingParallelFunctionCallwithOllama.md)
74+
- [Retrieval-Augmented Generation Using ChatGPT and MATLAB](/examples/RetrievalAugmentedGenerationUsingChatGPTandMATLAB.md) (requires Text Analytics Toolbox)
75+
- [Retrieval-Augmented Generation Using Ollama and MATLAB](/examples/RetrievalAugmentedGenerationUsingOllamaAndMATLAB.md) (requires Text Analytics Toolbox)
76+
- [Describe Images Using ChatGPT](/examples/DescribeImagesUsingChatGPT.md)
77+
- [Using DALL·E To Edit Images](/examples/UsingDALLEToEditImages.md)
78+
- [Using DALL·E To Generate Images](/examples/UsingDALLEToGenerateImages.md)
5479

55-
- [ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode.md](/examples/ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode.md): Learn to implement a simple chat that stream the response.
56-
- [SummarizeLargeDocumentsUsingChatGPTandMATLAB.md](/examples/SummarizeLargeDocumentsUsingChatGPTandMATLAB.md): Learn to create concise summaries of long texts with ChatGPT. (Requires Text Analytics Toolbox™)
57-
- [CreateSimpleChatBot.md](/examples/CreateSimpleChatBot.md): Build a conversational chatbot capable of handling various dialogue scenarios using ChatGPT. (Requires Text Analytics Toolbox)
58-
- [AnalyzeScientificPapersUsingFunctionCalls.md](/examples/AnalyzeScientificPapersUsingFunctionCalls.md): Learn how to create agents capable of executing MATLAB functions.
59-
- [AnalyzeTextDataUsingParallelFunctionCallwithChatGPT.md](/examples/AnalyzeTextDataUsingParallelFunctionCallwithChatGPT.md): Learn how to take advantage of parallel function calling.
60-
- [RetrievalAugmentedGenerationUsingChatGPTandMATLAB.md](/examples/RetrievalAugmentedGenerationUsingChatGPTandMATLAB.md): Learn about retrieval augmented generation with a simple use case. (Requires Text Analytics Toolbox™)
61-
- [DescribeImagesUsingChatGPT.md](/examples/DescribeImagesUsingChatGPT.md): Learn how to use GPT-4 Turbo with Vision to understand the content of an image.
62-
- [AnalyzeSentimentinTextUsingChatGPTinJSONMode.md](/examples/AnalyzeSentimentinTextUsingChatGPTinJSONMode.md): Learn how to use JSON mode in chat completions
63-
- [UsingDALLEToEditImages.md](/examples/UsingDALLEToEditImages.md): Learn how to generate images
64-
- [UsingDALLEToGenerateImages.md](/examples/UsingDALLEToGenerateImages.md): Create variations of images and editimages.
80+
# Functions
81+
| **Function** | **Description** |
82+
| :-- | :-- |
83+
| [openAIChat](/doc/functions/openAIChat.md) | Connect to OpenAI Chat Completion API from MATLAB |
84+
| [azureChat](/doc/functions/azureChat.md) | Connect to Azure OpenAI Services Chat Completion API from MATLAB |
85+
| [ollamaChat](/doc/functions/ollamaChat.md) | Connect to Ollama Server from MATLAB |
86+
| [generate](/doc/functions/generate.md) | Generate output from large language models |
87+
| [openAIFunction](/doc/functions/openAIFunction.md) | Use Function Calls from MATLAB |
88+
| [addParameter](/doc/functions/addParameter.md) | Add input argument to `openAIFunction` object |
89+
| [openAIImages](/doc/functions/openAIImages.md) | Connect to OpenAI Image Generation API from MATLAB |
90+
| [openAIImages.generate](/doc/functions/openAIImages.generate.md) | Generate image using OpenAI image generation API |
91+
| [edit](/doc/functions/edit.md) | Edit images using DALL·E 2 |
92+
| [createVariation](/doc/functions/createVariation.md) | Generate image variations using DALL·E 2 |
93+
| [messageHistory](/doc/functions/messageHistory.md) | Manage and store messages in a conversation |
94+
| [addSystemMessage](/doc/functions/addSystemMessage.md) | Add system message to message history |
95+
| [addUserMessage](/doc/functions/addUserMessage.md) | Add user message to message history |
96+
| [addUserMessageWithImages](/doc/functions/addUserMessageWithImages.md) | Add user message with images to message history |
97+
| [addToolMessage](/doc/functions/addToolMessage.md) | Add tool message to message history |
98+
| [addResponseMessage](/doc/functions/addResponseMessage.md) | Add response message to message history |
99+
| [removeMessage](/doc/functions/removeMessage.md) | Remove message from message history |
65100

66101
## License
67102

@@ -70,4 +105,4 @@ The license is available in the [license.txt](license.txt) file in this GitHub r
70105
## Community Support
71106
[MATLAB Central](https://www.mathworks.com/matlabcentral)
72107

73-
Copyright 2023-2024 The MathWorks, Inc.
108+
Copyright 2023-2025 The MathWorks, Inc.

0 commit comments

Comments
 (0)