Skip to content

ClaudeProvider

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/packages/doc-automation/src/v2/providers/claude.provider.ts

Implements: AIProvider

Methods

MethodSignatureReturns
generategenerate(prompt: string, options: ClaudeGenerateOptions, stage: JobStage)Promise<ClaudeResponse>
generateWithStreaminggenerateWithStreaming(prompt: string, options: ClaudeGenerateOptions, stage: JobStage)Promise<ClaudeResponse>
generateTextgenerateText(prompt: string, options: Omit<ClaudeGenerateOptions, 'messages'>, stage: JobStage)Promise<string>
generateJSONgenerateJSON(prompt: string, options: ClaudeGenerateOptions, stage: JobStage)Promise<{ data: T; response: ClaudeResponse }>
generateWithStructuredOutput`generateWithStructuredOutput(options: {
prompt: string;
schema: object;
model?: string;
maxTokens?: number;

})|Promise<{ content: T; usage: { inputTokens: number; outputTokens: number } }>| |isAvailable|isAvailable()|Promise| |getThrottlingStatus|getThrottlingStatus()|{ consecutiveFailures: number; adaptiveDelayMs: number; lastFailureTime: number }` |

Properties

PropertyType
nameany

Where it refuses work

  • ClaudeProvider stops the work with Error when !config.azureEndpoint && !config.anthropicApiKey — “Claude provider requires either azureEndpoint or anthropicApiKey”.
  • ClaudeProvider stops the work with Error when config.azureEndpoint && !config.azureApiKey && !config.azureAccessToken — “Azure Claude requires either azureApiKey or azureAccessToken”.
  • ClaudeProvider stops the work with an early return when error instanceof AIProviderError.

When something fails

  • ClaudeProvider handles failure in 6 places: it logs it and continues in 3, lets it reach the caller in 2, and turns it into a return value in 1.

Was this page helpful?

Download as PDF