Contents

BarcodeReaderTool

A tool that scans machine-readable codes in an image.

Declaration

struct BarcodeReaderTool

Overview

When the model encounters an image containing machine-readable codes, it can call this tool to decode them. The tool returns an array of Barcode results, each containing the decoded content and the symbology type.

To enable this tool, configure your LanguageModelSession with an instance of BarcodeReaderTool.

let barcodeTool = BarcodeReaderTool()
let session = LanguageModelSession(tools: [barcodeTool])

You can override the default name and description to customize how the model identifies and uses the tool.

let customTool = BarcodeReaderTool(
    name: "scanQRCode",
    description: "Scan QR codes"
)

Topics

Initializers