跳到主要内容

Prompt with stream

POST 

/bv/aisk-stream/v1/prompts

This API is used to prompt streaming with the chatbot. The authorization header should be prompt token.


It'll return a 429/Too Many Requests and consider the following error reasons:

  • With ERROR_REASON_PROMPT_THROTTLING that means the rate limit is reached and will temporarily throttle the chatbot which should reduce the requested rate to satisfy the chatbot rate limit.

    Response examples
    {
    "code": 8,
    "message": "throttle",
    "details": [
    {
    "@type": "type.googleapis.com/google.rpc.ErrorInfo",
    "reason": "ERROR_REASON_PROMPT_THROTTLING",
    "domain": "bv.aisk.v1",
    "metadata": {
    "duration": "1m0s",
    "limit": "5",
    "throttle_message": "Too many messages in a row",
    "vary_by": "RATE_LIMIT_VARY_BY_DEVICE_ID",
    "wait": "36.581786s",
    "wait_sec": "36.581786"
    }
    }
    ]
    }
  • With ERROR_REASON_PROMPT_OUT_OF_QUOTA that means the daily quota is reached and will be reset at 00:00 in the organization timezone.

    Response examples
    {
    "code": 8,
    "message": "out of quota",
    "details": [
    {
    "@type": "type.googleapis.com/google.rpc.ErrorInfo",
    "reason": "ERROR_REASON_PROMPT_OUT_OF_QUOTA",
    "domain": "bv.aisk.v1",
    "metadata": {
    "limit": "100",
    "reset_at": "2024-01-06T00:00:00+08:00",
    "reset_in": "11h18m33.091627s",
    "reset_in_sec": "40713.091627"
    }
    }
    ]
    }

Request

Header Parameters

    authorization string

    This API should be invoked with the prompt token.

Body

required
    question stringrequired
    kb_ids string[]required
    metadata objectrequired
    session_id string
    conversation_id string
    language string
    device object
    id device id, unique for each device (string)
    platform ios | android | windows (string)
    category desktop | mobile | tablet (string)
    browser Chrome 105 | Safari 15.4 (string)

Responses

A successful response.

Schema
    message string
    citations object[]
  • Array [
  • type string

    Possible values: [SOURCE_TYPE_WEBSITE, SOURCE_TYPE_LOCAL_DRIVE, SOURCE_TYPE_VOD, SOURCE_TYPE_VIDEO, SOURCE_TYPE_SUBTITLE, SOURCE_TYPE_TEXT, SOURCE_TYPE_AOD]

    local_drive object
    file_name string
    source_format string

    Possible values: [SOURCE_FORMAT_WEBSITE, SOURCE_FORMAT_PDF, SOURCE_FORMAT_DOC, SOURCE_FORMAT_DOCX, SOURCE_FORMAT_VOD_TO_TEXT, SOURCE_FORMAT_VIDEO_TO_TEXT, SOURCE_FORMAT_SRT, SOURCE_FORMAT_VTT, SOURCE_FORMAT_TEXT, SOURCE_FORMAT_AOD_TO_TEXT]

    Output only.

    download_url string
    web_link object
    url string
    title string
    thumbnail_url string
    vod object
    contents object[]
  • Array [
  • content string
    period object
    start_time string
    end_time string
  • ]
  • resource_id string
    name string
    thumbnail_url string
    duration_in_second float
    source_id string
    video object
    contents object[]
  • Array [
  • content string
    period object
    start_time string
    end_time string
  • ]
  • resource_id string
    name string
    thumbnail_url string
    duration_in_second float
    aod object
    contents object[]
  • Array [
  • content string
    period object
    start_time string
    end_time string
  • ]
  • resource_id string
    name string
    thumbnail_url string
    duration_in_second float
    sub_source_id string
  • ]
Loading...