承接 aisdk/voyageai 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aisdk/voyageai

Composer 安装命令:

composer require aisdk/voyageai

包简介

Official Voyage AI provider for the PHP AI SDK.

README 文档

README

Official Voyage AI provider for the PHP AI SDK.

Installation

composer require aisdk/voyageai

Text Embeddings

use AiSdk\Generate;
use AiSdk\VoyageAI;

$result = Generate::embedding([
        'First document',
        'Second document',
    ])
    ->model(VoyageAI::embedding('voyage-4-large'))
    ->dimensions(512)
    ->providerOptions('voyageai', [
        'input_type' => 'document',
    ])
    ->run();

$vector = $result->output->vector;
$vectors = $result->embeddings;

The v0.5 API covers Voyage's text embeddings endpoint. Multimodal, contextualized chunk embeddings, and reranking use different API contracts and are not part of this package surface yet.

Configuration

Variable Description Default
VOYAGE_API_KEY API key for authentication Required
VOYAGE_BASE_URL Base URL for API requests https://api.voyageai.com/v1
VoyageAI::create([
    'apiKey' => 'pa-...',
    'baseUrl' => 'https://api.voyageai.com/v1',
    'headers' => ['X-Custom-Header' => 'value'],
]);

Provider-Specific Options

Voyage's documented text embedding fields pass through unchanged:

$result = Generate::embedding('A search query')
    ->model(VoyageAI::embedding('voyage-4-large'))
    ->providerOptions('voyageai', [
        'input_type' => 'query',
        'truncation' => true,
        'output_dtype' => 'float',
    ])
    ->run();

dimensions() maps to Voyage's output_dimension field. Model IDs pass through unchanged so Voyage's API remains the source of truth for model availability and supported dimensions.

The portable SDK result is a float vector, so v0.5 accepts Voyage's output_dtype: float only and rejects base64 encoding. Quantized and bit-packed output need a separate result contract rather than being mislabeled as ordinary float dimensions.

Testing

composer test

Links

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固