New Tool Radar

Local AI

How to Send a Multi-Line Prompt in an Ollama Chat Session

Wrap a long or structured prompt in triple quotes in an Ollama session and get a single answer back.

Schematic with three steps: Open the chat session; Wrap the block in triple quotes; Check the answer covers the whole block.

A single-line prompt is a poor fit for a pasted log, a configuration block, or multi-step instructions. Inside an Ollama chat session, triple quotes let you send the whole block as one prompt instead of forcing it onto one line.

What you need

  • Ollama installed with a model already pulled
  • A multi-line text to send, such as a log excerpt or a config block
  • A terminal running ollama run

Step 1: Open the chat session

Run ollama run with your model, for example ollama run llama3.2, and wait for the >>> prompt.

Step 2: Wrap the block in triple quotes

Type three double quotes on their own line, then paste or type the multi-line text, then close with three double quotes on their own line. The model treats everything between the quotes as a single prompt.

Step 3: Check the answer covers the whole block

Read the reply and confirm it refers to the parts of the block you pasted. If it only answers the first line, the closing quotes were missing and the block was sent in pieces.

Worked example: synthetic multi-line prompt

The table below is a synthetic example. It shows the expected result of sending a multi-line prompt; no chat was run.

Input Sent as Answer
Three-line config block One prompt in triple quotes Flags the problem line
Same block, one line at a time Three separate prompts Answers only the first line
Block with closing quotes One prompt Covers the whole block

Expected result (UNTESTED). the triple-quoted block arrives as one prompt and the answer refers to the whole block, while sending it line by line only answers the first line. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • The triple quotes must open and close on their own lines, or the block is sent in pieces.
  • Very long pastes can exceed the context window; shorten the block if the answer ignores its end.
  • Type /bye to exit the session, or Ctrl+D.

Sources

See all