Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StripCodeFences ¶
StripCodeFences removes markdown code fences (```json ... ```) that some models wrap around JSON responses. Returns the original string if no fences found.
Types ¶
type AnthropicClient ¶
type AnthropicClient struct {
// contains filtered or unexported fields
}
AnthropicClient wraps the Anthropic Go SDK and implements LLMClient.
func NewAnthropicClient ¶
func NewAnthropicClient(apiKey string) *AnthropicClient
NewAnthropicClient creates an AnthropicClient authenticated with apiKey.
type GatewayClient ¶
type GatewayClient struct {
// contains filtered or unexported fields
}
GatewayClient sends completions through an OpenAI-compatible HTTP gateway. It implements LLMClient.
func NewGatewayClient ¶
func NewGatewayClient(baseURL, token string) *GatewayClient
NewGatewayClient creates a GatewayClient that POSTs to baseURL/v1/chat/completions authenticated with token.
type LLMClient ¶
type LLMClient interface {
Complete(ctx context.Context, model, systemPrompt, userMessage string, maxTokens int) (string, error)
}
LLMClient is the interface for sending a single-turn completion to a language model. All implementations must be safe for concurrent use.
func NewClient ¶
func NewClient(cfg config.ClaudeConfig) LLMClient
NewClient returns the appropriate LLMClient based on cfg.
Priority:
- GatewayURL + GatewayToken set → GatewayClient (OpenAI-compatible gateway)
- APIKey set → AnthropicClient (direct Anthropic SDK)
- Neither set → nil (no LLM available; callers must guard against this)