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

disable AWS Bedrock support temporarily #479

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ In previous releases, the name "Hypermode" was used for all three._
- Enable GraphQL endpoints to be defined in the manifest [#464](https://github.com/hypermodeinc/modus/pull/464)
- Publish SDKs and templates via release workflows [#465](https://github.com/hypermodeinc/modus/pull/465)
- Fix AssemblyScript build failure when no Git repo is present [#475](https://github.com/hypermodeinc/modus/pull/475)
- Disable AWS Bedrock support temporarily [#479](https://github.com/hypermodeinc/modus/pull/479)

## 2024-10-02 - Version 0.12.7

Expand Down
60 changes: 30 additions & 30 deletions runtime/models/bedrock.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,44 @@

package models

import (
"context"
"fmt"
// import (
// "context"
// "fmt"

"github.com/hypermodeinc/modus/lib/manifest"
hyp_aws "github.com/hypermodeinc/modus/runtime/aws"
"github.com/hypermodeinc/modus/runtime/db"
"github.com/hypermodeinc/modus/runtime/utils"
// "github.com/hypermodeinc/modus/lib/manifest"
// hyp_aws "github.com/hypermodeinc/modus/runtime/aws"
// "github.com/hypermodeinc/modus/runtime/db"
// "github.com/hypermodeinc/modus/runtime/utils"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/bedrockruntime"
)
// "github.com/aws/aws-sdk-go-v2/aws"
// "github.com/aws/aws-sdk-go-v2/service/bedrockruntime"
// )

func invokeAwsBedrockModel(ctx context.Context, model *manifest.ModelInfo, input string) (output string, err error) {
// func invokeAwsBedrockModel(ctx context.Context, model *manifest.ModelInfo, input string) (output string, err error) {

span, ctx := utils.NewSentrySpanForCurrentFunc(ctx)
defer span.Finish()
// span, ctx := utils.NewSentrySpanForCurrentFunc(ctx)
// defer span.Finish()

// NOTE: Bedrock support is experimental, and not advertised to users.
// It currently uses the same AWS credentials as the Runtime.
// In the future, we will support user-provided credentials for Bedrock.
// // NOTE: Bedrock support is experimental, and not advertised to users.
// // It currently uses the same AWS credentials as the Runtime.
// // In the future, we will support user-provided credentials for Bedrock.

cfg := hyp_aws.GetAwsConfig() // TODO, connect to AWS using the user-provided credentials
client := bedrockruntime.NewFromConfig(cfg)
// cfg := hyp_aws.GetAwsConfig() // TODO, connect to AWS using the user-provided credentials
// client := bedrockruntime.NewFromConfig(cfg)

modelId := fmt.Sprintf("%s.%s", model.Provider, model.SourceModel)
// modelId := fmt.Sprintf("%s.%s", model.Provider, model.SourceModel)

startTime := utils.GetTime()
result, err := client.InvokeModel(ctx, &bedrockruntime.InvokeModelInput{
ModelId: &modelId,
ContentType: aws.String("application/json"),
Body: []byte(input),
})
endTime := utils.GetTime()
// startTime := utils.GetTime()
// result, err := client.InvokeModel(ctx, &bedrockruntime.InvokeModelInput{
// ModelId: &modelId,
// ContentType: aws.String("application/json"),
// Body: []byte(input),
// })
// endTime := utils.GetTime()

output = string(result.Body)
// output = string(result.Body)

db.WriteInferenceHistory(ctx, model, input, output, startTime, endTime)
// db.WriteInferenceHistory(ctx, model, input, output, startTime, endTime)

return output, err
}
// return output, err
// }
7 changes: 4 additions & 3 deletions runtime/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ func InvokeModel(ctx context.Context, modelName string, input string) (string, e
return "", err
}

// NOTE: Bedrock support is temporarily disabled
// TODO: use the provider pattern instead of branching
if model.Connection == "aws-bedrock" {
return invokeAwsBedrockModel(ctx, model, input)
}
// if model.Connection == "aws-bedrock" {
// return invokeAwsBedrockModel(ctx, model, input)
// }

return PostToModelEndpoint[string](ctx, model, input)
}
Expand Down
Loading