-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding the initial changes to integrate with llm to mark items
- Loading branch information
Showing
10 changed files
with
112 additions
and
24 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/purchase_listinator/modules/shopping/adapters/in/llm.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(ns purchase-listinator.modules.shopping.adapters.in.llm | ||
(:require | ||
[clojure.data.json :as json] | ||
[schema.core :as s] | ||
[purchase-listinator.modules.shopping.schemas.wires.in.llm :as shopping.schemas.wires.in.llm])) | ||
|
||
(s/defn wire->model :- [s/Uuid] | ||
[wire :- shopping.schemas.wires.in.llm/InteractionResponse] | ||
(when wire | ||
(-> (:response wire) | ||
(json/read-str)))) |
19 changes: 19 additions & 0 deletions
19
src/purchase_listinator/modules/shopping/adapters/out/llm.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(ns purchase-listinator.modules.shopping.adapters.out.llm | ||
(:require | ||
[purchase-listinator.modules.shopping.schemas.models.shopping-list :as models.internal.shopping-list] | ||
[purchase-listinator.modules.shopping.schemas.wires.out.llm :as shopping.schemas.wires.out.llm] | ||
[schema.core :as s])) | ||
|
||
(s/defn ^:private get-items-names+id :- [shopping.schemas.wires.out.llm/ProductIdentification] | ||
[{:keys [categories]} :- models.internal.shopping-list/ShoppingList] | ||
(->> (mapcat :items categories) | ||
(map #(select-keys % [:id :name])))) | ||
|
||
(s/defn ->wire-mark-shopping :- shopping.schemas.wires.out.llm/InteractionRequest | ||
[request-id :- s/Uuid | ||
shopping :- models.internal.shopping-list/ShoppingList | ||
image :- s/Str] | ||
{:request-id request-id | ||
:prompt-name "mark_shopping_items" | ||
:variables {:products (get-items-names+id shopping)} | ||
:images [image]}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/purchase_listinator/modules/shopping/schemas/wires/in/llm.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(ns purchase-listinator.modules.shopping.schemas.wires.in.llm | ||
(:require [schema.core :as s])) | ||
|
||
(s/defschema InteractionResponse | ||
{:request-id s/Uuid | ||
:response (s/maybe s/Str) | ||
:status s/Str | ||
:details s/Str}) |
12 changes: 12 additions & 0 deletions
12
src/purchase_listinator/modules/shopping/schemas/wires/out/llm.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(ns purchase-listinator.modules.shopping.schemas.wires.out.llm | ||
(:require [schema.core :as s])) | ||
|
||
(s/defschema ProductIdentification | ||
{:id s/Uuid | ||
:name s/Str}) | ||
|
||
(s/defschema InteractionRequest | ||
{:request-id s/Uuid | ||
:prompt-name s/Str | ||
:variables {:products [ProductIdentification]} | ||
:images [s/Str]}) |