Skip to content

Commit 088882a

Browse files
Switch query check sub-graph to use first and last messages
1 parent 6c368ec commit 088882a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

prompts/sql/query-check.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tools:
1414
container:
1515
image: vonwig/sqlite:latest
1616
command:
17-
- "./Chinook.db"
17+
- "{{database}}"
1818
- "{{sql}}"
1919
tool_choice: required
2020
---

src/graphs/sql.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
{:init-state
103103
[(state/messages-reset)
104104
(state/messages-from-prompt "prompts/sql/query-check.md")
105+
(state/messages-take 1)
105106
(state/messages-take-last 1)]
106107
:construct-graph graph/generate-one-tool-call
107108
:next-state state/append-new-messages})]

src/state.clj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@
9393
(-> state
9494
(update-in [:messages] (fnil concat []) (take-last n (:messages orig))))))
9595

96+
(defn messages-take [n]
97+
(fn [orig state]
98+
(-> state
99+
(update-in [:messages] (fnil concat []) (take n (:messages orig))))))
100+
96101
(defn messages-append [coll]
97102
(fn [_ state]
98103
(-> state

0 commit comments

Comments
 (0)