Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Connect MATLAB to LLM APIs, including OpenAI® Chat Completions, Azure® OpenAI Services, and Ollama™

License

NotificationsYou must be signed in to change notification settings

matlab-deep-learning/llms-with-matlab

Repository files navigation

Open in MATLAB OnlineView Large Language Models (LLMs) with MATLAB on File Exchange

Large Language Models (LLMs) with MATLAB lets you connect to large language model APIs using MATLAB®.

You can connect to:

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 thedoc 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:Open in MATLAB Online

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.

  1. In MATLAB, go to theHome tab, and in theEnvironment section, click theAdd-Ons icon.
  2. In the Add-On Explorer, search for "Large Language Models (LLMs) with MATLAB".
  3. SelectInstall.

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

Agentic Workflows

Tool Calling

Structured Output

Retrieval-Augmented Generation (RAG)

Image Workflows

Functions

FunctionDescription
openAIChatConnect to OpenAI Chat Completion API from MATLAB
azureChatConnect to Azure OpenAI Services Chat Completion API from MATLAB
ollamaChatConnect to Ollama Server from MATLAB
generateGenerate output from large language models
openAIFunctionUse Function Calls from MATLAB
addParameterAdd input argument toopenAIFunction object
openAIImagesConnect to OpenAI Image Generation API from MATLAB
openAIImages.generateGenerate image using OpenAI image generation API
editEdit images using DALL·E 2
createVariationGenerate image variations using DALL·E 2
messageHistoryManage and store messages in a conversation
addSystemMessageAdd system message to message history
addUserMessageAdd user message to message history
addUserMessageWithImagesAdd user message with images to message history
addToolMessageAdd tool message to message history
addResponseMessageAdd response message to message history
removeMessageRemove message from message history

License

The license is available in thelicense.txt file in this GitHub repository.

Community Support

MATLAB Central

Copyright 2023-2025 The MathWorks, Inc.

About

Connect MATLAB to LLM APIs, including OpenAI® Chat Completions, Azure® OpenAI Services, and Ollama™

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors9


[8]ページ先頭

©2009-2025 Movatter.jp