Skip to content

Commit ac9bcad

Browse files
committed
refactor: move passthrough logic to separate module
This is a temporary implementatoin for backward compatibility
1 parent 0383765 commit ac9bcad

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

nemoguardrails/colang/v2_x/library/llm.co

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@ flow bot say something like $text
1313
await bot say $variation
1414

1515

16-
flow bot response to user prompt
17-
"""Just make a call to LLM in passthrough mode"""
18-
19-
activate polling llm request response
20-
await _user_said_something_unexpected as $user_said
21-
$event = $user_said.event
22-
23-
log 'unexpected user utterance: "{$event.final_transcript}"'
24-
25-
$user_message = $event.final_transcript
26-
27-
log 'start generating bot response in passthrough mode...'
28-
$bot_message = await PassthroughLLMAction(user_message=$user_message)
29-
bot say $bot_message
30-
3116
# -----------------------------------
3217
# LLM Utilities
3318
# -----------------------------------
@@ -53,16 +38,10 @@ flow polling llm request response $interval=1.0
5338

5439
flow llm continuation
5540
"""Activate all LLM based interaction continuations."""
56-
# workaround to prioritizethis flow
57-
if $system.config.passthrough
58-
activate automating intent detection
59-
activate generating user intent for unhandled user utterance
60-
activate bot response to user prompt
61-
else
62-
activate automating intent detection
63-
activate generating user intent for unhandled user utterance
64-
activate continuation on unhandled user intent
65-
activate continuation on undefined flow
41+
activate automating intent detection
42+
activate generating user intent for unhandled user utterance
43+
activate continuation on unhandled user intent
44+
activate continuation on undefined flow
6645

6746

6847
flow generating user intent for unhandled user utterance
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
import llm
3+
4+
flow responding to raw user message $user_message
5+
"""Just make a call to LLM in passthrough mode"""
6+
7+
activate polling llm request response
8+
await _user_said_something_unexpected as $user_said
9+
$event = $user_said.event
10+
11+
log 'unexpected user utterance: "{$event.final_transcript}"'
12+
13+
$user_message = $event.final_transcript
14+
15+
log 'start generating bot response in passthrough mode...'
16+
$bot_message = await PassthroughLLMAction(user_message=$user_message)
17+
bot say $bot_message
18+
19+
@override
20+
flow llm continuation
21+
activate automating intent detection
22+
activate generating user intent for unhandled user utterance
23+
activate responding to raw user message

0 commit comments

Comments
 (0)