Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amazon Bedrock: Simplify and restructure navigation #6492

Merged
merged 4 commits into from
May 27, 2024
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
682 changes: 281 additions & 401 deletions .doc_gen/metadata/bedrock-runtime_metadata.yaml

Large diffs are not rendered by default.

39 changes: 28 additions & 11 deletions dotnetv3/Bedrock-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,34 @@ For prerequisites, see the [README](../README.md#Prerequisites) in the `dotnetv3

<!--custom.prerequisites.start-->
<!--custom.prerequisites.end-->
### Invoke model examples

- [AI21 Labs Jurassic-2: Text generation](Actions/InvokeModelAsync.cs#L164)
- [Amazon Titan Text G1](Actions/InvokeModelAsync.cs#L277)
- [Amazon Titan: Image generation](Actions/InvokeModelAsync.cs#L450)
- [Anthropic Claude 2: Real-time response stream processing](Actions/InvokeModelAsync.cs#L76)
- [Anthropic Claude 2: Text generation](Actions/InvokeModelAsync.cs#L18)
- [Meta Llama 2: Text generation](Actions/InvokeModelAsync.cs#L221)
- [Mistral AI: Text generation with Mistral 7B Instruct](Actions/InvokeModelAsync.cs#L338)
- [Mistral AI: Text generation with Mixtral 8x7B Instruct](Actions/InvokeModelAsync.cs#L394)
- [Stable Diffusion: Image generation](Actions/InvokeModelAsync.cs#L518)
### AI21 Labs Jurassic-2

- [Generate text](Actions/InvokeModelAsync.cs#L164)

### Amazon Titan Image Generator

- [Generate images](Actions/InvokeModelAsync.cs#L450)

### Amazon Titan Text

- [Generate text](Actions/InvokeModelAsync.cs#L277)

### Anthropic Claude

- [Generate text](Actions/InvokeModelAsync.cs#L18)
- [Generate text with a response stream](Actions/InvokeModelAsync.cs#L76)

### Meta Llama

- [Llama 2: Generate text](Actions/InvokeModelAsync.cs#L221)

### Mistral AI

- [Generate text](Actions/InvokeModelAsync.cs#L338)

### Stability AI Diffusion

- [Generate images](Actions/InvokeModelAsync.cs#L518)


<!--custom.examples.start-->
Expand Down
28 changes: 20 additions & 8 deletions gov2/bedrock-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,26 @@ functions within the same service.

- [Invoke multiple foundation models on Amazon Bedrock](scenarios/scenario_invoke_models.go)

### Invoke model examples

- [AI21 Labs Jurassic-2: Text generation](actions/invoke_model.go#L83)
- [Amazon Titan Text G1](actions/invoke_model.go#L261)
- [Amazon Titan: Image generation](actions/invoke_model.go#L191)
- [Anthropic Claude 2: Real-time response stream processing](actions/invoke_model_with_response_stream.go#L30)
- [Anthropic Claude 2: Text generation](actions/invoke_model.go#L27)
- [Meta Llama 2: Text generation](actions/invoke_model.go#L140)
### AI21 Labs Jurassic-2

- [Generate text](actions/invoke_model.go#L83)

### Amazon Titan Image Generator

- [Generate images](actions/invoke_model.go#L191)

### Amazon Titan Text

- [Generate text](actions/invoke_model.go#L261)

### Anthropic Claude

- [Generate text](actions/invoke_model.go#L27)
- [Generate text with a response stream](actions/invoke_model_with_response_stream.go#L30)

### Meta Llama

- [Llama 2: Generate text](actions/invoke_model.go#L140)


<!--custom.examples.start-->
Expand Down
37 changes: 23 additions & 14 deletions javascriptv3/example_code/bedrock-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,29 @@ functions within the same service.

- [Invoke multiple foundation models on Amazon Bedrock](scenarios/cli_text_playground.js)

### Invoke model examples

- [AI21 Labs Jurassic-2: Text generation](models/ai21_labs_jurassic2/jurassic2.js)
- [Amazon Titan Text G1](models/amazon_titan/titan_text.js)
- [Anthropic Claude 2: Real-time response stream processing](models/anthropic_claude/claude_3.js)
- [Anthropic Claude 2: Text generation](models/anthropic_claude/claude_2.js)
- [Anthropic Claude 3: Text generation](models/anthropic_claude/claude_3.js)
- [Anthropic Claude Instant: Text generation](models/anthropic_claude/claude_instant_1.js)
- [Meta Llama 2: Text generation](models/meta/llama2/invoke_model_quickstart.js#L4)
- [Meta Llama 2: Text generation with response stream](models/meta/llama2/invoke_model_with_response_stream_quickstart.js#L4)
- [Meta Llama 3: Text generation](models/meta/llama3/invoke_model_quickstart.js#L4)
- [Meta Llama 3: Text generation with response stream](models/meta/llama3/invoke_model_with_response_stream_quickstart.js#L4)
- [Mistral AI: Text generation with Mistral 7B Instruct](models/mistral_ai/mistral_7b.js)
- [Mistral AI: Text generation with Mixtral 8x7B Instruct](models/mistral_ai/mixtral_8x7b.js)
### AI21 Labs Jurassic-2

- [Generate text](models/ai21_labs_jurassic2/jurassic2.js)

### Amazon Titan Text

- [Generate text](models/amazon_titan/titan_text.js)

### Anthropic Claude

- [Generate text](models/anthropic_claude/claude_3.js)
- [Generate text with a response stream](models/anthropic_claude/claude_3.js)

### Meta Llama

- [Llama 2: Generate text](models/meta/llama2/invoke_model_quickstart.js#L4)
- [Llama 2: Generate text with a response stream](models/meta/llama2/invoke_model_with_response_stream_quickstart.js#L4)
- [Llama 3: Generate text](models/meta/llama3/invoke_model_quickstart.js#L4)
- [Llama 3: Generate text with a response stream](models/meta/llama3/invoke_model_with_response_stream_quickstart.js#L4)

### Mistral AI

- [Generate text](models/mistral_ai/mistral_7b.js)


<!--custom.examples.start-->
Expand Down
52 changes: 35 additions & 17 deletions javav2/example_code/bedrock-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,41 @@ functions within the same service.

- [Invoke multiple foundation models on Amazon Bedrock](src/main/java/com/example/bedrockruntime/BedrockRuntimeUsageDemo.java)

### Invoke model examples

- [AI21 Labs Jurassic-2: Text generation](src/main/java/com/example/bedrockruntime/InvokeModelAsync.java#L208)
- [Amazon Titan Text Embeddings G1](src/main/java/com/example/bedrockruntime/models/amazon/titan/TextEmbeddingsG1Quickstart.java#L11)
- [Amazon Titan Text Embeddings V2](src/main/java/com/example/bedrockruntime/models/amazon/titan/TextEmbeddingsV2Quickstart.java#L11)
- [Amazon Titan Text G1](src/main/java/com/example/bedrockruntime/models/amazon/titan/TextG1Quickstart.java#L11)
- [Amazon Titan: Image generation](src/main/java/com/example/bedrockruntime/InvokeModelAsync.java#L343)
- [Anthropic Claude 2: Real-time response stream processing](src/main/java/com/example/bedrockruntime/Claude2.java#L65)
- [Anthropic Claude 2: Text generation](src/main/java/com/example/bedrockruntime/InvokeModel.java#L112)
- [Anthropic Claude 3: Real-time response stream processing](src/main/java/com/example/bedrockruntime/Claude3.java#L49)
- [Meta Llama 2: Text generation](src/main/java/com/example/bedrockruntime/models/meta/llama2/InvokeModelQuickstart.java#L11)
- [Meta Llama 2: Text generation with response stream](src/main/java/com/example/bedrockruntime/models/meta/llama2/InvokeModelWithResponseStreamQuickstart.java#L12)
- [Meta Llama 3: Text generation](src/main/java/com/example/bedrockruntime/models/meta/llama3/InvokeModelQuickstart.java#L13)
- [Meta Llama 3: Text generation with response stream](src/main/java/com/example/bedrockruntime/models/meta/llama3/InvokeModelWithResponseStreamQuickstart.java#L14)
- [Mistral AI: Text generation with Mistral 7B Instruct](src/main/java/com/example/bedrockruntime/InvokeModelAsync.java#L33)
- [Mistral AI: Text generation with Mixtral 8x7B Instruct](src/main/java/com/example/bedrockruntime/InvokeModelAsync.java#L89)
- [Stable Diffusion: Image generation](src/main/java/com/example/bedrockruntime/InvokeModelAsync.java#L272)
### AI21 Labs Jurassic-2

- [Generate text](src/main/java/com/example/bedrockruntime/InvokeModelAsync.java#L208)

### Amazon Titan Image Generator

- [Generate images](src/main/java/com/example/bedrockruntime/InvokeModelAsync.java#L343)

### Amazon Titan Text

- [Generate text](src/main/java/com/example/bedrockruntime/models/amazon/titan/TextQuickstart.java#L11)

### Amazon Titan Text Embeddings

- [Generate text embeddings](src/main/java/com/example/bedrockruntime/models/amazon/titan/TextEmbeddingsQuickstart.java#L11)

### Anthropic Claude

- [Generate text](src/main/java/com/example/bedrockruntime/InvokeModel.java#L112)
- [Generate text with a response stream](src/main/java/com/example/bedrockruntime/Claude2.java#L65)

### Meta Llama

- [Llama 2: Generate text](src/main/java/com/example/bedrockruntime/models/meta/llama2/InvokeModelQuickstart.java#L11)
- [Llama 2: Generate text with a response stream](src/main/java/com/example/bedrockruntime/models/meta/llama2/InvokeModelWithResponseStreamQuickstart.java#L12)
- [Llama 3: Generate text](src/main/java/com/example/bedrockruntime/models/meta/llama3/InvokeModelQuickstart.java#L13)
- [Llama 3: Generate text with a response stream](src/main/java/com/example/bedrockruntime/models/meta/llama3/InvokeModelWithResponseStreamQuickstart.java#L14)

### Mistral AI

- [Generate text](src/main/java/com/example/bedrockruntime/InvokeModelAsync.java#L33)

### Stability AI Diffusion

- [Generate images](src/main/java/com/example/bedrockruntime/InvokeModelAsync.java#L272)


<!--custom.examples.start-->
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.bedrockruntime.BedrockRuntimeClient;

// snippet-start:[bedrock-runtime.java2.InvokeModel_TitanTextEmbeddingsV2_Quickstart]
// Generate and print an embedding with Amazon Titan Text Embeddings V2.
public class TextEmbeddingsV2Quickstart {
// snippet-start:[bedrock-runtime.java2.InvokeModel_TitanTextEmbeddings_Quickstart]
// Generate and print an embedding with Amazon Titan Text Embeddings.
public class TextEmbeddingsQuickstart {

public static void main(String[] args) {

Expand Down Expand Up @@ -41,4 +41,4 @@ public static void main(String[] args) {
System.out.println(embedding);
}
}
// snippet-end:[bedrock-runtime.java2.InvokeModel_TitanTextEmbeddingsV2_Quickstart]
// snippet-end:[bedrock-runtime.java2.InvokeModel_TitanTextEmbeddings_Quickstart]
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
* https://docs.aws.amazon.com/bedrock/latest/userguide/service_code_examples.html
*/

public class TextEmbeddingsV2Scenarios {
// snippet-start:[bedrock-runtime.java2.InvokeModel_TitanTextEmbeddingsV2_AdditionalFields]
public class TextEmbeddingsScenarios {
// snippet-start:[bedrock-runtime.java2.InvokeModel_TitanTextEmbeddings_AdditionalFields]

/**
* Invoke Amazon Titan Text Embeddings v2 with additional inference parameters.
* Invoke Amazon Titan Text Embeddings V2 with additional inference parameters.
*
* @param inputText - The text to convert to an embedding.
* @param dimensions - The number of dimensions the output embeddings should have.
Expand Down Expand Up @@ -69,11 +69,11 @@ public static JSONObject invokeModel(String inputText, int dimensions, boolean n
// Return the model's native response.
return modelResponse;
}
// snippet-end:[bedrock-runtime.java2.InvokeModel_TitanTextEmbeddingsV2_AdditionalFields]
// snippet-end:[bedrock-runtime.java2.InvokeModel_TitanTextEmbeddings_AdditionalFields]

public static void main(String[] args) throws IOException {
new DemoRunner(List.of(
new TextEmbeddingScenario(TextEmbeddingsV2Scenarios::invokeModel)
new TextEmbeddingScenario(TextEmbeddingsScenarios::invokeModel)
)).run();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.bedrockruntime.BedrockRuntimeClient;

// snippet-start:[bedrock-runtime.java2.InvokeModel_TitanTextG1_Quickstart]
// snippet-start:[bedrock-runtime.java2.InvokeModel_TitanText_Quickstart]
// Send a prompt to Amazon Titan Text and print the response.
public class TextG1Quickstart {
public class TextQuickstart {

public static void main(String[] args) {

Expand Down Expand Up @@ -43,4 +43,4 @@ public static void main(String[] args) {
System.out.println(responseText);
}
}
// snippet-end:[bedrock-runtime.java2.InvokeModel_TitanTextG1_Quickstart]
// snippet-end:[bedrock-runtime.java2.InvokeModel_TitanText_Quickstart]
Loading
Loading