aysnc/wordpress-php-ai-client-bedrock 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

aysnc/wordpress-php-ai-client-bedrock

最新稳定版本:0.1.0

Composer 安装命令:

composer require aysnc/wordpress-php-ai-client-bedrock

包简介

AWS Bedrock provider for the WordPress PHP AI Client SDK.

README 文档

README

GitHub Actions Maintenance

AWS Bedrock provider for the WordPress PHP AI Client SDK.

This package was originally contributed to the core PHP AI Client repository. The WordPress team is decoupling all providers into standalone packages ahead of WordPress 7.0 core integration, so this provider is maintained here as an independent Composer library.

Requirements

Installation

composer require aysnc/wordpress-php-ai-client-bedrock

Configuration

Set the following environment variables:

Variable Required Description
AWS_BEDROCK_API_KEY Yes Bearer token for Bedrock API authentication
AWS_BEDROCK_REGION No AWS region (defaults to AWS_DEFAULT_REGION, then us-east-1)
AWS_DEFAULT_REGION No Fallback AWS region

Usage

Register the Provider

use WordPress\AiClient\AiClient;
use Aysnc\WordPress\PhpAiClientBedrock\AwsBedrockProvider;

AiClient::defaultRegistry()->registerProvider( AwsBedrockProvider::class );

Generate Text

$text = AiClient::prompt( 'Explain quantum computing in simple terms.' )
    ->usingModel( AwsBedrockProvider::model( 'anthropic.claude-3-5-sonnet-20241022-v2:0' ) )
    ->usingMaxTokens( 1000 )
    ->generateText();

echo $text;

Full Result with Metadata

$result = AiClient::prompt( 'Explain quantum computing in simple terms.' )
    ->usingModel( AwsBedrockProvider::model( 'anthropic.claude-3-5-sonnet-20241022-v2:0' ) )
    ->usingMaxTokens( 1000 )
    ->generateTextResult();

echo $result->toText();
echo $result->getTokenUsage()->getTotalTokens();

With Configuration

$result = AiClient::prompt( 'Hello' )
    ->usingModel( AwsBedrockProvider::model( 'anthropic.claude-3-5-sonnet-20241022-v2:0' ) )
    ->usingSystemInstruction( 'You are a helpful assistant.' )
    ->usingMaxTokens( 1000 )
    ->usingTemperature( 0.7 )
    ->generateTextResult();

Custom Region

Set the AWS_BEDROCK_REGION environment variable, or fall back to AWS_DEFAULT_REGION:

export AWS_BEDROCK_REGION="eu-west-1"

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固