$client->generateEmbedding(...) 或 $client->createEmbedding(...)
示例
关键参数
model(必填):嵌入模型 ID(例如openai/text-embedding-3-large)。input(必填):字符串或字符串数组。encoding_format:float(默认)或base64。dimensions:用于截短嵌入长度的可选整数(取决于模型)。user:可选的终端用户标记。
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
使用 PHP SDK 调用 /embeddings。
$client->generateEmbedding(...) 或 $client->createEmbedding(...)
<?php
require 'vendor/autoload.php';
use Phaseo\Sdk\Phaseo;
$client = new Phaseo(getenv('PHASEO_API_KEY'));
$response = $client->generateEmbedding([
'model' => 'openai/text-embedding-3-large',
'input' => 'Sample text',
]);
echo $response['data'][0]['embedding'][0] ?? '';
model(必填):嵌入模型 ID(例如 openai/text-embedding-3-large)。input(必填):字符串或字符串数组。encoding_format:float(默认)或 base64。dimensions:用于截短嵌入长度的可选整数(取决于模型)。user:可选的终端用户标记。