Skip to content

Commit

Permalink
feat(specs): add generate code endpoint to ingestion specs (#3489)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts authored Aug 7, 2024
1 parent acb36b0 commit 2c6147e
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 17 deletions.
43 changes: 43 additions & 0 deletions specs/ingestion/paths/transformations/transformationsModels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,46 @@ get:
- llms
'400':
$ref: '../../../common/responses/BadRequest.yml'

post:
tags:
- transformations
summary: Generates code for the selected model based on the given prompt
description: Generates code for the selected model based on the given prompt.
operationId: generateTransformationCode
x-acl:
- addObject
- deleteIndex
- editSettings
requestBody:
content:
application/json:
schema:
title: generateTransformationCodePayload
type: object
additionalProperties: false
properties:
id:
type: string
systemPrompt:
type: string
userPrompt:
type: string
required:
- id
- userPrompt
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
title: generateTransformationCodeResponse
type: object
additionalProperties: false
properties:
generatedCode:
type: string
'400':
$ref: '../../../common/responses/BadRequest.yml'
2 changes: 1 addition & 1 deletion specs/ingestion/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ paths:
$ref: 'paths/transformations/transformationsTry.yml'
/1/transformations/search:
$ref: 'paths/transformations/transformationsSearch.yml'
/1/transformations/copilot:
/1/transformations/models:
$ref: 'paths/transformations/transformationsModels.yml'
/1/transformations/{transformationID}:
$ref: 'paths/transformations/transformationID.yml'
Expand Down
16 changes: 16 additions & 0 deletions tests/CTS/requests/ingestion/generateTransformationCode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"parameters": {
"id": "foo",
"userPrompt": "fizzbuzz algorithm in fortran with a lot of comments that describe what EACH LINE of code is doing"
},
"request": {
"path": "/1/transformations/models",
"method": "POST",
"body": {
"id": "foo",
"userPrompt": "fizzbuzz algorithm in fortran with a lot of comments that describe what EACH LINE of code is doing"
}
}
}
]
2 changes: 1 addition & 1 deletion tests/CTS/requests/ingestion/listTransformationModels.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"parameters": {},
"request": {
"path": "/1/transformations/copilot",
"path": "/1/transformations/models",
"method": "GET"
}
}
Expand Down
37 changes: 22 additions & 15 deletions tests/output/javascript/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -938,12 +938,12 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:20.14.11":
version: 20.14.11
resolution: "@types/node@npm:20.14.11"
"@types/node@npm:22.1.0":
version: 22.1.0
resolution: "@types/node@npm:22.1.0"
dependencies:
undici-types: "npm:~5.26.4"
checksum: 10/344e1ce1ed16c86ed1c4209ab4d1de67db83dd6b694a6fabe295c47144dde2c58dabddae9f39a0a2bdd246e95f8d141ccfe848e464884b48b8918df4f7788025
undici-types: "npm:~6.13.0"
checksum: 10/c2ac1340509646b6c673b27fae2a46e501a97e540e7221be4dd2e0be7a0f61efefb5bf3be8bedf2dbce245fa49cfc49bba77bce73fa3c4296d0d19521ced3222
languageName: node
linkType: hard

Expand Down Expand Up @@ -2067,11 +2067,11 @@ __metadata:
"@algolia/recommend": "link:../../../clients/algoliasearch-client-javascript/packages/recommend"
"@algolia/requester-node-http": "link:../../../clients/algoliasearch-client-javascript/packages/requester-node-http"
"@types/jest": "npm:29.5.12"
"@types/node": "npm:20.14.11"
"@types/node": "npm:22.1.0"
algoliasearch: "link:../../../clients/algoliasearch-client-javascript/packages/algoliasearch"
dotenv: "npm:16.4.5"
jest: "npm:29.7.0"
typescript: "npm:5.5.3"
typescript: "npm:5.5.4"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -3449,23 +3449,23 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:5.5.3":
version: 5.5.3
resolution: "typescript@npm:5.5.3"
"typescript@npm:5.5.4":
version: 5.5.4
resolution: "typescript@npm:5.5.4"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/11a867312419ed497929aafd2f1d28b2cd41810a5eb6c6e9e169559112e9ea073d681c121a29102e67cd4478d0a4ae37a306a5800f3717f59c4337e6a9bd5e8d
checksum: 10/1689ccafef894825481fc3d856b4834ba3cc185a9c2878f3c76a9a1ef81af04194849840f3c69e7961e2312771471bb3b460ca92561e1d87599b26c37d0ffb6f
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A5.5.3#optional!builtin<compat/typescript>":
version: 5.5.3
resolution: "typescript@patch:typescript@npm%3A5.5.3#optional!builtin<compat/typescript>::version=5.5.3&hash=b45daf"
"typescript@patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>":
version: 5.5.4
resolution: "typescript@patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>::version=5.5.4&hash=b45daf"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/b61b8bb4b4d6a8a00f9d5f931f8c67070eed6ad11feabf4c41744a326987080bfc806a621596c70fbf2e5974eca3ed65bafeeeb22a078071bdfb51d8abd7c013
checksum: 10/2c065f0ef81855eac25c9b658a3c9da65ffc005260c12854c2286f40f3667e1b1ecf8bdbdd37b59aa0397920378ce7900bff8cb32e0f1c7af6fd86efc676718c
languageName: node
linkType: hard

Expand All @@ -3476,6 +3476,13 @@ __metadata:
languageName: node
linkType: hard

"undici-types@npm:~6.13.0":
version: 6.13.0
resolution: "undici-types@npm:6.13.0"
checksum: 10/da52e37cbc6da3a75da86fa08dd795ca8924430deb91005eb884b840e46e19013ccd4c1c289f70018e8cf0c338add24a500e7c3acfcd49b1ffb27ff9f91e38b9
languageName: node
linkType: hard

"unique-filename@npm:^3.0.0":
version: 3.0.0
resolution: "unique-filename@npm:3.0.0"
Expand Down

0 comments on commit 2c6147e

Please sign in to comment.