Skip to content

Commit 86adfaf

Browse files
committed
Fix scenario example
1 parent 9b0c0b3 commit 86adfaf

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

examples/src/voice_fn_examples/scenario_example.clj

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
[clojure.core.async.flow :as flow]
55
[taoensso.telemere :as t]
66
[voice-fn-examples.local :as local]
7-
[voice-fn.processors.groq :as groq]
8-
[voice-fn.scenario-manager :as sm]
9-
[voice-fn.secrets :refer [secret]]))
7+
[voice-fn.scenario-manager :as sm]))
108

119
(def scenario-config
1210
{:initial-node :start
@@ -66,36 +64,32 @@
6664
degrades when it has a big complex prompt to enact, so to ensure a consistent
6765
output use scenarios that transition the LLM into a new scenario node with a clear
6866
instruction for the current node."
69-
[]
70-
(let [flow (local/make-local-flow
71-
{;; Don't add any context because the scenario will handle that
72-
:llm/context {:messages []
73-
:tools []}
74-
;; add gateway process for scenario to inject frames
75-
:extra-procs {:scenario {:proc (flow/process #'sm/scenario-in-process)}
76-
77-
;; Use groq instead of openai
78-
:llm {:proc groq/groq-llm-process
79-
:args {:api-key (secret [:groq :api-key])
80-
:model "llama-3.3-70b-versatile"}}
67+
([]
68+
(scenario-example {:initial-node :start}))
69+
([{:keys [initial-node]}]
70+
(let [flow (local/make-local-flow
71+
{;; Don't add any context because the scenario will handle that
72+
:llm/context {:messages []
73+
:tools []}
74+
:language :ro
8175

82-
;; Groq has a different tool result format than openai
83-
:context-aggregator {:args {:llm/tool-result-adapter groq/tool-result-adapter}}}
76+
;; add gateway process for scenario to inject frames
77+
:extra-procs {:scenario {:proc (flow/process #'sm/scenario-in-process)}}
8478

8579
:extra-conns [[[:scenario :speak-out] [:tts :in]]
8680
[[:scenario :context-out] [:context-aggregator :in]]]})
8781

8882
s (sm/scenario-manager {:flow flow
8983
:flow-in-coord [:scenario :scenario-in] ;; scenario-manager will inject frames through this channel
90-
:scenario-config scenario})]
84+
:scenario-config (assoc scenario-config :initial-node initial-node)})]
9185

9286
{:flow flow
9387
:scenario s})))
9488

9589
(comment
9690

9791
;; create flow & scenario
98-
(def s (scenario-example))
92+
(def s (scenario-example {:initial-node :start}))
9993

10094
;; Start local ai flow - starts paused
10195
(let [{:keys [report-chan error-chan]} (flow/start (:flow s))]

0 commit comments

Comments
 (0)