Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertSchema[T any](output string, schema T) (*T, error)
- func GetFindingDataTool() responses.ToolUnionParam
- type AIClient
- func (a *AIClient) AskAISummaryFromFinding(ctx context.Context, f *model.Finding, r *model.Recommend, lang string) (string, error)
- func (a *AIClient) AskAISummaryStreamFromFinding(ctx context.Context, f *model.Finding, r *model.Recommend, lang string, ...) error
- func (a *AIClient) ChatAI(ctx context.Context, req *ai.ChatAIRequest) (*ai.ChatAIResponse, error)
- func (a *AIClient) GenerateReport(ctx context.Context, req *ai.GenerateReportRequest) (*ai.GenerateReportResponse, error)
- func (a *AIClient) GetFindingDataFunction(ctx context.Context, params GetFindingDataParams) ([]map[string]any, error)
- type AIService
- type FunctionCallInfo
- type GenerateSQLOutput
- type GetFindingDataParams
- type StreamSender
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" )
View Source
const MAX_TOOL_USE_COUNT = 30
View Source
const (
REPORT_PROMPT = `` /* 2528-byte string literal not displayed */
)
View Source
const TOOL_GENERATE_SQL_INSTRUCTION = `` /* 2331-byte string literal not displayed */
Variables ¶
View Source
var DefaultTools = []responses.ToolUnionParam{ { OfWebSearchPreview: &responses.WebSearchToolParam{ Type: responses.WebSearchToolTypeWebSearchPreview, SearchContextSize: responses.WebSearchToolSearchContextSizeMedium, }, }, }
Functions ¶
func ConvertSchema ¶ added in v0.16.0
ConvertSchema
func GetFindingDataTool ¶ added in v0.16.0
func GetFindingDataTool() responses.ToolUnionParam
GetFindingDataTool returns the get_finding_data function tool definition
Types ¶
type AIClient ¶
type AIClient struct {
// contains filtered or unexported fields
}
func (*AIClient) AskAISummaryFromFinding ¶
func (*AIClient) AskAISummaryStreamFromFinding ¶ added in v0.10.0
func (*AIClient) ChatAI ¶ added in v0.15.0
func (a *AIClient) ChatAI(ctx context.Context, req *ai.ChatAIRequest) (*ai.ChatAIResponse, error)
func (*AIClient) GenerateReport ¶ added in v0.16.0
func (a *AIClient) GenerateReport(ctx context.Context, req *ai.GenerateReportRequest) (*ai.GenerateReportResponse, error)
func (*AIClient) GetFindingDataFunction ¶ added in v0.16.0
func (a *AIClient) GetFindingDataFunction(ctx context.Context, params GetFindingDataParams) ([]map[string]any, error)
GetFindingDataFunction handles the get_finding_data function call
type AIService ¶
type AIService interface {
ChatAI(ctx context.Context, req *ai.ChatAIRequest) (*ai.ChatAIResponse, error)
GenerateReport(ctx context.Context, req *ai.GenerateReportRequest) (*ai.GenerateReportResponse, 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 ¶
type FunctionCallInfo ¶ added in v0.16.0
FunctionCallInfo represents a function call extracted from response
type GenerateSQLOutput ¶ added in v0.16.0
type GenerateSQLOutput struct {
SQL string `json:"sql"`
}
type GetFindingDataParams ¶ added in v0.16.0
type GetFindingDataParams struct {
ProjectID uint32 `json:"project_id"`
Prompt string `json:"prompt"`
Limit uint32 `json:"limit"`
Offset uint32 `json:"offset"`
}
GetFindingDataParams represents the parameters for get_finding_data function
type StreamSender ¶ added in v0.16.0
StreamSender is a generic interface for sending data in a stream
Source Files
¶
Click to show internal directories.
Click to hide internal directories.