From 3a6c863dc01aec0f848b9405187cc2c61efd4c3e Mon Sep 17 00:00:00 2001 From: Anthony Naddeo Date: Fri, 26 Jan 2024 11:30:11 -0800 Subject: [PATCH] Add redic html file for the api list --- docs/api.html | 598 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 598 insertions(+) create mode 100644 docs/api.html diff --git a/docs/api.html b/docs/api.html new file mode 100644 index 0000000..d903b4e --- /dev/null +++ b/docs/api.html @@ -0,0 +1,598 @@ + + + + + + FastAPI + + + + + + + + + +

FastAPI (0.1.0)

Download OpenAPI specification:Download

profile

Profile tabular data

Profile tabular data. The Swagger UI isn't able to call this currently.

+

Sample curl request:

+
curl -X 'POST'     -H "X-API-Key: <password>"     -H "Content-Type: application/json"     'http://localhost:8000/log'     --data-raw '{
+    "datasetId": "model-62",
+    "multiple": {
+        "columns": [ "age", "workclass", "fnlwgt", "education" ],
+        "data": [
+            [ 25, "Private", 226802, "11th" ]
+        ]
+    }
+}'
+
+

Sample Python client request:

+
from whylogs_container_client import AuthenticatedClient
+import whylogs_container_client.api.profile.log as Log
+from whylogs_container_client.models import LogRequest, LogMultiple
+from datetime import datetime
+
+client = AuthenticatedClient(base_url="http://localhost:8000", token="password", prefix="", auth_header_name="X-API-Key")
+
+data = LogRequest(
+    dataset_id="model-1",
+    timestamp=int(datetime.now().timestamp() * 1000),
+    multiple=LogMultiple(
+        columns=["col1", "col2"],
+        data=[[1, 2], [3, 4]],
+    )
+)
+
+response = Log.sync_detailed(client=client, json_body=data)
+if response.status_code != 200:
+    raise Exception(f"Failed to log data. Status code: {response.status_code}")
+# API is async, it won't fail and has no return body
+
+

Sample Python request (using requests):

+
import requests
+
+# Define your API key
+api_key = "<password>"
+
+# API endpoint
+url = 'http://localhost:8000/log'
+
+# Sample data
+data = {
+    "datasetId": "model-62",
+    "multiple": {
+        "columns": ["age", "workclass", "fnlwgt", "education"],
+        "data": [
+            [25, "Private", 226802, "11th"]
+        ]
+    }
+}
+
+# Make the POST request
+headers = {"X-API-Key": api_key}
+response = requests.post(url, json=data, headers=headers)
+
+
Request Body schema: application/json
required
datasetId
required
string (Datasetid)
required
object (LogMultiple)
Timestamp (integer) or Timestamp (null) (Timestamp)

Responses

Request samples

Content type
application/json
{
  • "datasetId": "string",
  • "multiple": {
    },
  • "timestamp": 0
}

Response samples

Content type
application/json
null

Profile embeddings

This endpoint requires a custom configuration to set up before hand. See https://docs.whylabs.ai/docs/integrations-whylogs-container/ +for setting up embeddings support.

+

Log embeddings data. The Swagger UI isn't able to call this currently.

+

Sample curl request:

+
curl -X 'POST'     -H "X-API-Key: <password>"     -H "Content-Type: application/octet-stream"     'http://localhost:8000/log-embeddings'     --data-raw '{
+    "datasetId": "model-62",
+    "timestamp": 1634235000,
+    "embeddings": {
+        "embeddings": [[0.12, 0.45, 0.33, 0.92]]
+    }
+}'
+
+

Sample Python request (using requests):

+
import requests
+
+# Define your API key
+api_key = "<password>"
+
+# API endpoint
+url = 'http://localhost:8000/log-embeddings'
+
+# Sample data
+data = {
+    "datasetId": "model-62",
+    "timestamp": 1634235000,  # an example timestamp
+    "embeddings": {
+        "embeddings": [[0.12, 0.45, 0.33, 0.92]]
+    }
+}
+
+# Make the POST request
+headers = {"X-API-Key": api_key, "Content-Type": "application/octet-stream"}
+response = requests.post(url, json=data, headers=headers)
+
+
Request Body schema: application/json
required
dataset_id
required
string (Dataset Id)
timestamp
required
integer (Timestamp)
required
object (Embeddings)

Responses

Request samples

Content type
application/json
{
  • "dataset_id": "string",
  • "timestamp": 0,
  • "embeddings": {
    }
}

Response samples

Content type
application/json
null

Log Pubsub

Responses

Response samples

Content type
application/json
null

Log Pubsub Embeddings

Responses

Response samples

Content type
application/json
null

llm

Log a single prompt/response pair.

This is a convenience wrapper around the llm request type for calling /log, which accepts bulk data.

+
Request Body schema: application/json
required
Prompt (string) or Prompt (null) (Prompt)
Response (string) or Response (null) (Response)
datasetId
required
string (Datasetid)
Timestamp (integer) or Timestamp (null) (Timestamp)

Responses

Request samples

Content type
application/json
{
  • "prompt": "string",
  • "response": "string",
  • "datasetId": "string",
  • "timestamp": 0
}

Response samples

Content type
application/json
null

Validate a single prompt/response pair

This endpoint can be used to synchronously get validation results from a single input +prompt/response. It automatically performs whylogs profiling and sends profiles to +whylabs in the background, just like the /log endpoint.

+

Args: + log (bool, optional): Determines if logging to WhyLabs is enabled for the validate request. Defaults to True.

+
query Parameters
log
boolean (Log)
Default: true
Request Body schema: application/json
required
Prompt (string) or Prompt (null) (Prompt)
Response (string) or Response (null) (Response)
datasetId
required
string (Datasetid)
Timestamp (integer) or Timestamp (null) (Timestamp)

Responses

Request samples

Content type
application/json
{
  • "prompt": "string",
  • "response": "string",
  • "datasetId": "string",
  • "timestamp": 0
}

Response samples

Content type
application/json
{
  • "report": [
    ]
}

manage

Publish Profiles

Responses

Response samples

Content type
application/json
null

Health

Responses

Response samples

Content type
application/json
null

Status

Responses

Response samples

Content type
application/json
{
  • "statuses": {
    }
}

Log Debug Info

Log the output of /status

+

Responses

Response samples

Content type
application/json
null
+ + + +