Query App

Post a completion request to the ai model given an app id and set of inputs.

Inputs are usually in the form of JSON object like:

{'<variable_name>': '<value>'}

Example: {'name': 'John', 'age': 25}

The variable name should be the same as the variable name in the app.

Returns:

- StreamingResponse when request.stream=True

- CompletionResponse when request.stream=False
Path Parameters
  • app_id
    Type: string · App IdFormat: uuid
    required

    The unique identifier of the app to query

Body·AppQueryRequest
required
application/json
  • inputs
    Type: object · Inputs
    required

    The list of inputs on the app to process. Usually in the form of JSON object like {'<variable_name>': '<value>'}. The variable name should be the same as the variable name in the app.

  • file_uuids
    Type: array string[] | null · File Uuids nullable

    The list of file uuids to process

  • model
    Type: string · Model nullable

    The AI model to use for processing. Please use the unique name of the model, not the display name

  • stream
    Type: boolean · Stream

    Whether to stream the response

Responses
  • application/json
  • application/json
Request Example for post/app/{app_id}/query
curl https://ai.hatz.ai/v1/app/123e4567-e89b-12d3-a456-426614174000/query \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: YOUR_SECRET_TOKEN' \
  --data '{
  "inputs": {},
  "model": "gpt-4o",
  "stream": false,
  "file_uuids": []
}'
{
  "choices": [
    {
      "message": {
        "content": "string",
        "role": "assistant"
      }
    }
  ],
  "model": "string",
  "usage": {
    "input_tokens": 1,
    "output_tokens": 1
  }
}