-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update list of supported models on OpenAI
Add o1, remove the deprecated 3.5-0613 models. Change examples from outdated 3.5-turbo models to newer ones (picked at random). `topenAIChat/canUseModel` needed a change because the o1 models error with `MaxNumTokens=1`, as they need a few tokens to get the multiple stages started.
- Loading branch information
Showing
8 changed files
with
39 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
function models = models | ||
%MODELS - supported OpenAI models | ||
|
||
% Copyright 2024 The MathWorks, Inc. | ||
% Copyright 2024-2025 The MathWorks, Inc. | ||
models = [... | ||
"gpt-4o","gpt-4o-2024-05-13",... | ||
"gpt-4o","gpt-4o-2024-05-13","gpt-4o-2024-08-06","gpt-4o-2024-11-20",... | ||
"chatgpt-4o-latest",... | ||
"gpt-4o-mini","gpt-4o-mini-2024-07-18",... | ||
"gpt-4-turbo","gpt-4-turbo-2024-04-09",... | ||
"gpt-4","gpt-4-0613", ... | ||
"gpt-4-turbo","gpt-4-turbo-2024-04-09","gpt-4-turbo-preview",... | ||
"gpt-4","gpt-4-0125-preview","gpt-4-0613","gpt-4-1106-preview",... | ||
"gpt-3.5-turbo","gpt-3.5-turbo-0125", ... | ||
"gpt-3.5-turbo-1106",... | ||
"o1-preview",... | ||
"o1-mini",... | ||
"gpt-3.5-turbo-16k",... | ||
"o1-preview","o1-preview-2024-09-12",... | ||
"o1-mini","o1-mini-2024-09-12",... | ||
"o1","o1-2024-12-17",... | ||
]; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,6 @@ This example contains four steps: | |
|
||
To run this example, you need a valid API key from a paid OpenAI™ API account. | ||
|
||
```matlab | ||
loadenv(".env") | ||
addpath('../..') | ||
``` | ||
# Extracting data from text | ||
|
||
The customer record contains fictional information. | ||
|
@@ -54,10 +50,10 @@ messages = messageHistory; | |
messages = addUserMessage(messages,"Extract data from the record: " + record); | ||
``` | ||
|
||
Create a chat object. Specify the model to be `"gpt-3.5-turbo"`, which supports parallel function calls. | ||
Create a chat object. Specify the model to be `"gpt-4o-mini"`, which supports parallel function calls. | ||
|
||
```matlab | ||
model = "gpt-3.5-turbo"; | ||
model = "gpt-4o-mini"; | ||
chat = openAIChat("You are an AI assistant designed to extract customer data.","ModelName",model,Tools=f); | ||
``` | ||
|
||
|
@@ -105,10 +101,10 @@ f = addParameter(f,"minAge",type="integer",description="The minimum customer age | |
f = addParameter(f,"maxAge",type="integer",description="The maximum customer age",RequiredParameter=true); | ||
``` | ||
|
||
Create a chat object with a latest model. | ||
Create a chat object. | ||
|
||
```matlab | ||
model = "gpt-3.5-turbo"; | ||
model = "gpt-4o-mini"; | ||
chat = openAIChat("You are an AI assistant designed to search customer data.",ModelName=model,Tools=f); | ||
``` | ||
|
||
|
@@ -130,7 +126,7 @@ end | |
|
||
```matlabTextOutput | ||
tcalls = struct with fields: | ||
id: 'call_JKENvUzMbNclCTI8GTBmY7YT' | ||
id: 'call_t4ECuPMLP5mCuRCDG8ZnyjDY' | ||
type: 'function' | ||
function: [1x1 struct] | ||
|
@@ -161,10 +157,19 @@ end | |
|
||
```matlabTextOutput | ||
txt = | ||
"The customers who are under 30 and older than 27 are: | ||
1. Jane Smith (age 28) | ||
2. Alex Lee (age 29) | ||
3. Liam Tanaka (age 28)" | ||
"Here are the customers who are under 30 and older than 27: | ||
1. **Jane Smith** | ||
- Age: 28 | ||
- Email: [email protected] | ||
2. **Alex Lee** | ||
- Age: 29 | ||
- Email: [email protected] | ||
3. **Liam Tanaka** | ||
- Age: 28 | ||
- Email: [email protected]" | ||
``` | ||
# Helper functions | ||
|
@@ -214,5 +219,5 @@ function msg = processToolCalls(data, msg, toolCalls) | |
end | ||
``` | ||
|
||
*Copyright 2024 The MathWorks, Inc.* | ||
*Copyright 2024\-2025 The MathWorks, Inc.* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-44 Bytes
(99%)
examples/mlx-scripts/AnalyzeTextDataUsingParallelFunctionCallwithChatGPT.mlx
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters