Skip to content

Commit

Permalink
Move code into toolbox/
Browse files Browse the repository at this point in the history
  • Loading branch information
ccreutzi committed Aug 14, 2024
1 parent 150d9c1 commit 25a8075
Show file tree
Hide file tree
Showing 66 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ pwd
# Note that this script will not remove media files. If an mlx has
# fewer plots at some point in the future, there will be file system
# cruft. Which doesn't hurt the md display in GitHub or elswehere.
changedMlxFiles=`git diff --cached --name-only --diff-filter=d '*.mlx'`
changedMlxFiles=`git diff --cached --name-only --diff-filter=d 'toolbox/examples/*.mlx'`

if [ -n "$changedMlxFiles" ]; then
# Keep the line break here, we replace end-of-line with "' '" to get the quotes right
matlab -batch "for file = {'${changedMlxFiles//
/' '}'}, export(file{1},replace(erase(file{1},'mlx-scripts'),'.mlx','.md')); end"
tmp=${changedMlxFiles//mlx-scripts\//}
/' '}'}, export(file{1},replace(erase(file{1},'toolbox/'),'.mlx','.md')); end"
tmp=${changedMlxFiles//toolbox\//}
mdFiles=${tmp//.mlx/.md}
for file in $mdFiles; do
if [ -d ${file%.md}_media ]; then
git add ${file%.md}_media/
fi
perl -pi -e "\$cnt++ if /^#/; " \
-e "\$_ .= \"\nTo run the code shown on this page, open the MLX file in MATLAB®: [mlx-scripts/$(basename $file .md).mlx](mlx-scripts/$(basename $file .md).mlx) \n\" if /^#/ && \$cnt==1;" \
-e "\$_ .= \"\nTo run the code shown on this page, open the MLX file in MATLAB®: [$(basename $file .md).mlx](/toolbox/examples/$(basename $file .md).mlx) \n\" if /^#/ && \$cnt==1;" \
$file
done
git add $mdFiles
Expand Down
2 changes: 1 addition & 1 deletion examples/AnalyzeScientificPapersUsingFunctionCalls.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Analyze Scientific Papers Using ChatGPT™ Function Calls

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

This example shows how to extract recent scientific papers from ArXiv, summarize them using ChatGPT, and write the results to a CSV file using the `openAIFunction` function.

Expand Down
2 changes: 1 addition & 1 deletion examples/AnalyzeSentimentinTextUsingChatGPTinJSONMode.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Analyze Sentiment in Text Using ChatGPT™ in JSON Mode

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

This example shows how to use ChatGPT for sentiment analysis and output the results in JSON format.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Analyze Text Data Using Parallel Function Calls with ChatGPT™

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

This example shows how to detect multiple function calls in a single user prompt and use this to extract information from text data.

Expand Down
2 changes: 1 addition & 1 deletion examples/CreateSimpleChatBot.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Create Simple ChatBot

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

This example shows how to create a simple chatbot using the `openAIChat` and `messageHistory` functions.

Expand Down
2 changes: 1 addition & 1 deletion examples/CreateSimpleOllamaChatBot.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Create Simple ChatBot

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

This example shows how to create a simple chatbot using the `ollamaChat` and `messageHistory` functions.

Expand Down
2 changes: 1 addition & 1 deletion examples/DescribeImagesUsingChatGPT.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Describe Images Using ChatGPT™

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

This example shows how to generate image descriptions using the addUserMessageWithImages function. To run this example, you need a valid API key from a paid OpenAI™ API account, and a history of successful payment.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Information Retrieval Using OpenAI™ Document Embedding

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

This example shows how to find documents to answer queries using the 'text\-embedding\-3\-small' document embedding model. Embeddings are used to represent documents and queries in a high\-dimensional space, allowing for the efficient retrieval of relevant information based on semantic similarity.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Process Generated Text in Real Time by Using Ollama™ in Streaming Mode

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

This example shows how to process generated text in real time by using Ollama in streaming mode.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Process Generated Text in Real Time by Using ChatGPT™ in Streaming Mode

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

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Retrieval\-Augmented Generation Using ChatGPT™ and MATLAB

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

This example shows how to use retrieval\-augmented generation to generate answers to queries based on information contained in a document corpus.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Retrieval\-Augmented Generation Using Ollama™ and MATLAB

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

This example shows how to use retrieval\-augmented generation to generate answers to queries based on information contained in a document corpus.

Expand Down
2 changes: 1 addition & 1 deletion examples/SummarizeLargeDocumentsUsingChatGPTandMATLAB.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Summarize Large Documents Using ChatGPT™ and MATLAB®

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

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

Expand Down
2 changes: 1 addition & 1 deletion examples/UsingDALLEToEditImages.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Using DALL·E™ to Edit Images

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

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

Expand Down
2 changes: 1 addition & 1 deletion examples/UsingDALLEToGenerateImages.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Using DALL·E™ to generate images

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

This example shows how to generate images using the `openAIImages` object.

Expand Down
2 changes: 1 addition & 1 deletion tests/texampleTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function setUpAndTearDowns(testCase)
end

import matlab.unittest.fixtures.CurrentFolderFixture
testCase.applyFixture(CurrentFolderFixture("../examples/mlx-scripts"));
testCase.applyFixture(CurrentFolderFixture("../toolbox/examples"));

openAIEnvVar = "OPENAI_KEY";
secretKey = getenv(openAIEnvVar);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added toolbox/examples/data/WBD_1.pdf
Binary file not shown.
Binary file added toolbox/examples/data/WBD_2.pdf
Binary file not shown.
Binary file added toolbox/examples/data/WBD_3.pdf
Binary file not shown.
Binary file added toolbox/examples/images/bear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added toolbox/examples/images/mask_bear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 25a8075

Please sign in to comment.