Fix Anthropic requests failing due to missing MaxTokens in agent configuration
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -89,6 +89,7 @@ probod:
|
||||
api-key: "thisisnotasecret"
|
||||
temperature: 0.1
|
||||
model-name: "gpt-4o"
|
||||
max-tokens: 4096
|
||||
|
||||
custom-domains:
|
||||
renewal-interval: 3600
|
||||
|
||||
@@ -413,6 +413,7 @@ spec:
|
||||
| probo.openai.apiKey | string | `""` | OpenAI API key for AI features (optional) |
|
||||
| probo.openai.temperature | float | `0.1` | OpenAI temperature setting |
|
||||
| probo.openai.modelName | string | `"gpt-4o"` | OpenAI model name |
|
||||
| probo.openai.maxTokens | int | `4096` | Maximum output tokens for LLM requests |
|
||||
| probo.customDomains.enabled | bool | `false` | Enable custom domains feature |
|
||||
| probo.customDomains.renewalInterval | int | `3600` | Certificate renewal interval in seconds |
|
||||
| probo.customDomains.provisionInterval | int | `30` | Domain provision interval in seconds |
|
||||
|
||||
@@ -217,6 +217,8 @@ spec:
|
||||
value: {{ .Values.probo.openai.temperature | quote }}
|
||||
- name: OPENAI_MODEL_NAME
|
||||
value: {{ .Values.probo.openai.modelName | quote }}
|
||||
- name: OPENAI_MAX_TOKENS
|
||||
value: {{ .Values.probo.openai.maxTokens | quote }}
|
||||
{{- end }}
|
||||
# Custom Domains
|
||||
{{- if .Values.probo.customDomains.enabled }}
|
||||
|
||||
@@ -157,6 +157,7 @@ probo:
|
||||
apiKey: "CHANGE_ME_OPENAI_API_KEY"
|
||||
temperature: 0.1
|
||||
modelName: "gpt-4o"
|
||||
maxTokens: 4096
|
||||
|
||||
# OpenTelemetry tracing (optional)
|
||||
tracing:
|
||||
|
||||
@@ -252,6 +252,7 @@ probo:
|
||||
apiKey: ""
|
||||
temperature: 0.1
|
||||
modelName: "gpt-4o"
|
||||
maxTokens: 4096
|
||||
|
||||
# Custom domains configuration (optional)
|
||||
customDomains:
|
||||
|
||||
1
e2e/console/testdata/config.yaml
vendored
1
e2e/console/testdata/config.yaml
vendored
@@ -65,6 +65,7 @@ probod:
|
||||
api-key: "thisisnotasecret"
|
||||
temperature: 0.1
|
||||
model-name: "gpt-4o"
|
||||
max-tokens: 4096
|
||||
|
||||
custom-domains:
|
||||
renewal-interval: 3600
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -20,12 +20,13 @@ import (
|
||||
)
|
||||
|
||||
type Agent struct {
|
||||
l *log.Logger
|
||||
client *llm.Client
|
||||
model string
|
||||
temp float64
|
||||
l *log.Logger
|
||||
client *llm.Client
|
||||
model string
|
||||
temp float64
|
||||
maxTokens int
|
||||
}
|
||||
|
||||
func NewAgent(l *log.Logger, client *llm.Client, model string, temp float64) *Agent {
|
||||
return &Agent{l: l, client: client, model: model, temp: temp}
|
||||
func NewAgent(l *log.Logger, client *llm.Client, model string, temp float64, maxTokens int) *Agent {
|
||||
return &Agent{l: l, client: client, model: model, temp: temp, maxTokens: maxTokens}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -55,6 +55,7 @@ func (a *Agent) GenerateChangelog(ctx context.Context, oldContent string, newCon
|
||||
agent.WithInstructions(changelogGeneratorSystemPrompt),
|
||||
agent.WithModel(a.model),
|
||||
agent.WithTemperature(a.temp),
|
||||
agent.WithMaxTokens(a.maxTokens),
|
||||
)
|
||||
|
||||
result, err := ag.Run(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -128,6 +128,7 @@ func (a *Agent) AssessVendor(ctx context.Context, websiteURL string) (*vendorInf
|
||||
agent.WithInstructions(assessVendorSystemPrompt),
|
||||
agent.WithModel(a.model),
|
||||
agent.WithTemperature(a.temp),
|
||||
agent.WithMaxTokens(a.maxTokens),
|
||||
)
|
||||
|
||||
typedResult, err := agent.RunTyped[vendorInfo](
|
||||
|
||||
@@ -151,6 +151,7 @@ func (b *Builder) Build() (*probod.FullConfig, error) {
|
||||
APIKey: b.getEnv("OPENAI_API_KEY"),
|
||||
Temperature: b.getEnvFloatOrDefault("OPENAI_TEMPERATURE", 0.1),
|
||||
ModelName: b.getEnvOrDefault("OPENAI_MODEL_NAME", "gpt-4o"),
|
||||
MaxTokens: b.getEnvIntOrDefault("OPENAI_MAX_TOKENS", 4096),
|
||||
},
|
||||
CustomDomains: probod.CustomDomainsConfig{
|
||||
RenewalInterval: b.getEnvIntOrDefault("CUSTOM_DOMAINS_RENEWAL_INTERVAL", 3600),
|
||||
|
||||
@@ -164,6 +164,7 @@ func TestBuilder_Build_Defaults(t *testing.T) {
|
||||
// OpenAI config
|
||||
assert.Equal(t, 0.1, cfg.Probod.OpenAI.Temperature)
|
||||
assert.Equal(t, "gpt-4o", cfg.Probod.OpenAI.ModelName)
|
||||
assert.Equal(t, 4096, cfg.Probod.OpenAI.MaxTokens)
|
||||
|
||||
// Custom domains config
|
||||
assert.Equal(t, 3600, cfg.Probod.CustomDomains.RenewalInterval)
|
||||
@@ -234,6 +235,7 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
||||
env["OPENAI_API_KEY"] = "sk-test-key"
|
||||
env["OPENAI_TEMPERATURE"] = "0.5"
|
||||
env["OPENAI_MODEL_NAME"] = "gpt-4-turbo"
|
||||
env["OPENAI_MAX_TOKENS"] = "8192"
|
||||
// Custom domains
|
||||
env["CUSTOM_DOMAINS_RESOLVER_ADDR"] = "1.1.1.1:53"
|
||||
env["ACME_ACCOUNT_KEY"] = "-----BEGIN EC PRIVATE KEY-----\ntest\n-----END EC PRIVATE KEY-----"
|
||||
@@ -297,6 +299,7 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
||||
assert.Equal(t, "sk-test-key", cfg.Probod.OpenAI.APIKey)
|
||||
assert.Equal(t, 0.5, cfg.Probod.OpenAI.Temperature)
|
||||
assert.Equal(t, "gpt-4-turbo", cfg.Probod.OpenAI.ModelName)
|
||||
assert.Equal(t, 8192, cfg.Probod.OpenAI.MaxTokens)
|
||||
// Custom domains
|
||||
assert.Equal(t, "1.1.1.1:53", cfg.Probod.CustomDomains.ResolverAddr)
|
||||
assert.Equal(t, "-----BEGIN EC PRIVATE KEY-----\ntest\n-----END EC PRIVATE KEY-----", cfg.Probod.CustomDomains.ACME.AccountKey)
|
||||
|
||||
@@ -59,6 +59,7 @@ type (
|
||||
llmClient *llm.Client
|
||||
llmModel string
|
||||
llmTemperature float64
|
||||
llmMaxTokens int
|
||||
html2pdfConverter *html2pdf.Converter
|
||||
acmeService *certmanager.ACMEService
|
||||
fileManager *filemanager.Service
|
||||
@@ -132,6 +133,7 @@ func NewService(
|
||||
llmClient *llm.Client,
|
||||
llmModel string,
|
||||
llmTemperature float64,
|
||||
llmMaxTokens int,
|
||||
html2pdfConverter *html2pdf.Converter,
|
||||
acmeService *certmanager.ACMEService,
|
||||
fileManagerService *filemanager.Service,
|
||||
@@ -157,6 +159,7 @@ func NewService(
|
||||
llmClient: llmClient,
|
||||
llmModel: llmModel,
|
||||
llmTemperature: llmTemperature,
|
||||
llmMaxTokens: llmMaxTokens,
|
||||
html2pdfConverter: html2pdfConverter,
|
||||
acmeService: acmeService,
|
||||
fileManager: fileManagerService,
|
||||
@@ -178,7 +181,7 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService {
|
||||
baseURL: s.baseURL,
|
||||
scope: coredata.NewScope(tenantID),
|
||||
tokenSecret: s.tokenSecret,
|
||||
agent: agents.NewAgent(nil, s.llmClient, s.llmModel, s.llmTemperature),
|
||||
agent: agents.NewAgent(nil, s.llmClient, s.llmModel, s.llmTemperature, s.llmMaxTokens),
|
||||
fileManager: s.fileManager,
|
||||
esign: s.esign,
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ type LLMConfig struct {
|
||||
APIKey string `json:"api-key"` // for OpenAI and Anthropic
|
||||
ModelName string `json:"model-name"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
MaxTokens int `json:"max-tokens"`
|
||||
}
|
||||
|
||||
type OpenAIConfig = LLMConfig
|
||||
|
||||
@@ -445,6 +445,7 @@ func (impl *Implm) Run(
|
||||
llmClient,
|
||||
impl.cfg.OpenAI.ModelName,
|
||||
impl.cfg.OpenAI.Temperature,
|
||||
impl.cfg.OpenAI.MaxTokens,
|
||||
html2pdfConverter,
|
||||
acmeService,
|
||||
fileManagerService,
|
||||
|
||||
Reference in New Issue
Block a user