text() method with the Vertex provider constants.
Basic usage
Generate a text response using thePrism::text() method with a Vertex provider constant:
using() method accepts two parameters:
- Provider constant - One of the
Vertex::*constants (e.g.,Vertex::Gemini,Vertex::Anthropic) - Model string - The specific model identifier
Supported providers
Prism Vertex supports multiple AI providers through a single configuration:Available provider constants
All provider constants are available in thePrism\Vertex\Enums\Vertex class:
| Constant | Publisher | Example Models |
|---|---|---|
Vertex::Gemini | gemini-2.5-flash, gemini-pro | |
Vertex::Anthropic | anthropic | claude-3-5-sonnet@20241022, claude-3-5-haiku@20241022 |
Vertex::Mistral | mistralai | mistral-small-2503, codestral-2501 |
Vertex::Meta | meta | llama-4-scout-17b-16e-instruct-maas |
Vertex::DeepSeek | deepseek | deepseek-v3-0324-maas |
Vertex::AI21 | ai21 | jamba-1.5-mini@001, jamba-1.5-large@001 |
Vertex::Kimi | kimi | kimi-k2-0711-maas |
Vertex::MiniMax | minimax | minimax-m1-40k-0709-maas |
Vertex::OpenAI | openai | gpt-oss-4o-mini-maas |
Vertex::Qwen | qwen | qwen2.5-72b-instruct-maas |
Vertex::ZAI | zaiorg | glm-4-plus-maas |
Response object
TheasText() method returns a Prism\Prism\Text\Response object with the following properties:
API schema selection
Prism Vertex automatically selects the correct API schema based on the provider constant and model string. Three schemas are supported:The schema is selected automatically - you don’t need to specify it unless you want to override the default behavior.
Gemini schema
Used for Google Gemini models. Uses the nativegenerateContent endpoint.
Anthropic schema
Used for Anthropic Claude models. Uses the:rawPredict endpoint with Anthropic Messages API format.
OpenAI schema
Used for partner models (Mistral, Meta, DeepSeek, etc.). Uses:rawPredict or :chatCompletions with OpenAI-compatible format.
Overriding the API schema
You can override the automatically selected schema usingwithProviderOptions():
Express mode vs Standard mode
Prism Vertex supports two authentication modes:Express mode (API key only)
Whenproject_id and location are omitted, the package automatically uses Vertex AI Express Mode endpoints:
config/prism.php
Standard mode (project + location)
Standard mode supports all providers and authentication methods:config/prism.php
Error handling
The package handles Vertex AI errors and converts them to Prism exceptions:Next steps
Structured output
Generate JSON responses with schema validation
Embeddings
Create text embeddings for semantic search
Multi-provider
Use multiple providers with different configurations