chat_with_document
Ask grounded questions about documents and receive answers with citations; PII is redacted server-side to prevent leaks.
Instructions
Ask a grounded question about one or more documents. Returns an answer with citations into the document. PII in source documents has already been redacted server-side, so answers cannot leak redacted data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documentIds | Yes | One or more document IDs to ground the answer in. All must be READY. | |
| message | Yes | The user's question. Answers are grounded in retrieved chunks with page citations. | |
| sessionId | No | Optional existing chat session ID to continue a multi-turn conversation. |
Implementation Reference
- src/tools/chat_with_document.ts:16-22 (handler)The tool definition and handler for chat_with_document. The handler calls POST /v1/chat via the ActalumenClient.
export const chatWithDocument = defineTool({ name: "chat_with_document", description: "Ask a grounded question about one or more documents. Returns an answer with citations into the document. PII in source documents has already been redacted server-side, so answers cannot leak redacted data.", inputSchema: Input, handler: async (input, { client }) => client.post("/v1/chat", input), }); - src/tools/chat_with_document.ts:4-14 (schema)Input schema for chat_with_document: documentIds (array of strings, min 1), message (string), and optional sessionId (string).
const Input = z.object({ documentIds: z .array(z.string()) .min(1) .describe("One or more document IDs to ground the answer in. All must be READY."), message: z.string().min(1).describe("The user's question. Answers are grounded in retrieved chunks with page citations."), sessionId: z .string() .optional() .describe("Optional existing chat session ID to continue a multi-turn conversation."), }); - src/tools/index.ts:8-8 (registration)Import of the chatWithDocument tool from its module.
import { chatWithDocument } from "./chat_with_document.js"; - src/tools/index.ts:18-18 (registration)Registration of chatWithDocument in the tools array.
chatWithDocument,