From 64ecce5a9d7cd9a4fb0ced0196f91ad8b749d04b Mon Sep 17 00:00:00 2001 From: vedpatwardhan Date: Tue, 3 Sep 2024 15:05:41 +0000 Subject: [PATCH] updated docs --- .../llm_queries/chat_completions.mdx | 2 +- api-reference/logging/get_prompt_history.mdx | 60 ---------- api-reference/logging/get_query_history.mdx | 72 +++++++++++ api-reference/logging/get_query_tags.mdx | 40 +++++++ api-reference/openapi.json | 113 +++++++++++++++++- mint.json | 3 +- 6 files changed, 222 insertions(+), 68 deletions(-) delete mode 100644 api-reference/logging/get_prompt_history.mdx create mode 100644 api-reference/logging/get_query_history.mdx create mode 100644 api-reference/logging/get_query_tags.mdx diff --git a/api-reference/llm_queries/chat_completions.mdx b/api-reference/llm_queries/chat_completions.mdx index 7aa8d9e..8e105d9 100644 --- a/api-reference/llm_queries/chat_completions.mdx +++ b/api-reference/llm_queries/chat_completions.mdx @@ -139,7 +139,7 @@ A string used to represent where the request came from, for examples, did it com Whether or not to use custom API keys with the specified provider, meaning that you will be using your own account with that provider in the backend. - + Comma-separated list of tags to associate with the corresponding prompt. diff --git a/api-reference/logging/get_prompt_history.mdx b/api-reference/logging/get_prompt_history.mdx deleted file mode 100644 index b5fd747..0000000 --- a/api-reference/logging/get_prompt_history.mdx +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: 'Get Prompt History' -api: 'GET /v0/prompt_history' ---- -Get the prompt history, optionally for a given set of tags for a narrowed search. - -#### Authorizations - - - Bearer authentication header of the form `Bearer `, where `` is your auth token. - - -#### Query Parameters - - -Tags to filter for prompts that are marked with these tags. - - - - -```bash cURL -curl --request GET \ - --url 'https://api.unify.ai/v0/prompt_history?tags=None' \ - --header 'Authorization: Bearer ' -``` - -```python Python -import requests - -url = "https://api.unify.ai/v0/prompt_history?tags=None" - -headers = {"Authorization": "Bearer "} - -response = requests.request("GET", url, headers=headers) - -print(response.text) -``` - - - - -```json 200 -{} -``` - -```json 422 -{ - "detail": [ - { - "loc": [ - "string" - ], - "msg": "string", - "type": "string" - } - ] -} -``` - - diff --git a/api-reference/logging/get_query_history.mdx b/api-reference/logging/get_query_history.mdx new file mode 100644 index 0000000..ae97723 --- /dev/null +++ b/api-reference/logging/get_query_history.mdx @@ -0,0 +1,72 @@ +--- +title: 'Get Query History' +api: 'GET /v0/queries' +--- +Get the queries history, optionally for a given set of tags for a narrowed search. + +#### Authorizations + + + Bearer authentication header of the form `Bearer `, where `` is your auth token. + + +#### Query Parameters + + +Tags to filter for queries that are marked with these tags. + + + +Optionally specify an endpoint, or a list of endpoints to filter for + + + +Timestamp of the earliest query to aggregate. Format is `YYYY-MM-DD hh:mm:ss`. + + + +Timestamp of the latest query to aggregate. Format is `YYYY-MM-DD hh:mm:ss`. + + + + +```bash cURL +curl --request GET \ + --url 'https://api.unify.ai/v0/queries?tags=my_tag&endpoints=gpt-4o@openai&start_time=2024-07-12%2004:20:32&end_time=2024-08-12%2004:20:32' \ + --header 'Authorization: Bearer ' +``` + +```python Python +import requests + +url = "https://api.unify.ai/v0/queries?tags=my_tag&endpoints=gpt-4o@openai&start_time=2024-07-12%2004:20:32&end_time=2024-08-12%2004:20:32" + +headers = {"Authorization": "Bearer "} + +response = requests.request("GET", url, headers=headers) + +print(response.text) +``` + + + + +```json 200 +{} +``` + +```json 422 +{ + "detail": [ + { + "loc": [ + "string" + ], + "msg": "string", + "type": "string" + } + ] +} +``` + + diff --git a/api-reference/logging/get_query_tags.mdx b/api-reference/logging/get_query_tags.mdx new file mode 100644 index 0000000..8e94431 --- /dev/null +++ b/api-reference/logging/get_query_tags.mdx @@ -0,0 +1,40 @@ +--- +title: 'Get Query Tags' +api: 'GET /v0/tags' +--- +Returns a list of the tags in your account + +#### Authorizations + + + Bearer authentication header of the form `Bearer `, where `` is your auth token. + + + + +```bash cURL +curl --request GET \ + --url 'https://api.unify.ai/v0/tags' \ + --header 'Authorization: Bearer ' +``` + +```python Python +import requests + +url = "https://api.unify.ai/v0/tags" + +headers = {"Authorization": "Bearer "} + +response = requests.request("GET", url, headers=headers) + +print(response.text) +``` + + + + +```json 200 +{} +``` + + diff --git a/api-reference/openapi.json b/api-reference/openapi.json index e2fe110..4c63e8e 100644 --- a/api-reference/openapi.json +++ b/api-reference/openapi.json @@ -247,14 +247,45 @@ ] } }, - "/v0/prompt_history": { + "/v0/tags": { "get": { "tags": [ "Logging" ], - "summary": "Get Prompt History", - "description": "Get the prompt history, optionally for a given set of tags for a narrowed search.", - "operationId": "get_prompt_history_v0_prompt_history_get", + "summary": "Get Query Tags", + "description": "Returns a list of the tags in your account", + "operationId": "get_query_tags_v0_tags_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Response Get Query Tags V0 Tags Get" + } + } + } + } + }, + "security": [ + { + "HTTPBearer": [] + } + ] + } + }, + "/v0/queries": { + "get": { + "tags": [ + "Logging" + ], + "summary": "Get Query History", + "description": "Get the queries history, optionally for a given set of tags for a narrowed search.", + "operationId": "get_query_history_v0_queries_get", "security": [ { "HTTPBearer": [] @@ -275,12 +306,79 @@ "items": { "type": "string" } + }, + { + "type": "null" } ], - "description": "Tags to filter for prompts that are marked with these tags.", + "description": "Tags to filter for queries that are marked with these tags.", "title": "Tags" }, - "description": "Tags to filter for prompts that are marked with these tags." + "description": "Tags to filter for queries that are marked with these tags.", + "example": "my_tag" + }, + { + "name": "endpoints", + "in": "query", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "null" + } + ], + "description": "Optionally specify an endpoint, or a list of endpoints to filter for", + "title": "Endpoints" + }, + "description": "Optionally specify an endpoint, or a list of endpoints to filter for", + "example": "gpt-4o@openai" + }, + { + "name": "start_time", + "in": "query", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Timestamp of the earliest query to aggregate. Format is `YYYY-MM-DD hh:mm:ss`.", + "title": "Start Time" + }, + "description": "Timestamp of the earliest query to aggregate. Format is `YYYY-MM-DD hh:mm:ss`.", + "example": "2024-07-12 04:20:32" + }, + { + "name": "end_time", + "in": "query", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Timestamp of the latest query to aggregate. Format is `YYYY-MM-DD hh:mm:ss`.", + "title": "End Time" + }, + "description": "Timestamp of the latest query to aggregate. Format is `YYYY-MM-DD hh:mm:ss`.", + "example": "2024-08-12 04:20:32" } ], "responses": { @@ -3380,6 +3478,9 @@ }, "tags": { "anyOf": [ + { + "type": "string" + }, { "items": { "type": "string" diff --git a/mint.json b/mint.json index e874cf4..2d598bf 100644 --- a/mint.json +++ b/mint.json @@ -140,7 +140,8 @@ { "group": "Logging", "pages": [ - "api-reference/logging/get_prompt_history", + "api-reference/logging/get_query_tags", + "api-reference/logging/get_query_history", "api-reference/logging/get_query_metrics" ] },