Skip to content

Commit 3d0927b

Browse files
committed
better empty result handling
1 parent f989fb4 commit 3d0927b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

db/sql/04-find_samples.sql

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,13 @@ if (@response is null) begin
8080
end
8181

8282
--select @samples;
83-
exec @retval = [web].[generate_answer] @text, @samples, @response output;
84-
if (@retval != 0) return;
83+
if (@samples is not null) begin
84+
exec @retval = [web].[generate_answer] @text, @samples, @response output;
85+
if (@retval != 0) return;
86+
end else begin
87+
set @samples = '[]'
88+
set @response = '{}'
89+
end
8590

8691
/* Cache results */
8792
insert into dbo.semantic_cache (query, [action], samples, embedding, query_date, response)

0 commit comments

Comments
 (0)