Download Latest Version v4.3.0_ Support for GPT-4.1 source code.tar.gz (34.7 MB)
Email in envelope

Get an email when there's a new version of Large Language Models (LLMs)

Home / v4.1.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2024-12-13 1.1 kB
v4.1.0_ Structured Outputs with Ollama source code.tar.gz 2024-12-13 25.2 MB
v4.1.0_ Structured Outputs with Ollama source code.zip 2024-12-13 25.3 MB
Totals: 3 Items   50.6 MB 1

Ensure output format using structured outputs with Ollama

You can now use structured output to generate output using ollamaChat objects.

In LLMs with MATLAB, you can specify the structure of the output in two different ways.

  • Specify a valid JSON Schema directly.
  • Specify an example structure array that adheres to the required output format. The software automatically generates the corresponding JSON Schema and provides this to the LLM. Then, the software automatically converts the output of the LLM back into a structure array.

To do this, set the ReponseFormat name-value argument of ollamaChat or generate to one of these options.

  • A string scalar containing a valid JSON Schema.
  • A structure array containing an example that adheres to the required format, for example:
    ResponseFormat=struct("Name","Rudolph","NoseColor",[255 0 0])

For more information on structured output in Ollama™, see https://ollama.com/blog/structured-outputs.

Full Changelog: https://github.com/matlab-deep-learning/llms-with-matlab/compare/v4.0.0...v4.1.0

Source: README.md, updated 2024-12-13