From 91111e3ad5b1b577d9e046b53bf6d44e0c33e422 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 14 Aug 2024 17:22:57 +0100 Subject: [PATCH 01/12] feat: DIA-1324: Add batch-prediction prompts endpoints --- fern/openapi/overrides.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fern/openapi/overrides.yaml b/fern/openapi/overrides.yaml index fc5bd93..2765a87 100644 --- a/fern/openapi/overrides.yaml +++ b/fern/openapi/overrides.yaml @@ -1,4 +1,12 @@ paths: + /api/model-run/batch-predictions/: + post: + $ref: "./resources/prompts.yaml#/paths/~1api~1model-run~1batch-predictions/post" + x-fern-sdk-group-name: prompts + x-fern-sdk-method-name: batch_predictions + x-fern-audiences: + - public + /api/comments/: get: $ref: "./resources/comments.yaml#/paths/~1api~1comments/get" From d65b4be6ad4e37c22a4a226837b1c1895e1180df Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 14 Aug 2024 17:26:08 +0100 Subject: [PATCH 02/12] Add yaml --- fern/openapi/resources/prompts.yaml | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 fern/openapi/resources/prompts.yaml diff --git a/fern/openapi/resources/prompts.yaml b/fern/openapi/resources/prompts.yaml new file mode 100644 index 0000000..f62a440 --- /dev/null +++ b/fern/openapi/resources/prompts.yaml @@ -0,0 +1,38 @@ +paths: + /api/model-run/batch-predictions: + post: + summary: Create batch predictions + description: > + Create a new batch prediction. + requestBody: + $ref: "#/components/requestBodies/api_prompts_batch_predictions_create" + responses: + "201": + description: "" + content: + application/json: + schema: + type: object + properties: + detail: + type: string + +components: + requestBodies: + api_prompts_batch_predictions_create: + content: + application/json: + schema: + type: object + properties: + job_id: + title: Job ID + type: string + modelrun_id: + title: Model Run ID + type: integer + results: + title: Results + type: array + items: + type: object From 71403e72597d03e414d41577865b9516781a2dd2 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 14 Aug 2024 20:08:31 +0100 Subject: [PATCH 03/12] remove job_id from params --- fern/openapi/resources/prompts.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/fern/openapi/resources/prompts.yaml b/fern/openapi/resources/prompts.yaml index f62a440..2ea1e0e 100644 --- a/fern/openapi/resources/prompts.yaml +++ b/fern/openapi/resources/prompts.yaml @@ -25,9 +25,6 @@ components: schema: type: object properties: - job_id: - title: Job ID - type: string modelrun_id: title: Model Run ID type: integer From 5364faf81114159093b1f1c98b9b94e2952823f5 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 14 Aug 2024 21:01:09 +0100 Subject: [PATCH 04/12] Add /api/prompts --- fern/fern.config.json | 2 +- fern/generators.yml | 2 +- fern/openapi/overrides.yaml | 13 ++++ fern/openapi/resources/prompts.yaml | 96 +++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 2 deletions(-) diff --git a/fern/fern.config.json b/fern/fern.config.json index c78bf1a..e00f16b 100644 --- a/fern/fern.config.json +++ b/fern/fern.config.json @@ -1,4 +1,4 @@ { "organization": "humansignal-org", - "version": "0.37.6" + "version": "0.39.1" } \ No newline at end of file diff --git a/fern/generators.yml b/fern/generators.yml index 7d14f5e..48c353d 100644 --- a/fern/generators.yml +++ b/fern/generators.yml @@ -54,7 +54,7 @@ groups: - public generators: - name: fernapi/fern-python-sdk - version: 2.14.0-rc0 + version: 3.10.3 output: location: local-file-system path: ../label_studio_sdk diff --git a/fern/openapi/overrides.yaml b/fern/openapi/overrides.yaml index 2765a87..6d01257 100644 --- a/fern/openapi/overrides.yaml +++ b/fern/openapi/overrides.yaml @@ -1,4 +1,17 @@ paths: + /api/prompts/: + get: + $ref: "./resources/prompts.yaml#/paths/~1api~1prompts/get" + x-fern-sdk-group-name: prompts + x-fern-sdk-method-name: list + x-fern-audiences: + - public + post: + $ref: "./resources/prompts.yaml#/paths/~1api~1prompts/post" + x-fern-sdk-group-name: prompts + x-fern-sdk-method-name: create + x-fern-audiences: + - public /api/model-run/batch-predictions/: post: $ref: "./resources/prompts.yaml#/paths/~1api~1model-run~1batch-predictions/post" diff --git a/fern/openapi/resources/prompts.yaml b/fern/openapi/resources/prompts.yaml index 2ea1e0e..c86975b 100644 --- a/fern/openapi/resources/prompts.yaml +++ b/fern/openapi/resources/prompts.yaml @@ -1,4 +1,35 @@ paths: + /api/prompts: + get: + summary: List prompts + description: > + Get a list of prompts. + responses: + "200": + description: "" + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Prompt" + post: + summary: Create prompt + description: > + Create a new prompt. + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Prompt" + responses: + "201": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Prompt" + /api/model-run/batch-predictions: post: summary: Create batch predictions @@ -18,7 +49,72 @@ paths: type: string components: + schemas: + Prompt: + required: + - title + - input_fields + - output_classes + type: object + properties: + title: + title: Title + description: Title of the prompt + type: string + maxLength: 500 + description: + title: Description + description: Description of the prompt + type: string + nullable: true + created_by: + title: Created by + description: User ID of the creator of the prompt + anyOf: + - type: integer + - type: object + nullable: true + readOnly: true + created_at: + title: Created at + description: Date and time the prompt was created + type: string + format: date-time + readOnly: true + updated_at: + title: Updated at + description: Date and time the prompt was last updated + type: string + format: date-time + readOnly: true + organization: + title: Organization + description: Organization ID of the prompt + anyOf: + - type: integer + - type: object + nullable: true + input_fields: + title: Input fields + description: List of input fields + type: array + items: + type: string + output_classes: + title: Output classes + description: List of output classes + type: array + items: + type: string + associated_projects: + title: Associated projects + description: List of associated projects IDs + type: array + items: + type: integer + nullable: true requestBodies: + api_prompts_batch_predictions_create: content: application/json: From 447cf37b29baef6125f3ca091ee2f497ec7e2293 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 14 Aug 2024 22:34:32 +0100 Subject: [PATCH 05/12] Add PromptVersion, PromptRun API --- fern/openapi/overrides.yaml | 21 ++++ fern/openapi/resources/prompts.yaml | 185 ++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+) diff --git a/fern/openapi/overrides.yaml b/fern/openapi/overrides.yaml index 6d01257..ca2d959 100644 --- a/fern/openapi/overrides.yaml +++ b/fern/openapi/overrides.yaml @@ -12,6 +12,27 @@ paths: x-fern-sdk-method-name: create x-fern-audiences: - public + + /api/prompts/{id}/versions: + post: + $ref: "./resources/prompts.yaml#/paths/~1api~1prompts~1{id}~1versions/post" + x-fern-sdk-group-name: + - prompts + - versions + x-fern-sdk-method-name: create + x-fern-audiences: + - public + + /api/prompts/{id}/versions/{version_id}/inference-runs: + post: + $ref: "./resources/prompts.yaml#/paths/~1api~1prompts~1{id}~1versions~1{version_id}~1inference-runs/post" + x-fern-sdk-group-name: + - prompts + - versions + x-fern-sdk-method-name: run + x-fern-audiences: + - public + /api/model-run/batch-predictions/: post: $ref: "./resources/prompts.yaml#/paths/~1api~1model-run~1batch-predictions/post" diff --git a/fern/openapi/resources/prompts.yaml b/fern/openapi/resources/prompts.yaml index c86975b..f47024c 100644 --- a/fern/openapi/resources/prompts.yaml +++ b/fern/openapi/resources/prompts.yaml @@ -30,6 +30,65 @@ paths: schema: $ref: "#/components/schemas/Prompt" + /api/prompts/{id}/versions: + post: + summary: Create prompt version + description: > + Create a new version of a prompt. + parameters: + - name: id + in: path + description: Prompt ID + required: true + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/PromptVersion" + + responses: + "201": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/PromptVersion" + + /api/prompts/{id}/versions/{version_id}/inference-runs: + post: + summary: Run prompt + description: > + Run a prompt. + parameters: + - name: id + in: path + description: Prompt ID + required: true + schema: + type: integer + - name: version_id + in: path + description: Prompt Version ID + required: true + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/PromptRun" + responses: + "201": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/PromptRun" + + + /api/model-run/batch-predictions: post: summary: Create batch predictions @@ -113,6 +172,132 @@ components: items: type: integer nullable: true + PromptVersion: + required: + - title + - prompt + - provider + - provider_model_id + type: object + properties: + title: + title: Title + type: string + maxLength: 500 + parent_model: + title: Parent Model ID + type: integer + prompt: + title: Prompt + type: string + + provider: + title: Provider + type: string + enum: + - OpenAI + - AzureOpenAI + provider_model_id: + title: Provider Model ID + type: string + created_by: + anyOf: + - type: integer + - type: object + nullable: true + created_at: + title: Created at + type: string + format: date-time + readOnly: true + updated_at: + title: Updated at + type: string + format: date-time + readOnly: true + organization: + anyOf: + - type: integer + - type: object + nullable: true + PromptRun: + required: + - project + - project_subset + type: object + properties: + organization: + anyOf: + - type: integer + - type: object + nullable: true + project: + title: Project ID + type: integer + model_version: + title: Prompt Version ID + type: string + created_by: + anyOf: + - type: integer + - type: object + nullable: true + project_subset: + title: Project Subset + type: string + enum: + - All + - HasGT + - Sample + status: + title: Status + type: string + enum: + - Pending + - InProgress + - Completed + - Failed + - Canceled + job_id: + title: Job ID + type: string + nullable: true + total_predictions: + title: Total Predictions + type: integer + readOnly: true + total_correct_predictions: + title: Total Correct Predictions + type: integer + readOnly: true + total_tasks: + title: Total Tasks + type: integer + readOnly: true + created_at: + title: Created at + type: string + format: date-time + readOnly: true + triggered_at: + title: Triggered at + type: string + format: date-time + nullable: true + readOnly: true + predictions_updated_at: + title: Predictions Updated at + type: string + format: date-time + nullable: true + readOnly: true + completed_at: + title: Completed at + type: string + format: date-time + nullable: true + readOnly: true + requestBodies: api_prompts_batch_predictions_create: From 29febf70dd910fc218fe060060c8b7048a6f4491 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 14 Aug 2024 22:42:49 +0100 Subject: [PATCH 06/12] Fix run->create_run --- fern/openapi/overrides.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/openapi/overrides.yaml b/fern/openapi/overrides.yaml index ca2d959..999d8c2 100644 --- a/fern/openapi/overrides.yaml +++ b/fern/openapi/overrides.yaml @@ -29,7 +29,7 @@ paths: x-fern-sdk-group-name: - prompts - versions - x-fern-sdk-method-name: run + x-fern-sdk-method-name: create_run x-fern-audiences: - public From f155500fb03cefc09914bba2ab95e3e4a6c0c985 Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 15 Aug 2024 12:16:23 +0100 Subject: [PATCH 07/12] Replace PromptRun->InferenceRun --- fern/openapi/resources/prompts.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fern/openapi/resources/prompts.yaml b/fern/openapi/resources/prompts.yaml index f47024c..8541a67 100644 --- a/fern/openapi/resources/prompts.yaml +++ b/fern/openapi/resources/prompts.yaml @@ -58,9 +58,9 @@ paths: /api/prompts/{id}/versions/{version_id}/inference-runs: post: - summary: Run prompt + summary: Run prompt inference description: > - Run a prompt. + Run a prompt inference. parameters: - name: id in: path @@ -78,14 +78,14 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PromptRun" + $ref: "#/components/schemas/InferenceRun" responses: "201": description: "" content: application/json: schema: - $ref: "#/components/schemas/PromptRun" + $ref: "#/components/schemas/InferenceRun" @@ -220,7 +220,7 @@ components: - type: integer - type: object nullable: true - PromptRun: + InferenceRun: required: - project - project_subset From 612ed5bca9159079bb3ab6ec0cba4be77483cee6 Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 15 Aug 2024 13:29:59 +0100 Subject: [PATCH 08/12] Set inline_request_param=true --- fern/generators.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fern/generators.yml b/fern/generators.yml index 48c353d..b314f53 100644 --- a/fern/generators.yml +++ b/fern/generators.yml @@ -21,7 +21,7 @@ groups: mode: push # mode: pull-request config: - inline_request_params: false + inline_request_params: true package_name: label_studio_sdk client: class_name: LabelStudioBase @@ -60,7 +60,7 @@ groups: path: ../label_studio_sdk smart-casing: true config: - inline_request_params: false + inline_request_params: true package_name: label_studio_sdk client: class_name: LabelStudioBase From 21a64fad7ae3edf7e228dd66da8711254e21df07 Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 15 Aug 2024 14:35:37 +0100 Subject: [PATCH 09/12] Downgrade nltk --- fern/generators.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/generators.yml b/fern/generators.yml index b314f53..98627c9 100644 --- a/fern/generators.yml +++ b/fern/generators.yml @@ -38,7 +38,7 @@ groups: pandas: '>=0.24.0' requests: '>=2.22.0' Pillow: '>=10.0.1' - nltk: '^3.8.2' + nltk: '^3.8.1' ujson: '>=5.8.0' ijson: '>=3.2.3' appdirs: '>=1.4.3' From 8b6be5828b02b94c7499837fc085c931eecc833f Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 15 Aug 2024 17:01:21 +0100 Subject: [PATCH 10/12] Add model_providers.create() --- fern/openapi/overrides.yaml | 8 ++++ fern/openapi/resources/prompts.yaml | 69 +++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/fern/openapi/overrides.yaml b/fern/openapi/overrides.yaml index 999d8c2..f23098f 100644 --- a/fern/openapi/overrides.yaml +++ b/fern/openapi/overrides.yaml @@ -33,6 +33,14 @@ paths: x-fern-audiences: - public + /api/model-provider-connections/: + post: + $ref: "./resources/prompts.yaml#/paths/~1api~1model-provider-connections/post" + x-fern-sdk-group-name: model_providers + x-fern-sdk-method-name: create + x-fern-audiences: + - public + /api/model-run/batch-predictions/: post: $ref: "./resources/prompts.yaml#/paths/~1api~1model-run~1batch-predictions/post" diff --git a/fern/openapi/resources/prompts.yaml b/fern/openapi/resources/prompts.yaml index 8541a67..5d20ca8 100644 --- a/fern/openapi/resources/prompts.yaml +++ b/fern/openapi/resources/prompts.yaml @@ -87,6 +87,23 @@ paths: schema: $ref: "#/components/schemas/InferenceRun" + /api/model-provider-connections: + post: + summary: Create model provider connection + description: > + Create a new model provider connection. + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ModelProviderConnection" + responses: + "201": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/ModelProviderConnection" /api/model-run/batch-predictions: @@ -297,6 +314,58 @@ components: format: date-time nullable: true readOnly: true + ModelProviderConnection: + required: + - provider + - api_key + type: object + properties: + provider: + title: Provider + type: string + enum: + - OpenAI + - AzureOpenAI + api_key: + title: API Key + type: string + nullable: true + deployment_name: + title: Deployment Name + type: string + nullable: true + endpoint: + title: Endpoint + type: string + nullable: true + scope: + title: Scope + type: string + enum: + - Organization + - User + - Model + organization: + anyOf: + - type: integer + - type: object + nullable: true + created_by: + anyOf: + - type: integer + - type: object + nullable: true + readOnly: true + created_at: + title: Created at + type: string + format: date-time + readOnly: true + updated_at: + title: Updated at + type: string + format: date-time + readOnly: true requestBodies: From 996b26b8b8c56f57abfa14c98dfaf1dc6aca142e Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 15 Aug 2024 18:03:19 +0100 Subject: [PATCH 11/12] Add skill_name --- fern/openapi/resources/prompts.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fern/openapi/resources/prompts.yaml b/fern/openapi/resources/prompts.yaml index 5d20ca8..85b063a 100644 --- a/fern/openapi/resources/prompts.yaml +++ b/fern/openapi/resources/prompts.yaml @@ -189,6 +189,11 @@ components: items: type: integer nullable: true + skill_name: + title: Skill name + description: Name of the skill + type: string + nullable: true PromptVersion: required: - title From f398d6bd34d3f9874ca328b76010bd5d2a262174 Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 15 Aug 2024 19:02:02 +0100 Subject: [PATCH 12/12] Remove trailing slash in batch-predictions --- fern/openapi/overrides.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/openapi/overrides.yaml b/fern/openapi/overrides.yaml index f23098f..abe95ef 100644 --- a/fern/openapi/overrides.yaml +++ b/fern/openapi/overrides.yaml @@ -41,7 +41,7 @@ paths: x-fern-audiences: - public - /api/model-run/batch-predictions/: + /api/model-run/batch-predictions: post: $ref: "./resources/prompts.yaml#/paths/~1api~1model-run~1batch-predictions/post" x-fern-sdk-group-name: prompts