fix: correct client reference and update Anthropic summarizer implementation
This commit is contained in:
parent
f326dca8a9
commit
9a71cf44bc
1 changed files with 6 additions and 14 deletions
|
|
@ -129,7 +129,7 @@ func NewAnthropicSummarizer(model string) *AnthropicSummarizer {
|
||||||
)
|
)
|
||||||
|
|
||||||
return &AnthropicSummarizer{
|
return &AnthropicSummarizer{
|
||||||
client: client,
|
client: &client,
|
||||||
model: model,
|
model: model,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -145,25 +145,17 @@ func (a *AnthropicSummarizer) Summarize(fullPrompt string) (string, error) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
message, err := a.client.Messages.New(ctx, anthropic.MessageNewParams{
|
message, err := a.client.Messages.New(ctx, anthropic.MessageNewParams{
|
||||||
Model: a.model,
|
Model: anthropic.Model(a.model),
|
||||||
MaxTokens: 1024,
|
MaxTokens: 10000,
|
||||||
Messages: []anthropic.MessageParam{
|
Messages: []anthropic.MessageParam{
|
||||||
anthropic.NewUserMessage(anthropic.NewTextBlock(fullPrompt)),
|
anthropic.NewUserMessage(anthropic.NewTextBlock(fullPrompt)),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "Blew up here", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the response text
|
return fmt.Sprintf("%+v\n", message.Content), nil
|
||||||
var result string
|
|
||||||
for _, content := range message.Content {
|
|
||||||
if textBlock, ok := content.AsAny().(*anthropic.TextBlock); ok {
|
|
||||||
result += textBlock.Text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// buildPrompt constructs the prompt string from PRs, issues, and tasks
|
// buildPrompt constructs the prompt string from PRs, issues, and tasks
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue