Skip to content

Commit a9a56e9

Browse files
committed
Remove redundant addpath calls
Since we recommend users get this code via Add-On Manager, which adds everything to the path, all those `addpath` calls are redundant.
1 parent d54de59 commit a9a56e9

18 files changed

+25
-18
lines changed

examples/AnalyzeScientificPapersUsingFunctionCalls.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ To run this example, you need a valid API key from a paid OpenAI™ API account.
1414

1515
```matlab
1616
loadenv(".env")
17-
addpath('../..')
1817
```
1918
# Initialize OpenAI API Function and Chat
2019

examples/AnalyzeSentimentinTextUsingChatGPTwithStructuredOutput.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ To run this example, you need a valid API key from a paid OpenAI™ API account.
1010

1111
```matlab
1212
loadenv(".env")
13-
addpath('../..')
1413
```
1514

1615
Define some text to analyze the sentiment.
@@ -50,6 +49,7 @@ prototype = struct with fields:
5049
5150
```
5251

52+
5353
Create a chat object and set `ResponseFormat` to `prototype`.
5454

5555
```matlab
@@ -78,6 +78,8 @@ T = struct2table(scores);
7878
T.text = inputText;
7979
T = movevars(T,"text","Before","sentiment")
8080
```
81+
82+
8183
| |text|sentiment|confidence|
8284
|:--:|:--:|:--:|:--:|
8385
|1|"I can't stand homework."|negative|0.9500|
@@ -90,5 +92,6 @@ T = movevars(T,"text","Before","sentiment")
9092
|8|"More work. Great!"|positive|0.9000|
9193

9294

95+
9396
*Copyright 2024 The MathWorks, Inc.*
9497

examples/CreateSimpleChatBot.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ When you run this example, an interactive AI chat starts in the MATLAB® Command
1515

1616
To run this example, you need a valid API key from a paid OpenAI™ API account.
1717

18+
```matlab
19+
loadenv(".env")
20+
```
1821
# Setup Model
1922

2023
Set the maximum allowable number of words per chat session and define the keyword that, when entered by the user, ends the chat session. This example uses the model o1.
@@ -123,6 +126,7 @@ AI: Time is the dimension in which events occur sequentially from past to future
123126
User: end
124127
AI: Closing the chat. Have a great day!
125128
```
129+
126130
# `countNumWords` function
127131

128132
Function to count the number of words in a text string

examples/DescribeImagesUsingChatGPT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ This example shows how to generate image descriptions using the addUserMessageWi
77

88
```matlab
99
loadenv(".env")
10-
addpath('../..')
1110
```
1211
# Load and Display Image Data
1312

@@ -54,6 +53,7 @@ wrappedText =
5453
is bright and cloudy, creating a serene and tranquil atmosphere."
5554
5655
```
56+
5757
# Helper function
5858
```matlab
5959
function wrappedText = wrapText(text)

examples/InformationRetrievalUsingOpenAIDocumentEmbedding.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Information Retrieval Using OpenAI Document Embedding
2+
# Information Retrieval Using OpenAI Document Embedding
33

44
To run the code shown on this page, open the MLX file in MATLAB®: [mlx-scripts/InformationRetrievalUsingOpenAIDocumentEmbedding.mlx](mlx-scripts/InformationRetrievalUsingOpenAIDocumentEmbedding.mlx)
55

@@ -19,11 +19,10 @@ This process is sometimes referred to as Retrieval\-Augmented Generation (RAG),
1919
This example requires Text Analytics Toolbox™.
2020

2121

22-
To run this example, you need a valid API key from a paid OpenAI API account.
22+
To run this example, you need a valid API key from a paid OpenAI API account.
2323

2424
```matlab
2525
loadenv(".env")
26-
addpath('../..')
2726
```
2827
# Embed Query Document
2928

@@ -40,6 +39,7 @@ ans = 1x5
4039
-0.0051 -0.0005 0.0362 -0.0069 0.0534
4140
4241
```
42+
4343
# Download and Embed Source Text
4444

4545
In this example, we will scrape content from several MATLAB documentation pages.
@@ -106,6 +106,7 @@ ans =
106106
107107
```
108108

109+
109110
Pass the question and the context for generation to get a contextualized answer.
110111

111112
```matlab
@@ -120,6 +121,7 @@ ans =
120121
This makes tables an ideal data structure for organizing and manipulating data in a tabular format."
121122
122123
```
124+
123125
# Helper Function
124126

125127
Helper function to wrap text for easier reading in the live script.

examples/ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
# Process Generated Text in Real Time by Using ChatGPT in Streaming Mode
2+
# Process Generated Text in Real Time by Using ChatGPT in Streaming Mode
33

44
To run the code shown on this page, open the MLX file in MATLAB®: [mlx-scripts/ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode.mlx](mlx-scripts/ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode.mlx)
55

6-
This example shows how to process generated text in real time by using ChatGPT in streaming mode.
6+
This example shows how to process generated text in real time by using ChatGPT in streaming mode.
77

88

99
By default, when you pass a prompt to ChatGPT, it generates a response internally and then outputs it in full at the end. To print out and format generated text as the model is generating it, use the `StreamFun` name\-value argument of the `openAIChat` class. The streaming function is a custom function handle that tells the model what to do with the output.
@@ -18,7 +18,6 @@ To run this example, you need a valid API key from a paid OpenAI™ API account.
1818

1919
```matlab
2020
loadenv(".env")
21-
addpath('../..')
2221
```
2322
# Print Stream Directly to Screen
2423

@@ -49,6 +48,7 @@ generate(chat, prompt, MaxNumTokens=500);
4948
```matlabTextOutput
5049
Model-Based Design is an approach to system development that uses graphical models to design and simulate systems before implementing them in hardware or software. It involves creating models that represent the behavior and interactions of system components, and using these models to analyze, validate, and optimize the system before building it. Model-Based Design can help to improve the efficiency, reliability, and quality of system development by enabling engineers to explore design alternatives, detect errors early in the development process, and facilitate collaboration between different teams working on the same project.
5150
```
51+
5252
# Print Stream to HTML UI Component
5353

5454
In this example, the streamed output is printed to the HTML component.

examples/RetrievalAugmentedGenerationUsingChatGPTandMATLAB.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Retrieval\-Augmented Generation Using ChatGPT and MATLAB
2+
# Retrieval\-Augmented Generation Using ChatGPT and MATLAB
33

44
To run the code shown on this page, open the MLX file in MATLAB®: [mlx-scripts/RetrievalAugmentedGenerationUsingChatGPTandMATLAB.mlx](mlx-scripts/RetrievalAugmentedGenerationUsingChatGPTandMATLAB.mlx)
55

@@ -10,7 +10,7 @@ The example contains three steps:
1010

1111
- Download and preprocess documents.
1212
- Find documents relevant to a query using keyword search.
13-
- Generate a response using ChatGPT based on the both the query and the most relevant source document. \-> title "Generate Response"
13+
- Generate a response using ChatGPT based on the both the query and the most relevant source document.
1414

1515
This example requires Text Analytics Toolbox™.
1616

@@ -19,7 +19,6 @@ To run this example, you need a valid API key from a paid OpenAI™ API account.
1919

2020
```matlab
2121
loadenv(".env")
22-
addpath('../..')
2322
```
2423
# Download and Preprocess Documents
2524

@@ -138,6 +137,7 @@ ans =
138137
connection of DPV installations to the grid efficiently and effectively."
139138
140139
```
140+
141141
# Helper Functions
142142
```matlab
143143
function allDocs = preprocessDocuments(str)

examples/SummarizeLargeDocumentsUsingChatGPTandMATLAB.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
# Summarize Large Documents Using ChatGPT and MATLAB®
2+
# Summarize Large Documents Using ChatGPT and MATLAB
33

44
To run the code shown on this page, open the MLX file in MATLAB®: [mlx-scripts/SummarizeLargeDocumentsUsingChatGPTandMATLAB.mlx](mlx-scripts/SummarizeLargeDocumentsUsingChatGPTandMATLAB.mlx)
55

6-
This example shows how to use ChatGPT to summarize documents that are too large to be summarized at once.
6+
This example shows how to use ChatGPT to summarize documents that are too large to be summarized at once.
77

88

99
To summarize short documents using ChatGPT, you can pass the documents directly as a prompt together with an instruction to summarize them. However, ChatGPT can only process prompts of limited size.
@@ -24,7 +24,6 @@ To run this example, you need a valid API key from a paid OpenAI™ API account.
2424

2525
```matlab
2626
loadenv(".env")
27-
addpath('../..')
2827
```
2928
# Download Text Data
3029

@@ -107,6 +106,7 @@ ans =
107106
The narrative is filled with illogical and imaginative elements, capturing readers' imaginations with its colorful and eccentric storytelling."
108107
109108
```
109+
110110
# `createChunks` function
111111

112112
This function segments a long text into smaller parts of a predefined size to facilitate easier summarization. It preserves the structure of sentences. The `chunkSize` should be large enough to fit at least one sentence.

examples/UsingDALLEToEditImages.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11

2-
# Using DALL·E to Edit Images
2+
# Using DALL·E to Edit Images
33

44
To run the code shown on this page, open the MLX file in MATLAB®: [mlx-scripts/UsingDALLEToEditImages.mlx](mlx-scripts/UsingDALLEToEditImages.mlx)
55

66
This example shows how to generate and edit images using the `openAIImages` object.
77

88

9-
To run this example, you need a valid OpenAI™ API key. Creating images using DALL•E may incur a fee.
9+
To run this example, you need a valid OpenAI™ API key. Creating images using DALL•E may incur a fee.
1010

1111
```matlab
1212
loadenv(".env")
13-
addpath("../..")
1413
```
1514

1615
We want to load images files relative to the project directory below:
Binary file not shown.

0 commit comments

Comments
 (0)