llm

package
v1.31.12 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 16 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithHTTPClient

func WithHTTPClient(httpClientFunc func() http.HTTPClient) func(*DeepCodeLLMBindingImpl)

func WithInstrumentor

func WithInstrumentor(instrumentor observability.Instrumentor) func(*DeepCodeLLMBindingImpl)

func WithLogger

func WithLogger(logger *zerolog.Logger) func(*DeepCodeLLMBindingImpl)

func WithOutputFormat

func WithOutputFormat(outputFormat OutputFormat) func(*DeepCodeLLMBindingImpl)

Types

type AutofixEventDetails added in v1.21.4

type AutofixEventDetails struct {
	FixId string `json:"fixId"`
}

type AutofixFeedbackOptions added in v1.21.4

type AutofixFeedbackOptions struct {
	FixID  string
	Result string

	Host                string
	CodeRequestContext  CodeRequestContext
	IdeExtensionDetails AutofixIdeExtensionDetails
}

type AutofixIdeExtensionDetails added in v1.21.4

type AutofixIdeExtensionDetails struct {
	IdeName          string `json:"ideName"`
	IdeVersion       string `json:"ideVersion"`
	ExtensionName    string `json:"extensionName"`
	ExtensionVersion string `json:"extensionVersion"`
}

type AutofixOptions added in v1.21.4

type AutofixOptions struct {
	RuleID     string
	BundleHash string
	ShardKey   string
	BaseDir    string
	FilePath   string
	LineNum    int

	Host                string
	CodeRequestContext  CodeRequestContext
	IdeExtensionDetails AutofixIdeExtensionDetails
}

type AutofixRequest added in v1.21.4

type AutofixRequest struct {
	Key                 AutofixRequestKey          `json:"key"`
	AnalysisContext     CodeRequestContext         `json:"analysisContext"`
	IdeExtensionDetails AutofixIdeExtensionDetails `json:"ideExtensionDetails"`
}

type AutofixRequestKey added in v1.21.4

type AutofixRequestKey struct {
	Type     string `json:"type"`
	Hash     string `json:"hash"`
	Shard    string `json:"shard"`
	FilePath string `json:"filePath"`
	RuleId   string `json:"ruleId"`
	// 1-based to comply with Sarif and Code API, see
	// https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html#_Ref493492556
	LineNum int `json:"lineNum"`
}

type AutofixResponse added in v1.21.4

type AutofixResponse struct {
	Status             string                     `json:"status"`
	AutofixSuggestions []autofixResponseSingleFix `json:"fixes"`
}

AutofixResponse is the json-based structure to which we can translate the results of the HTTP request to Autofix upstream.

type AutofixStatus added in v1.21.4

type AutofixStatus struct {
	Message string
}

type AutofixUnifiedDiffSuggestion added in v1.21.4

type AutofixUnifiedDiffSuggestion struct {
	FixId               string            `json:"fixId"`
	UnifiedDiffsPerFile map[string]string `json:"unifiedDiffsPerFile"`
	FullTextPerFile     map[string]string `json:"fullTextPerFile"`
	Explanation         string            `json:"explanation"`
}

AutofixUnifiedDiffSuggestion represents the diff between the original and the fixed source code.

type AutofixUserEvent added in v1.21.4

type AutofixUserEvent struct {
	AnalysisContext     CodeRequestContext         `json:"analysisContext"`
	Channel             string                     `json:"channel"`
	EventType           string                     `json:"eventType"`
	EventDetails        AutofixEventDetails        `json:"eventDetails"`
	IdeExtensionDetails AutofixIdeExtensionDetails `json:"ideExtensionDetails"`
}

type CodeRequestContext added in v1.21.4

type CodeRequestContext struct {
	Initiator string                `json:"initiator"`
	Flow      string                `json:"flow,omitempty"`
	Org       CodeRequestContextOrg `json:"org,omitempty"`
}

type CodeRequestContextOrg added in v1.21.4

type CodeRequestContextOrg struct {
	Name        string          `json:"name"`
	DisplayName string          `json:"displayName"`
	PublicId    string          `json:"publicId"`
	Flags       map[string]bool `json:"flags"`
}

type DeepCodeLLMBinding

type DeepCodeLLMBinding interface {
	GetAutofixDiffs(ctx context.Context, baseDir string, options AutofixOptions) (unifiedDiffSuggestions []AutofixUnifiedDiffSuggestion, status AutofixStatus, err error)
	SubmitAutofixFeedback(ctx context.Context, requestId string, options AutofixFeedbackOptions) error
}

type DeepCodeLLMBindingImpl added in v1.14.1

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

DeepCodeLLMBindingImpl is an LLM binding for the Snyk Code LLM.

func NewDeepcodeLLMBinding

func NewDeepcodeLLMBinding(opts ...Option) *DeepCodeLLMBindingImpl

func (*DeepCodeLLMBindingImpl) GetAutofixDiffs added in v1.21.4

func (d *DeepCodeLLMBindingImpl) GetAutofixDiffs(ctx context.Context, _ string, options AutofixOptions) (unifiedDiffSuggestions []AutofixUnifiedDiffSuggestion, status AutofixStatus, err error)

func (*DeepCodeLLMBindingImpl) SubmitAutofixFeedback added in v1.21.4

func (d *DeepCodeLLMBindingImpl) SubmitAutofixFeedback(ctx context.Context, fixId string, options AutofixFeedbackOptions) error

type Option

type Option func(*DeepCodeLLMBindingImpl)

type OutputFormat

type OutputFormat string
const HTML OutputFormat = "html"
const JSON OutputFormat = "json"
const MarkDown OutputFormat = "md"

Jump to

Keyboard shortcuts

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