Basic Examples (5)

Try a basic question:

({{"[◼]", "OllamaSynthesize" }})["Hello, who was Albert Einstein?"]

Ask a question about an image:

({{"[◼]", "OllamaSynthesize" }})["Who is the person in the picture?",{}]

Ask another question about a different image:

({{"[◼]", "OllamaSynthesize" }})["What animal is this?",{}]

A similar question with a different vision-enabled LLM model:

({{"[◼]", "OllamaSynthesize" }})["What is in this image?",{},"OllamaModel"->"moondream"]

Mix the question and image(s) in a single list:

({{"[◼]", "OllamaSynthesize" }})[{,"What is in this image?"}]

Scope (1)

Solve basic math problems with step by step instructions:

({{"[◼]", "OllamaSynthesize" }})["I have three boxes of six pencils each. How many pencils do I have?"]//Style[#,"Text"]&

Options (3)

The default model is "Llava". Use the "OllamaModel" option to specify another one:

({{"[◼]", "OllamaSynthesize" }})["Hello, who are what are you?","OllamaModel"->"llama3.2"]

Larger models work too, but are slower. Also your machine will need to have sufficient GPU memory to run the model:

({{"[◼]", "OllamaSynthesize" }})["Hello, who are what are you?","OllamaModel"->"gemma2:27b"]

If you specify a model that does not exist or a model that you did not download locally, then an error is raised:

({{"[◼]", "OllamaSynthesize" }})["Hello, who are what are you?","OllamaModel"->"xxx"]

Possible Issues (3)

Repeated calls to OllamaSynthesize will give slightly randomized results and sometimes these results can be wildly incorrect:

({{"[◼]", "OllamaSynthesize" }})["Two train stations called A and B are 50 miles apart. A train leaves from A towoards B at 20mph. Another train leaves from B to A at 30 mph. How long after they leave do they pass each other?"]//Style[#,"Text"]&

You can use Solve to do this correctly. The result is given in hours:

Solve[Quantity[20,"Miles"/"Hours"]Quantity[x,"Hours"]==Quantity[50,"Miles"]-Quantity[30,"Miles"/"Hours"]Quantity[x,"Hours"],x]

You are responsible for installing Ollama on your machine and for the downloading of the models you wish to use. To list the available models, you can run the following (undocumented) command:

ollamaModels[]