-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.json
244 lines (244 loc) · 7.9 KB
/
schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
{
"$schema": "https://schema.takeshape.io/project-schema",
"defaultLocale": "en-us",
"locales": [
"en-us"
],
"queries": {
"getRelatedProductList": {
"shape": "PaginatedList<shopify:Product>",
"resolver": {
"compose": [
{
"name": "ai:createEmbedding",
"id": "createEmbedding",
"service": "openai",
"model": "text-embedding-3-small",
"args": {
"ops": [{"path": "input", "mapping": "$args.text"}]
}
},
{
"shapeName": "Shopify_Product",
"name": "takeshape:vectorSearch",
"service": "takeshape",
"args": {
"ops": [
{"path": "vector.name", "value": "vector"},
{
"path": "vector.value",
"mapping": "$resolvers.createEmbedding"
},
{"path": "size", "mapping": "$args.size"}
]
}
}
]
},
"args": {
"type": "object",
"properties": {
"text": {"type": "string"},
"size": {"type": "integer"}
},
"required": ["text"]
}
},
"getIndexedShopifyProductList": {
"shape": "PaginatedList<Shopify_Product>",
"resolver": {
"shapeName": "Shopify_Product",
"name": "takeshape:queryApiIndex",
"service": "takeshape",
"options": {"indexedShape": "Shopify_Product"}
},
"description": "Fetch Shopify_Product data from the API Index.",
"args": "TSListArgs<Shopify_Product>"
},
"Shopify_products": {
"resolver": {
"name": "graphql:query",
"service": "shopify",
"fieldName": "products"
},
"args": {
"type": "object",
"properties": {
"first": {
"type": "integer",
"description": "Returns up to the first `n` elements from the list."
},
"after": {
"type": "string",
"description": "Returns the elements that come after the specified cursor."
},
"last": {
"type": "integer",
"description": "Returns up to the last `n` elements from the list."
},
"before": {
"type": "string",
"description": "Returns the elements that come before the specified cursor."
},
"reverse": {
"type": "boolean",
"description": "Reverse the order of the underlying list.",
"default": false
},
"sortKey": {
"@ref": "shopify:ProductSortKeys",
"description": "Sort the underlying list by the given key.",
"default": "ID"
},
"query": {
"type": "string",
"description": "Apply one or multiple filters to the query.\n| name | description | acceptable_values | default_value | example_use |\n| ---- | ---- | ---- | ---- | ---- |\n| barcode |\n| bundles |\n| created_at |\n| delivery_profile_id |\n| error_feedback |\n| gift_card |\n| has_only_composites |\n| has_only_default_variant |\n| has_variant_with_components |\n| id |\n| inventory_total |\n| is_price_reduced |\n| out_of_stock_somewhere |\n| price |\n| product_configuration_owner |\n| product_publication_status |\n| product_type |\n| publishable_status |\n| published_status |\n| sku |\n| status |\n| tag |\n| tag_not |\n| title |\n| updated_at |\n| vendor |\nRefer to the detailed [search syntax](https://shopify.dev/api/usage/search-syntax) for more information about using filters."
},
"savedSearchId": {
"type": "string",
"@tag": "id",
"description": "The ID of an existing saved search.\nThe search’s query string is used as the query argument.\nRefer to [SavedSearch](https://shopify.dev/api/admin-graphql/latest/objects/savedsearch)."
}
}
},
"shape": "Shopify_ProductConnection"
},
"Shopify_product": {
"resolver": {
"name": "graphql:query",
"service": "shopify",
"fieldName": "product"
},
"args": {
"type": "object",
"properties": {
"id": {
"type": "string",
"@tag": "id",
"description": "The ID of the Product to return."
}
},
"required": ["id"]
},
"shape": "Shopify_Product"
}
},
"mutations": {
"chat": {
"shape": "TSChatResponse",
"args": "TSChatArgs",
"resolver": {
"compose": [
{
"name": "delegate",
"id": "getRelatedProductList",
"to": "Query.getRelatedProductList",
"options": {"selectionSet": "{ items {title description} }"},
"args": {
"ops": [
{"path": "text", "mapping": "$args.input"},
{"path": "size", "value": "1"}
]
},
"results": {
"ops": [{"path": "$", "mapping": "$currentResolver.items[0]"}]
}
},
{
"name": "ai:generateText",
"service": "openai",
"model": "gpt-3.5-turbo",
"systemPrompt": "You are a helpful assistant.",
"inputTemplate": "Answer the following question:\n{$args.input} \n\nby using the following text:\n{$resultsById.getRelatedProductList.title} {$resultsById.getRelatedProductList.description}"
}
]
}
}
},
"shapes": {
"Shopify_Product": {
"id": "Shopify_Product",
"name": "Shopify_Product",
"title": "Shopify Product",
"cache": {
"enabled": true,
"triggers": [
{"type": "schedule", "loader": "list", "interval": 1440},
{
"type": "webhook",
"loader": "get",
"service": "shopify",
"events": ["products/create", "products/update", "products/delete"]
}
],
"fragment": {"maxDepth": 2}
},
"loaders": {
"list": {"query": "shopify:Query.products"},
"get": {"query": "shopify:Query.product"}
},
"schema": {
"extends": [
{"@ref": "shopify:Product"},
{
"type": "object",
"properties": {
"vector": {
"type": "array",
"items": {"type": "number"},
"title": "Vector",
"@tag": "vector",
"@dependencies": "{title description}",
"@resolver": {
"name": "ai:createEmbedding",
"service": "openai",
"model": "text-embedding-3-small",
"options": {"useDependencies": true}
}
}
}
}
]
},
"interfaces": [
"shopify:HasMetafieldDefinitions",
"shopify:HasMetafields",
"shopify:HasPublishedTranslations",
"shopify:LegacyInteroperability",
"shopify:Navigable",
"shopify:Node",
"shopify:OnlineStorePreviewable",
"shopify:Publishable"
]
}
},
"workflows": {},
"forms": {},
"schemaVersion": "3.44.0",
"apiVersion": "2",
"services": {
"openai": {
"id": "openai",
"title": "OpenAI",
"namespace": "OpenAI",
"provider": "openai",
"serviceType": "openapi",
"authenticationType": "bearer",
"options": {
"endpoint": "https://api.openai.com/v1/",
"spec": "https://raw.githubusercontent.com/takeshape/openapi-specs/813784d8fcac5b3fd4e468ce6f715b89c9fcb73f/specs/openai/v2.yml",
"transformVersion": "2.0.0",
"introspectedAt": "2024-04-15T20:22:53.202Z"
}
},
"shopify": {
"id": "shopify",
"title": "Shopify",
"namespace": "Shopify",
"provider": "shopify",
"serviceType": "graphql",
"authenticationType": "custom",
"options": {}
}
}
}