Documentation
¶
Index ¶
Constants ¶
View Source
const ( // 2024_08 version is performing better than 2024_11 for dockershrink OpenAIPreferredModel = openai.ChatModelGPT4o2024_08_06 MaxLLMCalls = 5 )
View Source
const ( ToolReadFiles = "read_files" ToolDeveloperFeedback = "developer_feedback" )
View Source
const GenerateRequestSystemPrompt = `` /* 4391-byte string literal not displayed */
View Source
const GenerateRequestUserPrompt = `` /* 170-byte string literal not displayed */
TODO: extract nodejs version from package*.json and supply it in the "generate" user prompt
View Source
const InvalidDockerfileInResponsePrompt = `` /* 148-byte string literal not displayed */
View Source
const OptimizeRequestSystemPrompt = `` /* 8845-byte string literal not displayed */
View Source
const OptimizeRequestUserPrompt = `` /* 247-byte string literal not displayed */
View Source
const RequestedFileNotFoundPrompt = `` /* 128-byte string literal not displayed */
View Source
const RuleMultistageBuildsPrompt = `` /* 4632-byte string literal not displayed */
View Source
const ToolReadFilesNoFilesSpecifiedPrompt = "No files were specified for the function, so I have nothing to return to you."
View Source
const ToolReadFilesResponseSingleFilePrompt = `{{ .Filepath }}
{{ .TripleBackticks }}
{{ .Content }}
{{ .TripleBackticks }}
`
Variables ¶
This section is empty.
Functions ¶
func GenerateSchema ¶
func GenerateSchema[T any]() interface{}
Types ¶
type AIService ¶
func (*AIService) GenerateDockerfile ¶
func (ai *AIService) GenerateDockerfile(req *GenerateRequest) (string, error)
func (*AIService) OptimizeDockerfile ¶
func (ai *AIService) OptimizeDockerfile(req *OptimizeRequest) (*OptimizeResponse, error)
OptimizeDockerfile optimizes the given Dockerfile using OpenAI GPT-4o It returns the optimized Dockerfile along with the actions taken and recommendations for further optimization.
type GenerateRequest ¶
type GenerateRequest struct {
PackageJSON string
ProjectDirectory *restrictedfilesystem.RestrictedFilesystem
}
type GenerateResponse ¶
type OptimizeRequest ¶
type OptimizeRequest struct {
Dockerfile string
Dockerignore string
PackageJSON string
DockerfileStageCount uint
ProjectDirectory *restrictedfilesystem.RestrictedFilesystem
}
type OptimizeResponse ¶
type OptimizeResponse struct {
Dockerfile string `json:"dockerfile" jsonschema_description:"The optimized Dockerfile"`
Recommendations []*models.OptimizationAction `json:"recommendations" jsonschema_description:"List of Recommendations for further the Dockerfile or whole project"`
ActionsTaken []*models.OptimizationAction `json:"actions_taken" jsonschema_description:"List of modifictions made in the Dockerfile"`
}
Click to show internal directories.
Click to hide internal directories.