From debb02a2d3c0001ca273dc03b26021d9e314441b Mon Sep 17 00:00:00 2001 From: vedpatwardhan Date: Thu, 12 Sep 2024 08:36:24 +0000 Subject: [PATCH] updated docs --- api-reference/datasets/add_prompt.mdx | 27 ++++++++++++++---- api-reference/datasets/delete_prompt.mdx | 4 ++- api-reference/openapi.json | 36 ++++++++++++++++++------ 3 files changed, 51 insertions(+), 16 deletions(-) diff --git a/api-reference/datasets/add_prompt.mdx b/api-reference/datasets/add_prompt.mdx index 35cccb747..a99ab63fb 100644 --- a/api-reference/datasets/add_prompt.mdx +++ b/api-reference/datasets/add_prompt.mdx @@ -1,6 +1,6 @@ --- title: 'Add Prompt' -api: 'PUT /v0/dataset/add_prompt' +api: 'POST /v0/dataset/add_prompt' --- @@ -23,11 +23,24 @@ JSON object containing the prompt data to upload. ```bash cURL -curl --request PUT \ +curl --request POST \ --url 'https://api.unify.ai/v0/dataset/add_prompt' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ - --data '{}' + --data '{ + "name": "dataset_1", + "prompt_data": { + "prompt": { + "messages": [ + { + "content": "What is the capital of Spain?", + "role": "user" + } + ] + }, + "ref_answer": "Madrid" + } +}' ``` ```python Python @@ -37,9 +50,9 @@ url = "https://api.unify.ai/v0/dataset/add_prompt" headers = {"Authorization": "Bearer "} -json_input = {} +json_input = {"name": "dataset_1", "prompt_data": {"prompt": {"messages": [{"content": "What is the capital of Spain?", "role": "user"}]}, "ref_answer": "Madrid"}} -response = requests.request("PUT", url, json=json_input, headers=headers) +response = requests.request("POST", url, json=json_input, headers=headers) print(response.text) ``` @@ -48,7 +61,9 @@ print(response.text) ```json 200 -{} +{ + "info": "Prompt added sucessfully!" +} ``` ```json 422 diff --git a/api-reference/datasets/delete_prompt.mdx b/api-reference/datasets/delete_prompt.mdx index 2053063bc..9fc6673a9 100644 --- a/api-reference/datasets/delete_prompt.mdx +++ b/api-reference/datasets/delete_prompt.mdx @@ -44,7 +44,9 @@ print(response.text) ```json 200 -{} +{ + "info": "Dataset prompt deleted successfully" +} ``` ```json 422 diff --git a/api-reference/openapi.json b/api-reference/openapi.json index 1faaeed81..6bd4c5a95 100644 --- a/api-reference/openapi.json +++ b/api-reference/openapi.json @@ -1535,7 +1535,10 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": {}, + "example": { + "info": "Dataset prompt deleted successfully" + } } } }, @@ -1553,17 +1556,17 @@ } }, "/v0/dataset/add_prompt": { - "put": { + "post": { "tags": [ "Datasets" ], "summary": "Add Prompt", - "operationId": "add_prompt_v0_dataset_add_prompt_put", + "operationId": "add_prompt_v0_dataset_add_prompt_post", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Body_add_prompt_v0_dataset_add_prompt_put" + "$ref": "#/components/schemas/Body_add_prompt_v0_dataset_add_prompt_post" } } }, @@ -1574,7 +1577,10 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": {}, + "example": { + "info": "Prompt added sucessfully!" + } } } }, @@ -3571,17 +3577,29 @@ }, "components": { "schemas": { - "Body_add_prompt_v0_dataset_add_prompt_put": { + "Body_add_prompt_v0_dataset_add_prompt_post": { "properties": { "name": { "type": "string", "title": "Name", - "description": "Name of the dataset to add to" + "description": "Name of the dataset to add to", + "example": "dataset_1" }, "prompt_data": { "type": "object", "title": "Prompt Data", - "description": "JSON object containing the prompt data to upload." + "description": "JSON object containing the prompt data to upload.", + "example": { + "prompt": { + "messages": [ + { + "content": "What is the capital of Spain?", + "role": "user" + } + ] + }, + "ref_answer": "Madrid" + } } }, "type": "object", @@ -3589,7 +3607,7 @@ "name", "prompt_data" ], - "title": "Body_add_prompt_v0_dataset_add_prompt_put" + "title": "Body_add_prompt_v0_dataset_add_prompt_post" }, "Body_log_query_v0_queries_post": { "properties": {