Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ See full documentation on [https://async-aws.com](https://async-aws.com).
| [async-aws/core](https://github.com/async-aws/core) | [![Latest Stable Version](https://poser.pugx.org/async-aws/core/v/stable)](https://packagist.org/packages/async-aws/core) [![Total Downloads](https://poser.pugx.org/async-aws/core/downloads)](https://packagist.org/packages/async-aws/core) | [![BC Check](https://github.com/async-aws/core/actions/workflows/checks.yml/badge.svg?branch=master)](https://github.com/async-aws/core/actions/workflows/checks.yml) | [![](https://async-aws-pr.github.io/commits-since-release-counter/core.svg)](https://github.com/async-aws/core/releases) |
| [async-aws/app-sync](https://github.com/async-aws/app-sync) | [![Latest Stable Version](https://poser.pugx.org/async-aws/app-sync/v/stable)](https://packagist.org/packages/async-aws/app-sync) [![Total Downloads](https://poser.pugx.org/async-aws/app-sync/downloads)](https://packagist.org/packages/async-aws/app-sync) | [![BC Check](https://github.com/async-aws/app-sync/actions/workflows/checks.yml/badge.svg?branch=master)](https://github.com/async-aws/app-sync/actions/workflows/checks.yml) | [![](https://async-aws-pr.github.io/commits-since-release-counter/app-sync.svg)](https://github.com/async-aws/app-sync/releases) |
| [async-aws/athena](https://github.com/async-aws/athena) | [![Latest Stable Version](https://poser.pugx.org/async-aws/athena/v/stable)](https://packagist.org/packages/async-aws/athena) [![Total Downloads](https://poser.pugx.org/async-aws/athena/downloads)](https://packagist.org/packages/async-aws/athena) | [![BC Check](https://github.com/async-aws/athena/actions/workflows/checks.yml/badge.svg?branch=master)](https://github.com/async-aws/athena/actions/workflows/checks.yml) | [![](https://async-aws-pr.github.io/commits-since-release-counter/athena.svg)](https://github.com/async-aws/athena/releases) |
| [async-aws/bedrock-agent](https://github.com/async-aws/bedrock-agent) | [![Latest Stable Version](https://poser.pugx.org/async-aws/bedrock-agent/v/stable)](https://packagist.org/packages/async-aws/bedrock-agent) [![Total Downloads](https://poser.pugx.org/async-aws/bedrock-agent/downloads)](https://packagist.org/packages/async-aws/bedrock-agent) | [![BC Check](https://github.com/async-aws/bedrock-agent/actions/workflows/checks.yml/badge.svg?branch=master)](https://github.com/async-aws/bedrock-agent/actions/workflows/checks.yml) | [![](https://async-aws-pr.github.io/commits-since-release-counter/bedrock-agent.svg)](https://github.com/async-aws/bedrock-agent/releases) |
| [async-aws/bedrock-runtime](https://github.com/async-aws/bedrock-runtime) | [![Latest Stable Version](https://poser.pugx.org/async-aws/bedrock-runtime/v/stable)](https://packagist.org/packages/async-aws/bedrock-runtime) [![Total Downloads](https://poser.pugx.org/async-aws/bedrock-runtime/downloads)](https://packagist.org/packages/async-aws/bedrock-runtime) | [![BC Check](https://github.com/async-aws/bedrock-runtime/actions/workflows/checks.yml/badge.svg?branch=master)](https://github.com/async-aws/bedrock-runtime/actions/workflows/checks.yml) | [![](https://async-aws-pr.github.io/commits-since-release-counter/bedrock-runtime.svg)](https://github.com/async-aws/bedrock-runtime/releases) |
| [async-aws/cloud-formation](https://github.com/async-aws/cloud-formation) | [![Latest Stable Version](https://poser.pugx.org/async-aws/cloud-formation/v/stable)](https://packagist.org/packages/async-aws/cloud-formation) [![Total Downloads](https://poser.pugx.org/async-aws/cloud-formation/downloads)](https://packagist.org/packages/async-aws/cloud-formation) | [![BC Check](https://github.com/async-aws/cloud-formation/actions/workflows/checks.yml/badge.svg?branch=master)](https://github.com/async-aws/cloud-formation/actions/workflows/checks.yml) | [![](https://async-aws-pr.github.io/commits-since-release-counter/cloud-formation.svg)](https://github.com/async-aws/cloud-formation/releases) |
| [async-aws/cloud-front](https://github.com/async-aws/cloud-front) | [![Latest Stable Version](https://poser.pugx.org/async-aws/cloud-front/v/stable)](https://packagist.org/packages/async-aws/cloud-front) [![Total Downloads](https://poser.pugx.org/async-aws/cloud-front/downloads)](https://packagist.org/packages/async-aws/cloud-front) | [![BC Check](https://github.com/async-aws/cloud-front/actions/workflows/checks.yml/badge.svg?branch=master)](https://github.com/async-aws/cloud-front/actions/workflows/checks.yml) | [![](https://async-aws-pr.github.io/commits-since-release-counter/cloud-front.svg)](https://github.com/async-aws/cloud-front/releases) |
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"psr-4": {
"AsyncAws\\AppSync\\": "src/Service/AppSync/src",
"AsyncAws\\Athena\\": "src/Service/Athena/src",
"AsyncAws\\BedrockAgent\\": "src/Service/BedrockAgent/src",
"AsyncAws\\BedrockRuntime\\": "src/Service/BedrockRuntime/src",
"AsyncAws\\CloudFormation\\": "src/Service/CloudFormation/src",
"AsyncAws\\CloudFront\\": "src/Service/CloudFront/src",
Expand Down Expand Up @@ -106,6 +107,7 @@
"psr-4": {
"AsyncAws\\AppSync\\Tests\\": "src/Service/AppSync/tests",
"AsyncAws\\Athena\\Tests\\": "src/Service/Athena/tests",
"AsyncAws\\BedrockAgent\\Tests\\": "src/Service/BedrockAgent/tests",
"AsyncAws\\BedrockRuntime\\Tests\\": "src/Service/BedrockRuntime/tests",
"AsyncAws\\CloudFormation\\Tests\\": "src/Service/CloudFormation/tests",
"AsyncAws\\CloudFront\\Tests\\": "src/Service/CloudFront/tests",
Expand Down
3 changes: 3 additions & 0 deletions couscous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ menu:
athena:
text: Athena
url: /clients/athena.html
bedrock-agent:
text: Bedrock Agent
url: /clients/bedrock-agent.html
bedrock-runtime:
text: Bedrock Runtime
url: /clients/bedrock-runtime.html
Expand Down
142 changes: 142 additions & 0 deletions docs/clients/bedrock-agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
---
layout: client
category: clients
name: BedrockAgent
package: async-aws/bedrock-agent
---

## Usage

### Delete knowledge base documents

```php
use AsyncAws\BedrockAgent\BedrockAgentClient;
use AsyncAws\BedrockAgent\Enum\ContentDataSourceType;
use AsyncAws\BedrockAgent\Input\DeleteKnowledgeBaseDocumentsRequest;
use AsyncAws\BedrockAgent\ValueObject\DocumentIdentifier;
use AsyncAws\BedrockAgent\ValueObject\S3Location;

$bedrockAgent = new BedrockAgentClient();

$request = new DeleteKnowledgeBaseDocumentsRequest([
'knowledgeBaseId' => 'kb-1234567890abcdef',
'dataSourceId' => 'ds-abcdef1234567890',
'clientToken' => 'token-1234',
'documentIdentifiers' => [new DocumentIdentifier([
'dataSourceType' => ContentDataSourceType::S3,
's3' => new S3Location([
'uri' => 's3://my-bucket/documents/',
]),
])],
]);

$result = $bedrockAgent->deleteKnowledgeBaseDocuments($request);

foreach ($result->getDocumentDetails() as $documentDetail) {
echo $documentDetail->getStatus() . PHP_EOL;
}

```
See [`DeleteKnowledgeBaseDocuments`](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_DeleteKnowledgeBaseDocuments.html) for more information.

### Get knowledge base documents

```php
use AsyncAws\BedrockAgent\BedrockAgentClient;
use AsyncAws\BedrockAgent\Enum\ContentDataSourceType;
use AsyncAws\BedrockAgent\Input\GetKnowledgeBaseDocumentsRequest;
use AsyncAws\BedrockAgent\ValueObject\DocumentIdentifier;
use AsyncAws\BedrockAgent\ValueObject\S3Location;

$bedrockAgent = new BedrockAgentClient();

$request = new GetKnowledgeBaseDocumentsRequest([
'knowledgeBaseId' => 'kb-1234567890abcdef',
'dataSourceId' => 'ds-abcdef1234567890',
'documentIdentifiers' => [new DocumentIdentifier([
'dataSourceType' => ContentDataSourceType::S3,
's3' => new S3Location([
'uri' => 's3://my-bucket/documents/',
]),
])],
]);

$result = $bedrockAgent->getKnowledgeBaseDocuments($request);

foreach ($result->getDocumentDetails() as $documentDetail) {
echo $documentDetail->getIdentifier()->getS3()->getUri() . PHP_EOL;
}

```
See [`GetKnowledgeBaseDocuments`](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_GetKnowledgeBaseDocuments.html) for more information.

### Ingest knowledge base documents

```php
use AsyncAws\BedrockAgent\Enum\ContentDataSourceType;
use AsyncAws\BedrockAgent\Enum\MetadataSourceType;
use AsyncAws\BedrockAgent\Input\IngestKnowledgeBaseDocumentsRequest;
use AsyncAws\BedrockAgent\ValueObject\CustomS3Location;
use AsyncAws\BedrockAgent\ValueObject\DocumentContent;
use AsyncAws\BedrockAgent\ValueObject\DocumentMetadata;
use AsyncAws\BedrockAgent\ValueObject\KnowledgeBaseDocument;
use AsyncAws\BedrockAgent\ValueObject\S3Content;
use AsyncAws\BedrockAgent\ValueObject\S3Location;

$bedrockAgent = new BedrockAgentClient();

$request = new IngestKnowledgeBaseDocumentsRequest([
'knowledgeBaseId' => 'kb-1234567890abcdef',
'dataSourceId' => 'ds-abcdef1234567890',
'clientToken' => 'token-1234',
'documents' => [new KnowledgeBaseDocument([
'metadata' => new DocumentMetadata([
'type' => MetadataSourceType::S3_LOCATION,
's3Location' => new CustomS3Location([
'uri' => 's3://my-bucket/documents/',
'bucketOwnerAccountId' => 'account-1234',
]),
]),
'content' => new DocumentContent([
'dataSourceType' => ContentDataSourceType::S3,
's3' => new S3Content([
's3Location' => new S3Location([
'uri' => 's3://my-bucket/documents/',
]),
]),
]),
])],
]);

$result = $bedrockAgent->ingestKnowledgeBaseDocuments($request);

foreach ($result->getDocumentDetails() as $documentDetail) {
echo $documentDetail->getStatus() . PHP_EOL;
echo $documentDetail->getIdentifier()->getS3()->getUri() . PHP_EOL;
}

```
See [`IngestKnowledgeBaseDocuments`](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_IngestKnowledgeBaseDocuments.html) for more information.

### List knowledge base documents

```php
use AsyncAws\BedrockAgent\BedrockAgentClient;
use AsyncAws\BedrockAgent\Input\ListKnowledgeBaseDocumentsRequest;

$bedrockAgent = new BedrockAgentClient();

$request = new ListKnowledgeBaseDocumentsRequest([
'knowledgeBaseId' => 'kb-1234567890abcdef',
'dataSourceId' => 'ds-abcdef1234567890',
'maxResults' => 50,
]);

$result = $bedrockAgent->listKnowledgeBaseDocuments($request);

foreach ($result->getDocumentDetails() as $documentDetail) {
echo $documentDetail->getIdentifier()->getS3()->getUri() . PHP_EOL;
}

```
See [`ListKnowledgeBaseDocuments`](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_ListKnowledgeBaseDocuments.html) for more information.
3 changes: 2 additions & 1 deletion docs/clients/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ for more information.
|---------------------------------------------|-----------------------------------------------------------------------------------------------------------|
| [AppSync](./app-sync.md) | [async-aws/app-sync](https://packagist.org/packages/async-aws/app-sync) |
| [Athena](./athena.md) | [async-aws/athena](https://packagist.org/packages/async-aws/athena) |
| [BedrockRuntime](./bedrock-runtime.md) | [async-aws/bedrock-runtime](https://packagist.org/packages/async-aws/bedrock-runtime) |
| [BedrockAgent](./bedrock-agent.md) | [async-aws/bedrock-agent](https://packagist.org/packages/async-aws/bedrock-agent) |
| [BedrockRuntime](./bedrock-runtime.md) | [async-aws/bedrock-runtime](https://packagist.org/packages/async-aws/bedrock-runtime) |
| [CloudFormation](./cf.md) | [async-aws/cloud-formation](https://packagist.org/packages/async-aws/cloud-formation) |
| [CloudFront](./cloud-front.md) | [async-aws/cloud-front](https://packagist.org/packages/async-aws/cloud-front) |
| [CloudWatch](./cloud-watch.md) | [async-aws/cloud-watch](https://packagist.org/packages/async-aws/cloud-watch) |
Expand Down
14 changes: 14 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@
]
}
},
"BedrockAgent": {
"source": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/bedrock-agent/2023-06-05/api-2.json",
"documentation": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/bedrock-agent/2023-06-05/docs-2.json",
"pagination": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/bedrock-agent/2023-06-05/paginators-1.json",
"waiter": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/bedrock-agent/2023-06-05/waiters-2.json",
"example": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/bedrock-agent/2023-06-05/examples-1.json",
"api-reference": "https://docs.aws.amazon.com/bedrock/latest/APIReference",
"methods": [
"DeleteKnowledgeBaseDocuments",
"GetKnowledgeBaseDocuments",
"IngestKnowledgeBaseDocuments",
"ListKnowledgeBaseDocuments"
]
},
"BedrockRuntime": {
"source": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/bedrock-runtime/2023-09-30/api-2.json",
"documentation": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/bedrock-runtime/2023-09-30/docs-2.json",
Expand Down
1 change: 1 addition & 0 deletions src/Core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- AWS api-change: Added `us-isob-west-1` region
- Added `DescribeLogGroups` method
- Support for BedrockAgent

### Dependency bumped

Expand Down
14 changes: 14 additions & 0 deletions src/Core/src/AwsClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use AsyncAws\AppSync\AppSyncClient;
use AsyncAws\Athena\AthenaClient;
use AsyncAws\BedrockAgent\BedrockAgentClient;
use AsyncAws\BedrockRuntime\BedrockRuntimeClient;
use AsyncAws\CloudFormation\CloudFormationClient;
use AsyncAws\CloudFront\CloudFrontClient;
Expand Down Expand Up @@ -119,6 +120,19 @@ public function appSync(): AppSyncClient
return $this->serviceCache[__METHOD__];
}

public function bedrockAgent(): BedrockAgentClient
{
if (!class_exists(BedrockAgentClient::class)) {
throw MissingDependency::create('async-aws/bedrock-agent', 'BedrockAgent');
}

if (!isset($this->serviceCache[__METHOD__])) {
$this->serviceCache[__METHOD__] = new BedrockAgentClient($this->configuration, $this->credentialProvider, $this->httpClient, $this->logger);
}

return $this->serviceCache[__METHOD__];
}

public function bedrockRuntime(): BedrockRuntimeClient
{
if (!class_exists(BedrockRuntimeClient::class)) {
Expand Down
4 changes: 4 additions & 0 deletions src/Integration/Symfony/Bundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## NOT RELEASED

### Added

- Support for BedrockAgent

### Dependency bumped

- Drop support for PHP versions lower than 8.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static function getAllServices(): array
'class' => \AsyncAws\Athena\AthenaClient::class,
'package' => 'async-aws/athena',
],
'bedrock_agent' => [
'class' => \AsyncAws\BedrockAgent\BedrockAgentClient::class,
'package' => 'async-aws/bedrock-agent',
],
'bedrock_runtime' => [
'class' => \AsyncAws\BedrockRuntime\BedrockRuntimeClient::class,
'package' => 'async-aws/bedrock-runtime',
Expand Down
5 changes: 5 additions & 0 deletions src/Service/BedrockAgent/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.github export-ignore
/tests export-ignore
/.gitignore export-ignore
/Makefile export-ignore
/phpunit.xml.dist export-ignore
3 changes: 3 additions & 0 deletions src/Service/BedrockAgent/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [nyholm, jderusse]
2 changes: 2 additions & 0 deletions src/Service/BedrockAgent/.github/workflows/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.yml]
indent_size = 2
38 changes: 38 additions & 0 deletions src/Service/BedrockAgent/.github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: BC Check

on:
push:
branches:
- master

jobs:
roave-bc-check:
name: Roave BC Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Modify composer.json
run: |
sed -i -re 's/"require": \{/"minimum-stability": "dev","prefer-stable": true,"require": \{/' composer.json
cat composer.json

git config --local user.email "github@async-aws.com"
git config --local user.name "AsyncAws Bot"
git commit -am "Allow unstable dependencies"

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer:v2

- name: Install roave/backward-compatibility-check
run: composer require --dev roave/backward-compatibility-check

- name: Roave BC Check
run: vendor/bin/roave-backward-compatibility-check
37 changes: 37 additions & 0 deletions src/Service/BedrockAgent/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests

on:
push:
branches:
- master

jobs:

build:
name: Build
runs-on: ubuntu-latest
strategy:
max-parallel: 10
matrix:
php: ['8.2', '8.3', '8.4', '8.5']

steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Checkout code
uses: actions/checkout@v5

- name: Initialize tests
run: make initialize

- name: Download dependencies
run: |
composer config minimum-stability dev
composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable

- name: Run tests
run: ./vendor/bin/phpunit
3 changes: 3 additions & 0 deletions src/Service/BedrockAgent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor/
*.cache
composer.lock
7 changes: 7 additions & 0 deletions src/Service/BedrockAgent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Change Log

## NOT RELEASED

## 1.0.0

First version
21 changes: 21 additions & 0 deletions src/Service/BedrockAgent/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2022 Jérémy Derussé, Tobias Nyholm

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading