/** * Anthropic client types. */ import type { BaseIntegrationClient } from "../../types.js"; import type { SupportsApiRequest } from "../base/index.js"; /** * Anthropic client for Claude AI model interactions. * * Provides the generic apiRequest() method for any Anthropic API endpoint. * Use this to interact with Anthropic's messages API and other endpoints. * * @example * ```typescript * import { z } from 'zod'; * * // Declare in api(): integrations: { ai: anthropic(INTEGRATION_ID) } * // In run(), access via ctx.integrations.ai * * // Define request and response schemas * const CreateMessageRequestSchema = z.object({ * model: z.string(), * max_tokens: z.number(), * messages: z.array(z.object({ * role: z.string(), * content: z.string(), * })), * }); * * const MessageSchema = z.object({ * id: z.string(), * type: z.literal('message'), * content: z.array(z.object({ * type: z.string(), * text: z.string(), * })), * }); * * // Create a message * const message = await ctx.integrations.ai.apiRequest( * { * method: 'POST', * path: '/v1/messages', * body: { * model: 'claude-3-5-sonnet-20241022', * max_tokens: 1024, * messages: [{ role: 'user', content: 'Hello!' }], * }, * }, * { * body: CreateMessageRequestSchema, * response: MessageSchema, * } * ); * * ``` */ export interface AnthropicClient extends BaseIntegrationClient, SupportsApiRequest { // apiRequest() method inherited from SupportsApiRequest }