generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 266
Closed
Labels
bugThis issue is a bug.This issue is a bug.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.
Description
Describe the bug
DocumentSource according to documentation is a UNION of these types: bytes, content, s3Location and text
but it seems to accept bytes or s3Location only.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
It should work with content and text type as well
Current Behavior
Error message when DocumentSource is set to content or text:
ValidationException: DocumentSource object at messages.0.content.1.document.source must set one of the following keys: bytes, s3Location.
Detailed output:
Error: service error
Caused by:
0: ValidationException: DocumentSource object at messages.0.content.1.document.source must set one of the following keys: bytes, s3Location.
1: ValidationException: DocumentSource object at messages.0.content.1.document.source must set one of the following keys: bytes, s3Location.
Stack backtrace:
0: std::backtrace_rs::backtrace::libunwind::trace
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
1: std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
2: std::backtrace::Backtrace::create
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/backtrace.rs:331:13
3: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.100/src/backtrace.rs:27:14
4: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
at /Users/marko/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:2087:27
5: aws_bedrock_poc::main::{{closure}}
at ./src/main.rs:30:20
6: <core::pin::Pin<P> as core::future::future::Future>::poll
at /Users/marko/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/future.rs:133:9
7: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/park.rs:285:71
8: tokio::task::coop::with_budget
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/task/coop/mod.rs:167:5
9: tokio::task::coop::budget
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/task/coop/mod.rs:133:5
10: tokio::runtime::park::CachedParkThread::block_on
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/park.rs:285:31
11: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/context/blocking.rs:66:14
12: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/scheduler/multi_thread/mod.rs:87:22
13: tokio::runtime::context::runtime::enter_runtime
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/context/runtime.rs:65:16
14: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/scheduler/multi_thread/mod.rs:86:9
15: tokio::runtime::runtime::Runtime::block_on_inner
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/runtime.rs:358:50
16: tokio::runtime::runtime::Runtime::block_on
at /Users/marko/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/runtime.rs:328:18
17: aws_bedrock_poc::main
at ./src/main.rs:50:7
18: core::ops::function::FnOnce::call_once
at /Users/marko/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:253:5
19: std::sys::backtrace::__rust_begin_short_backtrace
at /Users/marko/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:158:18
20: std::rt::lang_start::{{closure}}
at /Users/marko/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:206:18
21: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/ops/function.rs:290:21
22: std::panicking::catch_unwind::do_call
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:589:40
23: std::panicking::catch_unwind
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:552:19
24: std::panic::catch_unwind
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panic.rs:359:14
25: std::rt::lang_start_internal::{{closure}}
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/rt.rs:175:24
26: std::panicking::catch_unwind::do_call
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:589:40
27: std::panicking::catch_unwind
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:552:19
28: std::panic::catch_unwind
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panic.rs:359:14
29: std::rt::lang_start_internal
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/rt.rs:171:5
30: std::rt::lang_start
at /Users/marko/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:205:5
31: _main
Process finished with exit code 1
Reproduction Steps
use aws_sdk_bedrockruntime as aws_bedrock_runtime;
use aws_sdk_bedrockruntime::types::DocumentFormat;
use aws_sdk_bedrockruntime::types::{
ContentBlock, ConversationRole, ConverseOutput, DocumentBlock, DocumentSource, Message, DocumentContentBlock
};
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
tracing_subscriber::fmt::init();
let config = aws_config::load_from_env().await;
let client = aws_bedrock_runtime::Client::new(&config);
let document_block = DocumentBlock::builder()
// .source(DocumentSource::Content(vec![DocumentContentBlock::Text("lorem ipsum".to_string())])) // doesn't work
.source(DocumentSource::Text("lorem ipsum".to_string()))// doesn't work
// .source(DocumentSource::Bytes(aws_smithy_types::Blob::new("lorem ipsum".as_bytes()))) // works
.name("document")
.format(DocumentFormat::Txt)
.build()?;
let message = Message::builder()
.role(ConversationRole::User)
.set_content(Some(vec![
ContentBlock::Text("describe document".to_string()),
ContentBlock::Document(document_block),
]))
.build()?;
let response = client
.converse()
.model_id("amazon.nova-lite-v1:0")
.messages(message)
.send()
.await?;
if let Some(output) = response.output {
match output {
ConverseOutput::Message(msg) => {
for content in msg.content {
if let ContentBlock::Text(text) = content {
println!("Response: {}", text);
}
}
}
_ => {}
}
}
Ok(())
}
Possible Solution
No response
Additional Information/Context
No response
Version
aws-bedrock-poc v0.1.0 (/Users/marko/RustroverProjects/aws-bedrock-poc)
├── aws-config v1.8.7
│ ├── aws-credential-types v1.2.7
│ │ ├── aws-smithy-async v1.2.5
│ │ ├── aws-smithy-runtime-api v1.9.0
│ │ │ ├── aws-smithy-async v1.2.5 (*)
│ │ │ ├── aws-smithy-types v1.3.2
│ │ ├── aws-smithy-types v1.3.2 (*)
│ ├── aws-runtime v1.5.11
│ │ ├── aws-credential-types v1.2.7 (*)
│ │ ├── aws-sigv4 v1.3.4
│ │ │ ├── aws-credential-types v1.2.7 (*)
│ │ │ ├── aws-smithy-eventstream v0.60.11
│ │ │ │ ├── aws-smithy-types v1.3.2 (*)
│ │ │ ├── aws-smithy-http v0.62.3
│ │ │ │ ├── aws-smithy-eventstream v0.60.11 (*)
│ │ │ │ ├── aws-smithy-runtime-api v1.9.0 (*)
│ │ │ │ ├── aws-smithy-types v1.3.2 (*)
│ │ │ ├── aws-smithy-runtime-api v1.9.0 (*)
│ │ │ ├── aws-smithy-types v1.3.2 (*)
│ │ ├── aws-smithy-async v1.2.5 (*)
│ │ ├── aws-smithy-eventstream v0.60.11 (*)
│ │ ├── aws-smithy-http v0.62.3 (*)
│ │ ├── aws-smithy-runtime v1.9.2
│ │ │ ├── aws-smithy-async v1.2.5 (*)
│ │ │ ├── aws-smithy-http v0.62.3 (*)
│ │ │ ├── aws-smithy-http-client v1.1.2
│ │ │ │ ├── aws-smithy-async v1.2.5 (*)
│ │ │ │ ├── aws-smithy-runtime-api v1.9.0 (*)
│ │ │ │ ├── aws-smithy-types v1.3.2 (*)
│ │ │ │ │ │ ├── aws-lc-rs v1.14.1
│ │ │ │ │ │ │ ├── aws-lc-sys v0.32.2
│ │ │ │ │ │ │ ├── aws-lc-rs v1.14.1 (*)
│ │ │ ├── aws-smithy-observability v0.1.3
│ │ │ │ └── aws-smithy-runtime-api v1.9.0 (*)
│ │ │ ├── aws-smithy-runtime-api v1.9.0 (*)
│ │ │ ├── aws-smithy-types v1.3.2 (*)
│ │ ├── aws-smithy-runtime-api v1.9.0 (*)
│ │ ├── aws-smithy-types v1.3.2 (*)
│ │ ├── aws-types v1.3.8
│ │ │ ├── aws-credential-types v1.2.7 (*)
│ │ │ ├── aws-smithy-async v1.2.5 (*)
│ │ │ ├── aws-smithy-runtime-api v1.9.0 (*)
│ │ │ ├── aws-smithy-types v1.3.2 (*)
│ ├── aws-sdk-sso v1.85.0
│ │ ├── aws-credential-types v1.2.7 (*)
│ │ ├── aws-runtime v1.5.11 (*)
│ │ ├── aws-smithy-async v1.2.5 (*)
│ │ ├── aws-smithy-http v0.62.3 (*)
│ │ ├── aws-smithy-json v0.61.5
│ │ │ └── aws-smithy-types v1.3.2 (*)
│ │ ├── aws-smithy-runtime v1.9.2 (*)
│ │ ├── aws-smithy-runtime-api v1.9.0 (*)
│ │ ├── aws-smithy-types v1.3.2 (*)
│ │ ├── aws-types v1.3.8 (*)
│ ├── aws-sdk-ssooidc v1.87.0
│ │ ├── aws-credential-types v1.2.7 (*)
│ │ ├── aws-runtime v1.5.11 (*)
│ │ ├── aws-smithy-async v1.2.5 (*)
│ │ ├── aws-smithy-http v0.62.3 (*)
│ │ ├── aws-smithy-json v0.61.5 (*)
│ │ ├── aws-smithy-runtime v1.9.2 (*)
│ │ ├── aws-smithy-runtime-api v1.9.0 (*)
│ │ ├── aws-smithy-types v1.3.2 (*)
│ │ ├── aws-types v1.3.8 (*)
│ ├── aws-sdk-sts v1.87.0
│ │ ├── aws-credential-types v1.2.7 (*)
│ │ ├── aws-runtime v1.5.11 (*)
│ │ ├── aws-smithy-async v1.2.5 (*)
│ │ ├── aws-smithy-http v0.62.3 (*)
│ │ ├── aws-smithy-json v0.61.5 (*)
│ │ ├── aws-smithy-query v0.60.7
│ │ │ ├── aws-smithy-types v1.3.2 (*)
│ │ ├── aws-smithy-runtime v1.9.2 (*)
│ │ ├── aws-smithy-runtime-api v1.9.0 (*)
│ │ ├── aws-smithy-types v1.3.2 (*)
│ │ ├── aws-smithy-xml v0.60.10
│ │ ├── aws-types v1.3.8 (*)
│ ├── aws-smithy-async v1.2.5 (*)
│ ├── aws-smithy-http v0.62.3 (*)
│ ├── aws-smithy-json v0.61.5 (*)
│ ├── aws-smithy-runtime v1.9.2 (*)
│ ├── aws-smithy-runtime-api v1.9.0 (*)
│ ├── aws-smithy-types v1.3.2 (*)
│ ├── aws-types v1.3.8 (*)
├── aws-sdk-bedrockruntime v1.108.0
│ ├── aws-credential-types v1.2.7 (*)
│ ├── aws-runtime v1.5.11 (*)
│ ├── aws-sigv4 v1.3.4 (*)
│ ├── aws-smithy-async v1.2.5 (*)
│ ├── aws-smithy-eventstream v0.60.11 (*)
│ ├── aws-smithy-http v0.62.3 (*)
│ ├── aws-smithy-json v0.61.5 (*)
│ ├── aws-smithy-runtime v1.9.2 (*)
│ ├── aws-smithy-runtime-api v1.9.0 (*)
│ ├── aws-smithy-types v1.3.2 (*)
│ ├── aws-types v1.3.8 (*)
Environment details (OS name and version, etc.)
macOS Sequoia Version 15.6.1
Logs
No response
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.