1
0
mirror of https://github.com/k8sgpt-ai/k8sgpt.git synced 2025-05-07 23:56:53 +00:00
k8sgpt/pkg/ai/bedrock_support/model_test.go
Cindy Tong aa1e237ebb
feat: add amazon bedrock nova pro and nova lite models ()
* feat: add amazon bedrock nova pro and nova lite models

Signed-off-by: Cindy Tong <tongcindyy@gmail.com>

* fix nova responses

Signed-off-by: Cindy Tong <tongcindyy@gmail.com>

* remove printing of Nova Response

Signed-off-by: Cindy Tong <tongcindyy@gmail.com>

* remove comments

Signed-off-by: Cindy Tong <tongcindyy@gmail.com>

* chore: rebased
chore: removed trivy

Signed-off-by: AlexsJones <alexsimonjones@gmail.com>

* chore: updated deps

Signed-off-by: AlexsJones <alexsimonjones@gmail.com>

* chore: adding inference profile labels as model names

Signed-off-by: AlexsJones <alexsimonjones@gmail.com>

* feat: added some tests around completions and responses

Signed-off-by: AlexsJones <alexsimonjones@gmail.com>

* feat: added model test

Signed-off-by: AlexsJones <alexsimonjones@gmail.com>

---------

Signed-off-by: Cindy Tong <tongcindyy@gmail.com>
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
Co-authored-by: AlexsJones <alexsimonjones@gmail.com>
2025-03-11 12:55:21 +00:00

60 lines
1.4 KiB
Go

package bedrock_support
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func TestBedrockModelConfig(t *testing.T) {
config := BedrockModelConfig{
MaxTokens: 100,
Temperature: 0.7,
TopP: 0.9,
ModelName: "test-model",
}
assert.Equal(t, 100, config.MaxTokens)
assert.Equal(t, float32(0.7), config.Temperature)
assert.Equal(t, float32(0.9), config.TopP)
assert.Equal(t, "test-model", config.ModelName)
}
func TestBedrockModel(t *testing.T) {
completion := &MockCompletion{}
response := &MockResponse{}
config := BedrockModelConfig{
MaxTokens: 100,
Temperature: 0.7,
TopP: 0.9,
ModelName: "test-model",
}
model := BedrockModel{
Name: "Test Model",
Completion: completion,
Response: response,
Config: config,
}
assert.Equal(t, "Test Model", model.Name)
assert.Equal(t, completion, model.Completion)
assert.Equal(t, response, model.Response)
assert.Equal(t, config, model.Config)
}
// MockCompletion is a mock implementation of the ICompletion interface
type MockCompletion struct{}
func (m *MockCompletion) GetCompletion(ctx context.Context, prompt string, config BedrockModelConfig) ([]byte, error) {
return []byte(`{"prompt": "mock prompt"}`), nil
}
// MockResponse is a mock implementation of the IResponse interface
type MockResponse struct{}
func (m *MockResponse) ParseResponse(body []byte) (string, error) {
return "mock response", nil
}