feat: add AnthropicSummarizer implementation using anthropic-sdk-go package
Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>
This commit is contained in:
parent
7f2629d09c
commit
513af56fff
2 changed files with 72 additions and 6 deletions
|
|
@ -67,26 +67,39 @@ func main() {
|
|||
// vikunjaTasks = DoVikunja(*start, *end)
|
||||
// }
|
||||
|
||||
// Get OpenAI environment variables
|
||||
// Get environment variables
|
||||
openaiEndpoint := os.Getenv("OPENAI_ENDPOINT")
|
||||
openaiToken := os.Getenv("OPENAI_TOKEN")
|
||||
openaiModel := os.Getenv("OPENAI_MODEL")
|
||||
anthropicModel := os.Getenv("ANTHROPIC_MODEL")
|
||||
|
||||
// Create Ollama summarizer
|
||||
ollamaSummarizer := NewOllamaSummarizer("", "", openaiModel)
|
||||
// Create appropriate summarizer based on available environment variables
|
||||
var summarizer Summarizer
|
||||
if openaiEndpoint != "" && openaiToken != "" {
|
||||
// Use OpenAI summarizer
|
||||
summarizer = NewOpenAISummarizer(openaiEndpoint, openaiToken, openaiModel)
|
||||
} else if anthropicModel != "" {
|
||||
// Use Anthropic summarizer
|
||||
summarizer = NewAnthropicSummarizer(anthropicModel)
|
||||
} else {
|
||||
// Use Ollama summarizer as fallback
|
||||
summarizer = NewOllamaSummarizer("", "", openaiModel)
|
||||
}
|
||||
|
||||
// Always call SummarizeData to ensure prompt file is created for debugging
|
||||
summ, err := SummarizeData(*employeename, prs, issues, vikunjaTasks, finalPrompt, ollamaSummarizer)
|
||||
summ, err := SummarizeData(*employeename, prs, issues, vikunjaTasks, finalPrompt, summarizer)
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("error getting PRs: %w", err))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Only call summarization endpoint if OpenAI env vars are set
|
||||
// Only call summarization endpoint if we have appropriate credentials
|
||||
if openaiEndpoint != "" && openaiToken != "" {
|
||||
fmt.Println(summ)
|
||||
} else if os.Getenv("ANTHROPIC_API_KEY") != "" && anthropicModel != "" {
|
||||
fmt.Println(summ)
|
||||
} else {
|
||||
fmt.Println("OpenAI endpoint and token not set, but prompt file was created for debugging")
|
||||
fmt.Println("No summarization endpoint configured, but prompt file was created for debugging")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue