# @kozmoai/rag-ai-backend-embeddings-aws

> The AWS (Bedrock) backend module for the @kozmoai/rag-ai plugin.

Latest version **0.2.1** (published 2024-04-05) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @kozmoai/rag-ai-backend-embeddings-aws
pnpm add @kozmoai/rag-ai-backend-embeddings-aws
yarn add @kozmoai/rag-ai-backend-embeddings-aws
bun add @kozmoai/rag-ai-backend-embeddings-aws
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2024-04-05 |
| First published | 2024-03-25 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 24 KB |
| Known vulnerabilities | 0 (+6 in 3 direct dependencies) |
| Install scripts | no |
| Maintainers | kozmoai |

## Links

- npm: https://www.npmjs.com/package/@kozmoai/rag-ai-backend-embeddings-aws
- Repository: https://github.com/kozmoai/glint-backstage-plugins
- Homepage: https://github.com/kozmoai/glint-backstage-plugins#readme
- Issues: https://github.com/kozmoai/glint-backstage-plugins/issues
- npm.io page: https://npm.io/package/@kozmoai/rag-ai-backend-embeddings-aws

## Dependencies (12)

- [winston](https://npm.io/package/winston.md) ^3.11.0
- [langchain](https://npm.io/package/langchain.md) ^0.1.21
- [@aws-sdk/types](https://npm.io/package/@aws-sdk/types.md) ^3.468.0
- [@langchain/core](https://npm.io/package/@langchain/core.md) ^0.1.2
- [@backstage/config](https://npm.io/package/@backstage/config.md) ^1.2.0
- [@kozmoai/rag-ai-node](https://npm.io/package/@kozmoai/rag-ai-node.md) ^0.1.1
- [@langchain/community](https://npm.io/package/@langchain/community.md) ^0.0.32
- [@kozmoai/rag-ai-backend](https://npm.io/package/@kozmoai/rag-ai-backend.md) ^0.2.2
- [@backstage/backend-common](https://npm.io/package/@backstage/backend-common.md) ^0.21.6
- [@backstage/catalog-client](https://npm.io/package/@backstage/catalog-client.md) ^1.6.3
- [@aws-sdk/client-bedrock-runtime](https://npm.io/package/@aws-sdk/client-bedrock-runtime.md) ^3.474.0
- [@kozmoai/rag-ai-backend-retrieval-augmenter](https://npm.io/package/@kozmoai/rag-ai-backend-retrieval-augmenter.md) ^0.2.1

## Recent versions

- 0.2.1 (latest) — 2024-04-05
- 0.1.0 — 2024-03-25

## README

# RAG AI Backend-embeddings AWS Bedrock submodule

This is a submodule for the `@kozmoai/rag-ai-backend` module, which provides functionality to use AWS Bedrock embeddings to generate a RAG AI Backend plugin for Backstage. It integrates `@backstage/integration-aws-node` package for fetching AWS account credentials.

## Initialization

```typescript
const vectorStore = await createGlintPgVectorStore({ logger, database });
const awsCredentialsManager = DefaultAwsCredentialsManager.fromConfig(config);
const credProvider = await awsCredentialsManager.getCredentialProvider();

const augmentationIndexer = await initializeBedrockEmbeddings({
  logger,
  catalogApi,
  vectorStore,
  discovery,
  config,
  options: {
    credentials: credProvider.sdkCredentialProvider,
    region: 'eu-central-1',
  },
});
```

## Configuration Options

The module expects 2 pieces of configuration:

1. The configuration of the module to configure AWS Bedrock
2. AWS integration configuration for credentials provisioning

### AWS Bedrock configuration

The module expects the name of the embeddings generative AI model to be configured via app-config.

```yaml
ai:
  embeddings:
    awsBedrock:
      # Name of the Bedrock model to use to create Embeddings
      modelName: 'amazon.titan-embed-text-v1'
```

### AWS Credentials Configuration

The module depends on the `@backstage/integration-aws-node` package which helps fetch AWS account credentials for AWS SDK clients in backend packages and plugins. Users configure AWS account information and the credentials in their Backstage app configurations. This could include IAM user credentials, IAM roles, and profile names for their AWS accounts.

A full description of how to use and configure `@backstage/integration-aws-node` package can be found from the [package README](https://github.com/backstage/backstage/blob/master/packages/integration-aws-node/README.md).

Configuration examples:

```yaml
aws:
  mainAccount:
    accessKeyId: ${MY_ACCESS_KEY_ID}
    secretAccessKey: ${MY_SECRET_ACCESS_KEY}
  accounts:
    - accountId: '111111111111'
      roleName: 'my-iam-role-name'
      externalId: 'my-external-id'
    - accountId: '222222222222'
      partition: 'aws-other'
      roleName: 'my-iam-role-name'
      region: 'not-us-east-1'
      accessKeyId: ${MY_ACCESS_KEY_ID_FOR_ANOTHER_PARTITION}
      secretAccessKey: ${MY_SECRET_ACCESS_KEY_FOR_ANOTHER_PARTITION}
    - accountId: '333333333333'
      accessKeyId: ${MY_OTHER_ACCESS_KEY_ID}
      secretAccessKey: ${MY_OTHER_SECRET_ACCESS_KEY}
    - accountId: '444444444444'
      profile: my-profile-name
    - accountId: '555555555555'
  accountDefaults:
    roleName: 'my-backstage-role'
    externalId: 'my-id'
```

---
_Source: https://npm.io/package/@kozmoai/rag-ai-backend-embeddings-aws · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
