Skip to content

Commit f347e9c

Browse files
committed
removed LLM
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
1 parent 7a14c70 commit f347e9c

File tree

13 files changed

+72
-1127
lines changed

13 files changed

+72
-1127
lines changed

cmd/assist.go

Lines changed: 18 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -18,108 +18,22 @@ import (
1818
func NewAssistCommand() *cobra.Command {
1919
var command = &cobra.Command{
2020
Use: "assist",
21-
Short: "Assist-AI related utilities",
22-
Long: `Assist-AI related utilities for container runtime environments
21+
Short: "AI-powered chaos engineering assistance",
22+
Long: `AI-powered chaos engineering assistance for krknctl
2323
2424
Available Commands:
25-
check Check GPU support in container runtime
2625
run Run AI-powered chaos engineering assistance
2726
28-
GPU Auto-Detection:
29-
Lightspeed automatically detects your GPU type! No manual flags needed.
30-
31-
Supported GPU Types:
32-
• Apple Silicon (M1, M2, M3, M4 with Metal)
33-
• NVIDIA GPUs (CUDA, GeForce, Quadro, Tesla)
34-
35-
Future support planned:
36-
• AMD GPUs (Radeon, FirePro, Instinct with ROCm)
37-
• Intel GPUs (Arc, Iris, UHD Graphics)
27+
The assist service uses a lightweight AI model with FAISS vector search
28+
to provide intelligent command suggestions and documentation search.
3829
3930
Examples:
40-
krknctl assist check
41-
krknctl assist run
42-
krknctl assist run --no-gpu`,
31+
krknctl assist run`,
4332
}
4433

45-
// GPU auto-detection - no manual flags needed anymore!
46-
47-
// Add no-gpu flag for CPU-only mode
48-
command.PersistentFlags().Bool("no-gpu", false, "Use CPU-only mode (no GPU acceleration)")
49-
5034
return command
5135
}
5236

53-
// GPU auto-detection - no manual flag parsing needed anymore!
54-
55-
func NewAssistCheckCommand(
56-
providerFactory *factory.ProviderFactory,
57-
scenarioOrchestrator *scenarioorchestrator.ScenarioOrchestrator,
58-
config config.Config,
59-
) *cobra.Command {
60-
var command = &cobra.Command{
61-
Use: "check",
62-
Short: "Check GPU support in container runtime",
63-
Long: `Check whether the container runtime (Podman or Docker) has GPU support available
64-
65-
Lightspeed automatically tests all supported GPU types to detect your hardware.
66-
67-
Examples:
68-
krknctl assist check`,
69-
Args: cobra.NoArgs,
70-
RunE: func(cmd *cobra.Command, args []string) error {
71-
// Print container runtime info
72-
(*scenarioOrchestrator).PrintContainerRuntime()
73-
74-
// Check if Docker is being used - Lightspeed only supports Podman
75-
if (*scenarioOrchestrator).GetContainerRuntime() == orchestratormodels.Docker {
76-
return fmt.Errorf("❌ Assist requires Podman container runtime. " +
77-
"Docker is not supported for GPU acceleration")
78-
}
79-
80-
// Get container runtime socket
81-
socket, err := (*scenarioOrchestrator).GetContainerRuntimeSocket(nil)
82-
if err != nil {
83-
return fmt.Errorf("failed to get container runtime socket: %w", err)
84-
}
85-
86-
// Connect to container runtime
87-
ctx, err := (*scenarioOrchestrator).Connect(*socket)
88-
if err != nil {
89-
return fmt.Errorf("failed to connect to container runtime: %w", err)
90-
}
91-
92-
// Get no-gpu flag
93-
noGPU, _ := cmd.Flags().GetBool("no-gpu")
94-
95-
// Create platform GPU detector
96-
detector := assist.NewPlatformGPUDetector(config)
97-
98-
// Auto-detect GPU acceleration
99-
fmt.Println("\n🔍 Detecting GPU acceleration...")
100-
gpuType := detector.DetectGPUAcceleration(ctx, noGPU)
101-
102-
// Get configuration
103-
imageURI, _, deviceMounts, err := detector.AutoSelectAssistConfig(ctx, noGPU)
104-
if err != nil {
105-
return fmt.Errorf("failed to get assist configuration: %w", err)
106-
}
107-
108-
// Format and print result
109-
fmt.Printf("\n✅ GPU acceleration: %s\n", detector.GetGPUDescription(gpuType))
110-
fmt.Printf("📦 Container image: %s\n", imageURI)
111-
if len(deviceMounts) > 0 {
112-
fmt.Printf("🔗 Device mounts: %v\n", deviceMounts)
113-
} else {
114-
fmt.Printf("🔗 Device mounts: none (CPU-only)\n")
115-
}
116-
117-
return nil
118-
},
119-
}
120-
121-
return command
122-
}
12337

12438
// buildAssistRegistryFromFlags builds assist registry configuration from command flags
12539
func buildAssistRegistryFromFlags(cmd *cobra.Command, config config.Config) (*models.RegistryV2, error) {
@@ -167,31 +81,24 @@ func NewAssistRunCommand(
16781
Short: "Run AI-powered chaos engineering assistance",
16882
Long: `Run AI-powered chaos engineering assistance with Retrieval-Augmented Generation (RAG)
16983
170-
This command automatically detects your GPU and deploys a lightweight AI model that can answer
171-
questions about krknctl usage, chaos engineering scenarios, and provide intelligent command
172-
suggestions based on natural language.
84+
This command deploys a lightweight AI model that can answer questions about krknctl usage,
85+
chaos engineering scenarios, and provide intelligent command suggestions based on natural language.
17386
17487
The system uses:
175-
- Automatic GPU detection (Apple Silicon, NVIDIA)
176-
- GPU-accelerated inference for fast responses
88+
- FAISS vector search for fast document retrieval
17789
- Live documentation indexing
178-
- Llama 3.2:1B model optimized for chaos engineering domain
90+
- Llama model optimized for chaos engineering domain
17991
18092
Examples:
181-
krknctl assist run # Auto-detect GPU
182-
krknctl assist run --no-gpu # Force CPU-only mode`,
93+
krknctl assist run`,
18394
Args: cobra.NoArgs,
18495
RunE: func(cmd *cobra.Command, args []string) error {
185-
// Get flags
186-
noGPU, _ := cmd.Flags().GetBool("no-gpu")
187-
18896
// Print container runtime info
18997
(*scenarioOrchestrator).PrintContainerRuntime()
19098

191-
// Check if Docker is being used - Lightspeed only supports Podman
99+
// Check if Docker is being used - assist requires Podman
192100
if (*scenarioOrchestrator).GetContainerRuntime() == orchestratormodels.Docker {
193-
return fmt.Errorf("❌ assist requires Podman container runtime. " +
194-
"Docker is not supported for GPU acceleration")
101+
return fmt.Errorf("❌ assist requires Podman container runtime")
195102
}
196103

197104
// Get container runtime socket
@@ -212,30 +119,19 @@ Examples:
212119
return fmt.Errorf("failed to build assist registry configuration: %w", err)
213120
}
214121

215-
// Step 1: Auto-detect GPU acceleration
216-
fmt.Println("🔍 detecting GPU acceleration...")
217-
218-
// Create platform GPU detector
219-
detector := assist.NewPlatformGPUDetector(config)
220-
gpuType := detector.DetectGPUAcceleration(ctx, noGPU)
221-
222-
fmt.Printf("✅ GPU acceleration: %s\n", detector.GetGPUDescription(gpuType))
223-
224-
// Step 2: Deploy RAG model container
225-
fmt.Println("\n🚀 deploying assist model...")
122+
// Deploy RAG model container
123+
fmt.Println("🚀 deploying assist model...")
226124

227125
// Create spinners for the operations
228126
pullSpinner := NewSpinnerWithSuffix(" pulling RAG model image...")
229127
thinkingSpinner := NewSpinnerWithSuffix(" thinking...", 37)
230128

231-
ragResult, err := assist.DeployAssistModelWithGPUType(ctx, gpuType, *scenarioOrchestrator, config, registry, detector, pullSpinner)
129+
ragResult, err := assist.DeployAssistModel(ctx, *scenarioOrchestrator, config, registry, pullSpinner)
232130
if err != nil {
233-
// Handle GPU-related errors with helpful suggestions
234-
enhancedErr := detector.HandleContainerError(err, gpuType)
235-
return fmt.Errorf("failed to deploy RAG model: %w", enhancedErr)
131+
return fmt.Errorf("failed to deploy RAG model: %w", err)
236132
}
237133

238-
// Step 3: Health check
134+
// Health check
239135
fmt.Println("\n🩺 performing health check...")
240136

241137
healthOK, err := assist.PerformAssistHealthCheck(ragResult.ContainerID, ragResult.HostPort, *scenarioOrchestrator, ctx, config)
@@ -249,7 +145,7 @@ Examples:
249145

250146
fmt.Println("✅ assist service is ready!")
251147

252-
// Step 4: Start interactive prompt
148+
// Start interactive prompt
253149
fmt.Printf("\n🚂 starting interactive assist service on port %s...\n",
254150
ragResult.HostPort)
255151
fmt.Println("type your chaos engineering questions and get intelligent krknctl" +

cmd/assist_test.go

Lines changed: 9 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cmd
33

44
import (
55
"context"
6-
"github.com/krkn-chaos/krknctl/pkg/assist"
76
"io"
87
"os"
98
"testing"
@@ -102,31 +101,8 @@ func TestNewAssistCommand(t *testing.T) {
102101

103102
assert.NotNil(t, cmd)
104103
assert.Equal(t, "assist", cmd.Use)
105-
assert.Contains(t, cmd.Short, "Assist-AI related utilities")
106-
assert.Contains(t, cmd.Long, "Assist-AI related utilities")
107-
108-
// Test that GPU auto-detection is enabled (no manual GPU flags needed)
109-
assert.NotNil(t, cmd.PersistentFlags().Lookup("no-gpu"))
110-
// Manual GPU flags should not exist (using auto-detection now)
111-
assert.Nil(t, cmd.PersistentFlags().Lookup("nvidia"))
112-
assert.Nil(t, cmd.PersistentFlags().Lookup("apple-silicon"))
113-
assert.Nil(t, cmd.PersistentFlags().Lookup("amd"))
114-
assert.Nil(t, cmd.PersistentFlags().Lookup("intel"))
115-
}
116-
117-
func TestNewAssistCheckCommand(t *testing.T) {
118-
config := getTestConfig(t)
119-
providerFactory := getTestProviderFactory(t)
120-
orchestrator := getTestOrchestrator(t)
121-
122-
cmd := NewAssistCheckCommand(providerFactory, &orchestrator, config)
123-
124-
assert.NotNil(t, cmd)
125-
assert.Equal(t, "check", cmd.Use)
126-
assert.Contains(t, cmd.Short, "Check GPU support")
127-
assert.Contains(t, cmd.Long, "Check whether the container runtime")
128-
assert.NotNil(t, cmd.Args)
129-
assert.NotNil(t, cmd.RunE)
104+
assert.Contains(t, cmd.Short, "AI-powered chaos engineering")
105+
assert.Contains(t, cmd.Long, "AI-powered chaos engineering")
130106
}
131107

132108
func TestBuildAssistRegistryFromFlags_NoPrivateRegistry(t *testing.T) {
@@ -148,28 +124,6 @@ func TestBuildAssistRegistryFromFlags_NoPrivateRegistry(t *testing.T) {
148124
assert.Nil(t, registry)
149125
}
150126

151-
func TestGPUAutoDetection(t *testing.T) {
152-
config := getTestConfig(t)
153-
detector := assist.NewPlatformGPUDetector(config)
154-
155-
// Test GPU detection types
156-
ctx := context.Background()
157-
158-
// Test with --no-gpu flag
159-
gpuType := detector.DetectGPUAcceleration(ctx, true)
160-
assert.Equal(t, assist.GPUAccelerationGeneric, gpuType)
161-
162-
// Test description generation
163-
description := detector.GetGPUDescription(assist.GPUAccelerationAppleSilicon)
164-
assert.Contains(t, description, "Apple Silicon")
165-
166-
description = detector.GetGPUDescription(assist.GPUAccelerationNVIDIA)
167-
assert.Contains(t, description, "NVIDIA")
168-
169-
description = detector.GetGPUDescription(assist.GPUAccelerationGeneric)
170-
assert.Contains(t, description, "CPU-only")
171-
}
172-
173127
// Test command creation and basic structure
174128
func TestAssistCommands_Structure(t *testing.T) {
175129
config := getTestConfig(t)
@@ -181,13 +135,13 @@ func TestAssistCommands_Structure(t *testing.T) {
181135
assert.NotNil(t, assistCmd)
182136
assert.Equal(t, "assist", assistCmd.Use)
183137

184-
// Test check command creation
185-
checkCmd := NewAssistCheckCommand(providerFactory, &orchestrator, config)
186-
assert.NotNil(t, checkCmd)
187-
assert.Equal(t, "check", checkCmd.Use)
188-
assert.NotNil(t, checkCmd.RunE)
138+
// Test run command creation
139+
runCmd := NewAssistRunCommand(providerFactory, &orchestrator, config)
140+
assert.NotNil(t, runCmd)
141+
assert.Equal(t, "run", runCmd.Use)
142+
assert.NotNil(t, runCmd.RunE)
189143

190-
// Add check command to assist
191-
assistCmd.AddCommand(checkCmd)
144+
// Add run command to assist
145+
assistCmd.AddCommand(runCmd)
192146
assert.Equal(t, 1, len(assistCmd.Commands()))
193147
}

cmd/root.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ func Execute(providerFactory *factory.ProviderFactory, scenarioOrchestrator *sce
117117

118118
// assist subcommands
119119
assistCmd := NewAssistCommand()
120-
assistCheckCmd := NewAssistCheckCommand(providerFactory, scenarioOrchestrator, config)
121120
assistRunCmd := NewAssistRunCommand(providerFactory, scenarioOrchestrator, config)
122-
assistCmd.AddCommand(assistCheckCmd)
123121
assistCmd.AddCommand(assistRunCmd)
124122
rootCmd.AddCommand(assistCmd)
125123

0 commit comments

Comments
 (0)