• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kshard / chatter / 16538940978

26 Jul 2025 10:35AM UTC coverage: 67.584% (+44.9%) from 22.674%
16538940978

Pull #53

github

fogfish
update license
Pull Request #53: Enable multi-content I/O within prompts & responses

596 of 837 new or added lines in 27 files covered. (71.21%)

2 existing lines in 2 files now uncovered.

884 of 1308 relevant lines covered (67.58%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/provider/bedrock/foundation/nova/types.go
1
//
2
// Copyright (C) 2024 - 2025 Dmitry Kolesnikov
3
//
4
// This file may be modified and distributed under the terms
5
// of the MIT license.  See the LICENSE file for details.
6
// https://github.com/kshard/chatter
7
//
8

9
package nova
10

11
import (
12
        "github.com/kshard/chatter/aio/provider"
13
        "github.com/kshard/chatter/provider/bedrock"
14
)
15

16
// Nova I/O Schema:
17
// https://docs.aws.amazon.com/nova/latest/userguide/complete-request-schema.html
18

19
type input struct {
20
        System          []content       `json:"system,omitempty"`
21
        Messages        []message       `json:"messages"`
22
        InferenceConfig inferenceConfig `json:"inferenceConfig,omitempty"`
23

24
        // Note: tools are not enabled use Converse API for this purpose
25
}
26

27
type message struct {
28
        Role    string    `json:"role"`
29
        Content []content `json:"content"`
30
}
31

32
type content struct {
33
        Text  string `json:"text,omitempty"`
34
        Image any    `json:"image,omitempty"`
35
        Video any    `json:"video,omitempty"`
36
}
37

38
type inferenceConfig struct {
39
        MaxTokens     int      `json:"maxTokens,omitempty"`
40
        Temperature   float64  `json:"temperature,omitempty"`
41
        TopP          float64  `json:"topP,omitempty"`
42
        TopK          int      `json:"topK,omitempty"`
43
        StopSequences []string `json:"stopSequences,omitempty"`
44
}
45

46
type reply struct {
47
        Output     output `json:"output"`
48
        Usage      usage  `json:"usage"`
49
        StopReason string `json:"stop_reason"`
50
}
51

52
type output struct {
53
        Message message `json:"message"`
54
}
55

56
type usage struct {
57
        InputTokens               int `json:"inputTokens,omitempty"`
58
        OutputTokens              int `json:"outputTokens,omitempty"`
59
        TotalTokens               int `json:"totalTokens,omitempty"`
60
        CacheReadInputTokenCount  int `json:"cacheReadInputTokenCount,omitempty"`
61
        CacheWriteInputTokenCount int `json:"cacheWriteInputTokenCount,omitempty"`
62
}
63

64
type encoder struct {
65
        req input
66
}
67

68
type decoder struct{}
69

70
type Nova = provider.Provider[*input, *reply]
71

NEW
72
func New(model string, opts ...bedrock.Option) (*Nova, error) {
×
NEW
73
        service, err := bedrock.New[*input, *reply](model, opts...)
×
NEW
74
        if err != nil {
×
NEW
75
                return nil, err
×
NEW
76
        }
×
77

NEW
78
        return provider.New(factory, decoder{}, service), nil
×
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc