Connection
Base URL, credentials and a reachable server.
Use fenced_blocks.py to separate recognized fence markers from ordinary text, keeping the extracted body inert.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
import re
def fenced_blocks(text):
if type(text) is not str or len(text) > 4096:
raise ValueError("fence.input")
blocks, body, language = [], None, None
for line in text.splitlines():
if body is None:
opening = re.fullmatch(r"```([A-Za-z0-9_-]*)", line)
if opening:
body, language = [], opening[1]
elif line == "```":
blocks.append((language, "\n".join(body)))
body = None
else:
body.append(line)
if body is not None:
raise ValueError("fence.unclosed")
return blocks