Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vedpatwardhan committed Sep 12, 2024
1 parent 9c8206c commit debb02a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 16 deletions.
27 changes: 21 additions & 6 deletions api-reference/datasets/add_prompt.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Add Prompt'
api: 'PUT /v0/dataset/add_prompt'
api: 'POST /v0/dataset/add_prompt'
---


Expand All @@ -23,11 +23,24 @@ JSON object containing the prompt data to upload.
<RequestExample>

```bash cURL
curl --request PUT \
curl --request POST \
--url 'https://api.unify.ai/v0/dataset/add_prompt' \
--header 'Authorization: Bearer <UNIFY_KEY>' \
--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
Expand All @@ -37,9 +50,9 @@ url = "https://api.unify.ai/v0/dataset/add_prompt"

headers = {"Authorization": "Bearer <token>"}

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)
```
Expand All @@ -48,7 +61,9 @@ print(response.text)
<ResponseExample>

```json 200
{}
{
"info": "Prompt added sucessfully!"
}
```

```json 422
Expand Down
4 changes: 3 additions & 1 deletion api-reference/datasets/delete_prompt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ print(response.text)
<ResponseExample>

```json 200
{}
{
"info": "Dataset prompt deleted successfully"
}
```

```json 422
Expand Down
36 changes: 27 additions & 9 deletions api-reference/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,10 @@
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
"schema": {},
"example": {
"info": "Dataset prompt deleted successfully"
}
}
}
},
Expand All @@ -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"
}
}
},
Expand All @@ -1574,7 +1577,10 @@
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
"schema": {},
"example": {
"info": "Prompt added sucessfully!"
}
}
}
},
Expand Down Expand Up @@ -3571,25 +3577,37 @@
},
"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",
"required": [
"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": {
Expand Down

0 comments on commit debb02a

Please sign in to comment.