Anthropic
Configuration
php
'anthropic' => [
'api_key' => env('ANTHROPIC_API_KEY', ''),
'version' => env('ANTHROPIC_API_VERSION', '2023-06-01'),
]
Considerations
Message Order
- Message order matters. Anthropic is strict about the message order being:
UserMessage
AssistantMessage
UserMessage
Structured Output
While Anthropic models don't have native JSON mode or structured output like some providers, Prism implements a robust workaround for structured output:
- We automatically append instructions to your prompt that guide the model to output valid JSON matching your schema
- If the response isn't valid JSON, Prism will raise a PrismException
Limitations
Messages
Does not support the SystemMessage
message type, we automatically convert SystemMessage
to UserMessage
.
Images
Does not support Image::fromURL