Skip to content

chore: extract Vertex AI timeout and max tokens to named constants #82

Closed

Description

@yvonnedevlinrh

Context

PR #79 updated Timeout from 120s to 300s and MaxTokens from 4096 to 16000 in llm/vertex.go. These values are inline literals with explanatory comments. The existing codebase already defines retry-related values as named constants (vertexSynthMaxRetries, vertexSynthBaseDelay, vertexSynthMaxDelay) in the same file — the timeout and max tokens should follow the same pattern for consistency.

Convention: CS-007 (magic numbers should be named constants)

What to change

In llm/vertex.go, add two named constants to the existing const block:

const (
	vertexSynthMaxRetries = 5
	vertexSynthBaseDelay  = 1 * time.Second
	vertexSynthMaxDelay   = 60 * time.Second
+	// vertexSynthTimeout is the HTTP client timeout for Vertex AI requests.
+	// Large curation prompts (36K+ tokens) need ~120-180s for response generation.
+	vertexSynthTimeout   = 300 * time.Second
+	// vertexSynthMaxTokens is the maximum output tokens for Vertex AI responses.
+	// Curation extractions routinely exceed 4K tokens; 16K provides headroom.
+	vertexSynthMaxTokens = 16000
)

Then replace the inline literals:

// line 85
Timeout: vertexSynthTimeout,

// line 119
MaxTokens: vertexSynthMaxTokens,

Scope

  • File: llm/vertex.go (2 lines changed)
  • Tests: No test changes needed — values are not asserted directly
  • Risk: None — pure refactor, no behavioral change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementgood first issue

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions