Skip to content

Commit 01c320c

Browse files
committed
Don't override image when using rag if user specified it
Fixes: #1713 Signed-off-by: Daniel J Walsh <[email protected]>
1 parent 55dc5e4 commit 01c320c

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

ramalama/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def get_container_name(self, args):
258258
def base(self, args, name):
259259
# force accel_image to use -rag version. Drop TAG if it exists
260260
# so that accel_image will add -rag to the image specification.
261-
if args.image == self.default_image and getattr(args, "rag", None):
261+
if getattr(args, "rag", None) and not getattr(args, "image_override", True):
262262
args.image = rag_image(args.image)
263263
self.engine = Engine(args)
264264
if args.subcommand == "run" and not getattr(args, "ARGS", None) and sys.stdin.isatty():

ramalama/rag.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ def generate(self, args):
114114

115115
self.engine.add(["-e", f"{k}={v}"])
116116

117-
self.engine.add([rag_image(args.image)])
117+
image = args.image if getattr(args, "image_override", False) else rag_image(args.image)
118+
self.engine.add([image])
118119
self.engine.add(["doc2rag", "--format", args.format, "/output", INPUT_DIR])
119120
if args.ocr:
120121
self.engine.add(["--ocr"])

test/system/070-rag.bats

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ load helpers
5151
RAMALAMA_CONFIG=/dev/null run_ramalama --dryrun run --rag quay.io/ramalama/myrag:1.2 ollama://smollm:135m
5252
is "$output" ".*--pull newer.*" "Expected to use --pull newer"
5353
fi
54+
run_ramalama --image quay.io/ramalama/bogus --dryrun run --rag quay.io/ramalama/myrag:1.2 ollama://smollm:135m
55+
assert "$output" !~ ".*quay.io/ramalama/bogus-rag.*" "Expected to not use -rag image"
5456

5557
run_ramalama info
5658
engine=$(echo "$output" | jq --raw-output '.Engine.Name')

0 commit comments

Comments
 (0)