Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public static final class ChatModel {
public static final String AZURE_SETUP =
"org.apache.flink.agents.integrations.chatmodels.azureai.AzureAIChatModelSetup";

// Bedrock
public static final String BEDROCK_CONNECTION =
"org.apache.flink.agents.integrations.chatmodels.bedrock.BedrockChatModelConnection";
public static final String BEDROCK_SETUP =
"org.apache.flink.agents.integrations.chatmodels.bedrock.BedrockChatModelSetup";

// Ollama
public static final String OLLAMA_CONNECTION =
"org.apache.flink.agents.integrations.chatmodels.ollama.OllamaChatModelConnection";
Expand Down Expand Up @@ -131,6 +137,12 @@ public static final class EmbeddingModel {
public static final String OLLAMA_SETUP =
"org.apache.flink.agents.integrations.embeddingmodels.ollama.OllamaEmbeddingModelSetup";

// Bedrock
public static final String BEDROCK_CONNECTION =
"org.apache.flink.agents.integrations.embeddingmodels.bedrock.BedrockEmbeddingModelConnection";
public static final String BEDROCK_SETUP =
"org.apache.flink.agents.integrations.embeddingmodels.bedrock.BedrockEmbeddingModelSetup";

// Python Wrapper
public static final String PYTHON_WRAPPER_CONNECTION =
"org.apache.flink.agents.api.embedding.model.python.PythonEmbeddingModelConnection";
Expand Down Expand Up @@ -171,6 +183,14 @@ public static final class VectorStore {
public static final String ELASTICSEARCH_VECTOR_STORE =
"org.apache.flink.agents.integrations.vectorstores.elasticsearch.ElasticsearchVectorStore";

// Amazon OpenSearch (Serverless or Service domains)
public static final String OPENSEARCH_VECTOR_STORE =
"org.apache.flink.agents.integrations.vectorstores.opensearch.OpenSearchVectorStore";

// Amazon S3 Vectors
public static final String S3_VECTORS_VECTOR_STORE =
"org.apache.flink.agents.integrations.vectorstores.s3vectors.S3VectorsVectorStore";

// Python Wrapper
public static final String PYTHON_WRAPPER_VECTOR_STORE =
"org.apache.flink.agents.api.vectorstores.python.PythonVectorStore";
Expand Down
97 changes: 97 additions & 0 deletions docs/content/docs/development/chat_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,103 @@ Some popular options include:
Model availability and specifications may change. Always check the official DashScope documentation for the latest information before implementing in production.
{{< /hint >}}

### Amazon Bedrock

Amazon Bedrock provides access to a wide range of foundation models from leading AI providers through a unified API. The Flink Agents Bedrock integration uses the [Converse API](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html), which provides a consistent interface across all supported models with native tool calling support. Authentication is handled via SigV4 using the AWS default credentials chain — no API keys required.

{{< hint info >}}
Amazon Bedrock is only supported in Java currently. To use Amazon Bedrock from Python agents, see [Using Cross-Language Providers](#using-cross-language-providers).
{{< /hint >}}

#### Prerequisites

1. An AWS account with [Amazon Bedrock model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) enabled for the models you plan to use
2. IAM credentials configured via any method supported by the [AWS Default Credentials Provider](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials-chain.html) (environment variables, `~/.aws/credentials`, IAM role, etc.)

#### BedrockChatModelConnection Parameters

{{< tabs "BedrockChatModelConnection Parameters" >}}

{{< tab "Java" >}}

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `region` | String | `"us-east-1"` | AWS region for the Bedrock service |
| `model` | String | None | Default model ID (can be overridden per setup) |
| `max_retries` | int | `5` | Maximum number of API retry attempts (retries on throttling, 429, 503) |

{{< /tab >}}

{{< /tabs >}}

#### BedrockChatModelSetup Parameters

{{< tabs "BedrockChatModelSetup Parameters" >}}

{{< tab "Java" >}}

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `connection` | String | Required | Reference to connection method name |
| `model` | String | Required | Bedrock model ID (e.g. `"us.anthropic.claude-sonnet-4-20250514-v1:0"`) |
| `prompt` | Prompt \| String | None | Prompt template or reference to prompt resource |
| `tools` | List<String> | None | List of tool names available to the model |
| `temperature` | double | `0.1` | Sampling temperature (0.0 to 1.0) |
| `max_tokens` | int | None | Maximum number of tokens to generate |

{{< /tab >}}

{{< /tabs >}}

#### Usage Example

{{< tabs "Amazon Bedrock Usage Example" >}}

{{< tab "Java" >}}
```java
public class MyAgent extends Agent {
@ChatModelConnection
public static ResourceDescriptor bedrockConnection() {
return ResourceDescriptor.Builder.newBuilder(ResourceName.ChatModel.BEDROCK_CONNECTION)
.addInitialArgument("region", "us-east-1")
.build();
}

@ChatModelSetup
public static ResourceDescriptor bedrockChatModel() {
return ResourceDescriptor.Builder.newBuilder(ResourceName.ChatModel.BEDROCK_SETUP)
.addInitialArgument("connection", "bedrockConnection")
.addInitialArgument("model", "us.anthropic.claude-sonnet-4-20250514-v1:0")
.addInitialArgument("temperature", 0.1d)
.addInitialArgument("max_tokens", 4096)
.build();
}

...
}
```
{{< /tab >}}

{{< /tabs >}}

#### Available Models

Amazon Bedrock supports models from multiple providers through a single API. Visit the [Amazon Bedrock Model IDs documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html) for the complete and up-to-date list of available models.

Some popular options include:
- **Claude** (Anthropic): `us.anthropic.claude-sonnet-4-6`, `us.anthropic.claude-opus-4-7`, `us.anthropic.claude-opus-4-6-v1`
- **Llama** (Meta): `us.meta.llama4-scout-17b-16e-instruct-v1:0`
- **Mistral**: `mistral.mistral-large-2402-v1:0`
- **Amazon Nova**: `us.amazon.nova-pro-v1:0`, `us.amazon.nova-lite-v1:0`

{{< hint warning >}}
Model availability varies by AWS region and requires explicit model access enablement in the Bedrock console. Always check the [Amazon Bedrock documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html) for regional availability before implementing in production.
{{< /hint >}}

{{< hint warning >}}
**Current limitations:** The integration uses text content blocks only. Extended thinking / reasoning content blocks (e.g. Claude extended thinking), citation blocks, and image / document content blocks are not yet supported.
{{< /hint >}}

## Using Cross-Language Providers

Flink Agents supports cross-language chat model integration, allowing you to use chat models implemented in one language (Java or Python) from agents written in the other language. This is particularly useful when a chat model provider is only available in one language (e.g., Tongyi is currently Python-only).
Expand Down
93 changes: 93 additions & 0 deletions docs/content/docs/development/embedding_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,99 @@ Some popular options include:
Model availability and specifications may change. Always check the official DashScope documentation for the latest information before implementing in production.
{{< /hint >}}

### Amazon Bedrock

Amazon Bedrock provides embedding capabilities through the Amazon Titan Text Embeddings V2 model via the [InvokeModel API](https://docs.aws.amazon.com/bedrock/latest/userguide/titan-embedding-models.html). The integration supports configurable output dimensions (256, 512, or 1024) and parallelizes batch embedding via a configurable thread pool, since the Titan V2 model processes one text per API call. Authentication is handled via SigV4 using the AWS default credentials chain.

{{< hint info >}}
Amazon Bedrock embedding models are only supported in Java currently. To use Amazon Bedrock embeddings from Python agents, see [Using Cross-Language Providers](#using-cross-language-providers).
{{< /hint >}}

#### Prerequisites

1. An AWS account with [Amazon Bedrock model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) enabled for Amazon Titan Text Embeddings V2
2. IAM credentials configured via any method supported by the [AWS Default Credentials Provider](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials-chain.html)

#### BedrockEmbeddingModelConnection Parameters

{{< tabs "BedrockEmbeddingModelConnection Parameters" >}}

{{< tab "Java" >}}

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `region` | String | `"us-east-1"` | AWS region for the Bedrock service |
| `model` | String | `"amazon.titan-embed-text-v2:0"` | Default embedding model ID |
| `embed_concurrency` | int | `4` | Thread pool size for parallel batch embedding |
| `max_retries` | int | `5` | Maximum number of API retry attempts (retries on throttling, 429, 503) |

{{< /tab >}}

{{< /tabs >}}

#### BedrockEmbeddingModelSetup Parameters

{{< tabs "BedrockEmbeddingModelSetup Parameters" >}}

{{< tab "Java" >}}

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `connection` | String | Required | Reference to connection method name |
| `model` | String | None | Override the default embedding model from the connection |
| `dimensions` | int | None | Output embedding dimensions: 256, 512, or 1024 |

{{< /tab >}}

{{< /tabs >}}

#### Usage Example

{{< tabs "Amazon Bedrock Embedding Usage Example" >}}

{{< tab "Java" >}}
```java
public class MyAgent extends Agent {

@EmbeddingModelConnection
public static ResourceDescriptor bedrockEmbeddingConnection() {
return ResourceDescriptor.Builder.newBuilder(ResourceName.EmbeddingModel.BEDROCK_CONNECTION)
.addInitialArgument("region", "us-east-1")
.addInitialArgument("embed_concurrency", 8)
.build();
}

@EmbeddingModelSetup
public static ResourceDescriptor bedrockEmbedding() {
return ResourceDescriptor.Builder.newBuilder(ResourceName.EmbeddingModel.BEDROCK_SETUP)
.addInitialArgument("connection", "bedrockEmbeddingConnection")
.addInitialArgument("model", "amazon.titan-embed-text-v2:0")
.addInitialArgument("dimensions", 1024)
.build();
}

...
}
```
{{< /tab >}}

{{< /tabs >}}

#### Available Models

The Bedrock embedding integration currently supports:
- **Amazon Titan Text Embeddings V2** (`amazon.titan-embed-text-v2:0`) — supports 256, 512, or 1024 dimensions

{{< hint info >}}
The integration always requests **normalized** embeddings (unit vectors), which makes cosine similarity equivalent to dot product. If you need raw, un-normalized vectors, use a custom provider.
{{< /hint >}}

Visit the [Amazon Bedrock Embedding Models documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/titan-embedding-models.html) for the latest information.

{{< hint warning >}}
Model availability varies by AWS region and requires explicit model access enablement in the Bedrock console. Always check the [Amazon Bedrock documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html) for regional availability before implementing in production.
{{< /hint >}}

## Using Cross-Language Providers

Flink Agents supports cross-language embedding model integration, allowing you to use embedding models implemented in one language (Java or Python) from agents written in the other language. This is particularly useful when an embedding model provider is only available in one language (e.g., OpenAI embedding is currently Python-only).
Expand Down
Loading
Loading