matlab-deep-learning/llms-with-matlab
소개
Connect MATLAB to LLM APIs, including OpenAI® Chat Completions, Azure® OpenAI Services, and Ollama™
AI 및 머신러닝측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +3
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalLarge Language Models (LLMs) with MATLAB
Large Language Models (LLMs) with MATLAB lets you connect to large language model APIs using MATLAB®.
[!NOTE] For a simplified approach to building LLM and agentic applications in MATLAB, see the research preview of MATLAB AI Agent SDK.
Large Language Models (LLMs) with MATLAB will no longer get new features.
You can connect to:
- OpenAI® Chat Completions API — For example, connect to ChatGPT™.
- OpenAI-compatible APIs — Connect to APIs that are compatible with the OpenAI Chat Completions API.
- OpenAI Images API — Connect to image generation models from OpenAI.
- Azure® OpenAI Service — Connect to OpenAI models from Azure.
- Ollama™ — Connect to models locally or nonlocally.
Using this add-on, you can:
- Generate responses to natural language prompts.
- Manage chat history.
- Generate JSON-formatted and structured output.
- Use tool calling.
- Call external tools provided by MCP servers (requires the MATLAB MCP HTTP Client add-on).
- Generate, edit, and describe images.
For more information about the features in this add-on, see the documentation in the doc directory.
Installation
Using this add-on requires MATLAB R2024a or newer.
Use MATLAB Online
You can use the add-on in MATLAB Online™ by clicking this link:
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.
Install using Add-On Explorer
The recommended way of using the add-on on an installed version of MATLAB is to use the Add-On Explorer.
- In MATLAB, go to the Home tab, and in the Environment section, click the Add-Ons icon.
- In the Add-On Explorer, search for "Large Language Models (LLMs) with MATLAB".
- Select Install.
Get Started with External APIs
For more information about how to connect to the different APIs from MATLAB, including installation requirements, see:
Examples
Getting Started
- Process Generated Text in Real Time by Using ChatGPT in Streaming Mode
- Process Generated Text in Real Time by Using Ollama in Streaming Mode
- Summarize Large Documents Using ChatGPT and MATLAB (requires Text Analytics Toolbox™)
- Create Simple ChatBot (requires Text Analytics Toolbox)
- Create Simple Ollama ChatBot (requires Text Analytics Toolbox)
Agentic Workflows
- Solve Simple Math Problem Using AI Agent
- Fit Polynomial to Data Using AI Agent (requires Curve Fitting Toolbox™)
- Analyze Table Data Using ChatGPT
- Visualize Table Data Using ChatGPT
- Build Optimization Problem Using ChatGPT (requires Optimization Toolbox™ and Global Optimization Toolbox™)
Tool Calling
- Analyze Scientific Papers Using ChatGPT Function Calls
- Analyze Text Data Using Parallel Function Calls with ChatGPT
- Analyze Text Data Using Parallel Function Calls with Ollama
Structured Output
Retrieval-Augmented Generation (RAG)
- Retrieval-Augmented Generation Using ChatGPT and MATLAB (requires Text Analytics Toolbox)
- Retrieval-Augmented Generation Using Ollama and MATLAB (requires Text Analytics Toolbox)
Image Workflows
See Also
- Add OpenTelemetry Observability to AI Agent (OpenTelemetry-MATLAB)
Functions
| Function | Description |
|---|---|
| openAIChat | Connect to OpenAI Chat Completion API from MATLAB |
| azureChat | Connect to Azure OpenAI Services Chat Completion API from MATLAB |
| ollamaChat | Connect to Ollama Server from MATLAB |
| generate | Generate output from large language models |
| openAIFunction | Use Function Calls from MATLAB |
| addParameter | Add input argument to openAIFunction object |
| openAIImages | Connect to OpenAI Image Generation API from MATLAB |
| openAIImages.generate | Generate image using OpenAI image generation API |
| edit | Edit images using OpenAI image generation API |
| messageHistory | Manage and store messages in a conversation |
| addSystemMessage | Add system message to message history |
| addUserMessage | Add user message to message history |
| addUserMessageWithImages | Add user message with images to message history |
| addToolMessage | Add tool message to message history |
| addResponseMessage | Add response message to message history |
| removeMessage | Remove message from message history |
License
The license is available in the license.txt file in this GitHub repository.
Community Support
Copyright 2023-2026 The MathWorks, Inc.
관련 프로젝트 살펴보기
불러오는 중…