Documentation
¶
Index ¶
- type APIResponse
- type AnthropicContent
- type AnthropicMessage
- type AnthropicRequest
- type AnthropicResponse
- type AnthropicUsage
- type Client
- func (c *Client) BuildContinuationPrompt(partialContent, originalContent string, req types.AIRequest) string
- func (c *Client) LooksReasonablyComplete(response, original string, language types.Language) bool
- func (c *Client) MergeContinuation(existing, continuation string) string
- func (c *Client) ProcessContent(req types.AIRequest, contextFiles []*types.ContextFile) (*types.AIResponse, error)
- func (c *Client) ValidateConfig() error
- type OpenAIChoice
- type OpenAIMessage
- type OpenAIRequest
- type OpenAIResponse
- type OpenAIUsage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse interface {
GetContent() string
GetTokensUsed() int
GetFinishReason() string // ADD THIS
IsComplete() bool // ADD THIS
}
APIResponse interface for different provider responses
type AnthropicContent ¶
type AnthropicMessage ¶
type AnthropicRequest ¶
type AnthropicRequest struct {
Model string `json:"model"`
MaxTokens int `json:"max_tokens"`
Temperature float64 `json:"temperature,omitempty"`
Messages []AnthropicMessage `json:"messages"`
}
Anthropic API types
type AnthropicResponse ¶
type AnthropicResponse struct {
Content []AnthropicContent `json:"content"`
Usage AnthropicUsage `json:"usage"`
StopReason string `json:"stop_reason"` // ADD THIS
}
func (*AnthropicResponse) GetContent ¶
func (r *AnthropicResponse) GetContent() string
func (*AnthropicResponse) GetFinishReason ¶
func (r *AnthropicResponse) GetFinishReason() string
func (*AnthropicResponse) GetTokensUsed ¶
func (r *AnthropicResponse) GetTokensUsed() int
func (*AnthropicResponse) IsComplete ¶
func (r *AnthropicResponse) IsComplete() bool
type AnthropicUsage ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles AI API requests
func (*Client) BuildContinuationPrompt ¶
func (c *Client) BuildContinuationPrompt(partialContent, originalContent string, req types.AIRequest) string
NEW: Build continuation prompt
func (*Client) LooksReasonablyComplete ¶
NEW: Check if response looks reasonably complete
func (*Client) MergeContinuation ¶
Enhanced mergeContinuation with robust overlap detection and removal
func (*Client) ProcessContent ¶
func (c *Client) ProcessContent(req types.AIRequest, contextFiles []*types.ContextFile) (*types.AIResponse, error)
ProcessContent sends content to AI for processing
func (*Client) ValidateConfig ¶
ValidateConfig checks if the AI configuration is valid
type OpenAIChoice ¶
type OpenAIChoice struct {
Message OpenAIMessage `json:"message"`
FinishReason string `json:"finish_reason"` // ADD THIS
}
type OpenAIMessage ¶
type OpenAIRequest ¶
type OpenAIRequest struct {
Model string `json:"model"`
Messages []OpenAIMessage `json:"messages"`
MaxTokens int `json:"max_tokens,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
}
OpenAI API types
type OpenAIResponse ¶
type OpenAIResponse struct {
Choices []OpenAIChoice `json:"choices"`
Usage OpenAIUsage `json:"usage"`
}
func (*OpenAIResponse) GetContent ¶
func (r *OpenAIResponse) GetContent() string
func (*OpenAIResponse) GetFinishReason ¶
func (r *OpenAIResponse) GetFinishReason() string
func (*OpenAIResponse) GetTokensUsed ¶
func (r *OpenAIResponse) GetTokensUsed() int
func (*OpenAIResponse) IsComplete ¶
func (r *OpenAIResponse) IsComplete() bool
type OpenAIUsage ¶
type OpenAIUsage struct {
TotalTokens int `json:"total_tokens"`
}
Click to show internal directories.
Click to hide internal directories.