Documentation
¶
Index ¶
- type Client
- func (c *Client) Chat(ctx context.Context, message string, history []types.Message) (*types.CompletionResponse, error)
- func (c *Client) GenerateCommitMessage(diff string, prompt string) (string, error)
- func (c *Client) GenerateReviewComment(diff string, prompt string) (string, error)
- func (c *Client) GenerateReviewCommentStream(diff string, prompt string, callback func(string) error) error
- func (c *Client) Stream(ctx context.Context, message string, ...) error
- func (c *Client) TranslateMessage(prompt string, message string, lang string) (string, error)
- type ClientInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an LLM client
func New ¶
func New(config *types.ClientConfig) *Client
New creates a new client with the given config
func (*Client) Chat ¶
func (c *Client) Chat(ctx context.Context, message string, history []types.Message) (*types.CompletionResponse, error)
Chat sends a chat message to the LLM provider with retry logic
func (*Client) GenerateCommitMessage ¶
GenerateCommitMessage generates a commit message for the given diff
func (*Client) GenerateReviewComment ¶ added in v0.3.0
GenerateReviewComment generates a review comment for the given diff
func (*Client) GenerateReviewCommentStream ¶ added in v0.3.0
func (c *Client) GenerateReviewCommentStream(diff string, prompt string, callback func(string) error) error
GenerateReviewCommentStream generates a review comment for the given diff
func (*Client) Stream ¶ added in v0.3.0
func (c *Client) Stream(ctx context.Context, message string, callback func(*types.CompletionResponse) error) error
Stream sends a streaming request to the LLM provider and processes the response using the provided callback function.
Parameters:
- ctx: the context for the request, used for cancellation and timeouts
- message: the message to send to the LLM provider
- history: the message history to include in the request
- callback: a function that processes the CompletionResponse received from the LLM provider
Returns an error if the client cannot be obtained, the request fails, or the callback function returns an error.
type ClientInterface ¶ added in v0.2.3
type ClientInterface interface { Chat(ctx context.Context, message string, history []types.Message) (*types.CompletionResponse, error) TranslateMessage(prompt string, message string, lang string) (string, error) GenerateCommitMessage(diff string, prompt string) (string, error) GenerateReviewComment(diff string, prompt string) (string, error) GenerateReviewCommentStream(diff string, prompt string, callback func(string) error) error }
Click to show internal directories.
Click to hide internal directories.