ai

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LANG_JP              = "ja"
	PROMPT_SYSTEM_MSG_EN = "You are a helpful security advisor. Please explain this in a way that a non-security expert can understand."
	PROMPT_SYSTEM_MSG_JP = "" /* 174-byte string literal not displayed */
	PROMPT_SUMMARY_EN    = `` /* 679-byte string literal not displayed */

	PROMPT_SUMMARY_JP = `` /* 1024-byte string literal not displayed */

	FINDING_FORMAT_FOR_AI = `` /* 136-byte string literal not displayed */

	RECOMMEND_FORMAT_FOR_AI = `
Detail: %s

Recommendation: %s
`
)
View Source
const (
	CACHE_SIZE       = 200 * 1024 * 1024 // 200MB
	CACHE_EXPIRE_SEC = 3600
	CACHE_KEY_FORMAT = "OpenAICache/%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AIClient

type AIClient struct {
	// contains filtered or unexported fields
}

func (*AIClient) AskAISummaryFromFinding

func (a *AIClient) AskAISummaryFromFinding(ctx context.Context, f *model.Finding, r *model.Recommend, lang string) (string, error)

func (*AIClient) AskAISummaryStreamFromFinding added in v0.10.0

func (a *AIClient) AskAISummaryStreamFromFinding(
	ctx context.Context, f *model.Finding, r *model.Recommend, lang string, stream finding.FindingService_GetAISummaryStreamServer,
) error

func (*AIClient) ChatAI added in v0.15.0

func (a *AIClient) ChatAI(ctx context.Context, req *ai.ChatAIRequest) (*ai.ChatAIResponse, error)

type AIService

type AIService interface {
	ChatAI(ctx context.Context, req *ai.ChatAIRequest) (*ai.ChatAIResponse, error)
	AskAISummaryFromFinding(ctx context.Context, f *model.Finding, r *model.Recommend, lang string) (string, error)
	AskAISummaryStreamFromFinding(
		ctx context.Context,
		f *model.Finding,
		r *model.Recommend,
		lang string,
		stream finding.FindingService_GetAISummaryStreamServer,
	) error
}

func NewAIClient

func NewAIClient(token, model string, logger logging.Logger) AIService

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL