// @doctest id="0e38"<?phpuse Cognesy\Polyglot\Inference\Inference;use Cognesy\Polyglot\Inference\Enums\OutputMode;$inference = new Inference();// OutputMode::Text is the default, so you don't need to specify it$response = $inference ->with( messages: 'What is the capital of France?', mode: OutputMode::Text // Optional, this is the default ) ->get();echo "Response: $response\n";// Output: Response: The capital of France is Paris.
Text mode works consistently across all providers, making it the most portable option:
Copy
// @doctest id="a5fe"<?phpuse Cognesy\Polyglot\Inference\Inference;$inference = new Inference();// Using OpenAI$openAIResponse = $inference ->using('openai') ->withMessages('Write a short poem about the ocean.') ->get();echo "OpenAI response:\n$openAIResponse\n\n";// Using Anthropic$anthropicResponse = $inference ->using('anthropic') ->with('Write a short poem about the ocean.') ->get();echo "Anthropic response:\n$anthropicResponse\n\n";// Using any other provider// ...