Contents

OCRTool

A tool that recognizes text in an image.

Declaration

struct OCRTool

Overview

The tool returns a string containing all recognized text from the image. To enable this tool, configure your LanguageModelSession with an instance of OCRTool.

let ocrTool = OCRTool()
let session = LanguageModelSession(tools: [ocrTool])

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

let customTool = OCRTool(
    name: "extractText",
    description: "Extract text from documents"
)

Topics

Initializers