|
4 | 4 | [clojure.core.async.flow :as flow]
|
5 | 5 | [taoensso.telemere :as t]
|
6 | 6 | [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])) |
10 | 8 |
|
11 | 9 | (def scenario-config
|
12 | 10 | {:initial-node :start
|
|
66 | 64 | degrades when it has a big complex prompt to enact, so to ensure a consistent
|
67 | 65 | output use scenarios that transition the LLM into a new scenario node with a clear
|
68 | 66 | 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 |
81 | 75 |
|
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)}} |
84 | 78 |
|
85 | 79 | :extra-conns [[[:scenario :speak-out] [:tts :in]]
|
86 | 80 | [[:scenario :context-out] [:context-aggregator :in]]]})
|
87 | 81 |
|
88 | 82 | s (sm/scenario-manager {:flow flow
|
89 | 83 | :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)})] |
91 | 85 |
|
92 | 86 | {:flow flow
|
93 | 87 | :scenario s})))
|
94 | 88 |
|
95 | 89 | (comment
|
96 | 90 |
|
97 | 91 | ;; create flow & scenario
|
98 |
| - (def s (scenario-example)) |
| 92 | + (def s (scenario-example {:initial-node :start})) |
99 | 93 |
|
100 | 94 | ;; Start local ai flow - starts paused
|
101 | 95 | (let [{:keys [report-chan error-chan]} (flow/start (:flow s))]
|
|
0 commit comments