Add vendor assessment agent

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-04-22 22:36:14 +02:00
parent 25c590ffe6
commit 509d0c88b1
108 changed files with 9445 additions and 645 deletions

View File

@@ -33,6 +33,12 @@ type (
ToolChoice *ToolChoice
ParallelToolCalls *bool
ResponseFormat *ResponseFormat
Thinking *ThinkingConfig
}
ThinkingConfig struct {
Enabled bool
BudgetTokens int
}
ToolChoiceType string
@@ -97,8 +103,10 @@ type (
}
MessageDelta struct {
Content string
ToolCalls []ToolCallDelta
Content string
Thinking string
ThinkingSignature string
ToolCalls []ToolCallDelta
}
ToolCallDelta struct {
@@ -144,13 +152,15 @@ func (u Usage) Add(other Usage) Usage {
// After the stream is exhausted (Next returns false), call Response
// to get the fully assembled ChatCompletionResponse.
type StreamAccumulator struct {
stream ChatCompletionStream
current ChatCompletionStreamEvent
content strings.Builder
toolCalls map[int]*ToolCall
usage Usage
finishReason FinishReason
model string
stream ChatCompletionStream
current ChatCompletionStreamEvent
content strings.Builder
thinking strings.Builder
thinkingSignature string
toolCalls map[int]*ToolCall
usage Usage
finishReason FinishReason
model string
}
func NewStreamAccumulator(stream ChatCompletionStream) *StreamAccumulator {
@@ -194,11 +204,20 @@ func (a *StreamAccumulator) Response() *ChatCompletionResponse {
}
}
var parts []Part
if thinking := a.thinking.String(); thinking != "" {
parts = append(parts, ThinkingPart{
Text: thinking,
Signature: a.thinkingSignature,
})
}
parts = append(parts, TextPart{Text: a.content.String()})
return &ChatCompletionResponse{
Model: a.model,
Message: Message{
Role: RoleAssistant,
Parts: []Part{TextPart{Text: a.content.String()}},
Parts: parts,
ToolCalls: toolCalls,
},
Usage: a.usage,
@@ -212,6 +231,10 @@ func (a *StreamAccumulator) accumulate(event ChatCompletionStreamEvent) {
}
a.content.WriteString(event.Delta.Content)
a.thinking.WriteString(event.Delta.Thinking)
if event.Delta.ThinkingSignature != "" {
a.thinkingSignature = event.Delta.ThinkingSignature
}
for _, tcd := range event.Delta.ToolCalls {
tc, ok := a.toolCalls[tcd.Index]