-
-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
Describe the bug
Unable to perform listFoundationModels() from Bedrock
To Reproduce
Steps to reproduce the behaviour:
import PackageDescription
let package = Package(
name: "BedrockTest",
platforms: [
.macOS(.v15)
],
dependencies: [
.package(url: "https://github.com/soto-project/soto.git", from: "7.10.0")
],
targets: [
.executableTarget(
name: "BedrockTest",
dependencies: [
.product(name: "SotoBedrock", package: "soto"),
]
)
]
)
import AsyncHTTPClient
import Logging
import SotoBedrock
import SotoCore
@main
struct BedrockTest {
static func main() async throws {
let httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
let awsClient = AWSClient(credentialProvider: .configFile(profile: "bedrock-test"), httpClient: httpClient)
let bedrock = SotoBedrock.Bedrock(client: awsClient, region: .useast1)
do {
let result = try await bedrock.listFoundationModels()
print("Foundation Models: \(result.modelSummaries)")
} catch {
print("Error listing foundation models: \(error)")
}
try? await awsClient.shutdown()
try? await httpClient.shutdown()
}
}Error:
Error listing foundation models: dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "modelSummaries", intValue: nil), _CodingKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "inferenceTypesSupported", intValue: nil), _CodingKey(stringValue: "Index 0", intValue: 0)], debugDescription: "Cannot initialize InferenceType from invalid String value INFERENCE_PROFILE", underlyingError: nil))From aws cli the output is:
aws bedrock list-foundation-models --profile bedrock-test --region us-east-1
{
"modelSummaries": [
{
"modelArn": "arn:aws:bedrock:us-east-1::foundation-model/stability.stable-fast-upscale-v1:0",
"modelId": "stability.stable-fast-upscale-v1:0",
"modelName": "Stable Image Fast Upscale",
"providerName": "Stability AI",
"inputModalities": [
"TEXT",
"IMAGE"
],
"outputModalities": [
"IMAGE"
],
"responseStreamingSupported": false,
"customizationsSupported": [],
"inferenceTypesSupported": [
"INFERENCE_PROFILE"
],
"modelLifecycle": {
"status": "ACTIVE"
}
},
...
}Expected behavior
A clear and concise description of what you expected to happen.
according to this https://docs.aws.amazon.com/bedrock/latest/APIReference/API_ListFoundationModels.html
the content of inferenceTypesSupported array should be of type string.
in soto, the shape is defined as an enum, but INFERENCE_PROFILE is not present in the case list:
public struct FoundationModelDetails: AWSDecodableShape {
/// The customization that the model supports.
public let customizationsSupported: [ModelCustomization]?
/// The inference types that the model supports.
public let inferenceTypesSupported: [InferenceType]?
...
public enum InferenceType: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
case onDemand = "ON_DEMAND"
case provisioned = "PROVISIONED"
public var description: String { return self.rawValue }
}
Setup (please complete the following information):
- OS: macOS Tahoe 26.0.1
- Version of soto: 7.10
- Authentication mechanism [hard-coded credentials, IAM Instance Profile on EC2, etc] configuration file
Additional context
Metadata
Metadata
Assignees
Labels
No labels