BF Streaming API

The BetterForms Streaming API allows real time streaming of responses from LLM services like OpenAI To be initiated.

Overview

Creating a call to this service will create a post to the LLM and stream results back to the appropriate channel. This service is in beta release as of the time of this document.

Avail in bf-staging only

//create endpoint
portal.myapp.com/stream/create

Method: POST
KeyTypeDescription

apiKey

string

Unique API key for BF (find in app settings)

channels

array

Array of BF Messaging communication channels

actionName

string

Name of the action to be performed

service

string

Name of the service to be used (OpenAI)

payload

object

Object containing parameters for the action, this contains params that are passed on to the streaming service

payload.apiKey

string

Unique API key for the streaming service

payload.stream

bool

Indicator if streaming is enabled, if disabled, result is returned directly to the POST result

payload.functions

array

Array of functions to be executed

payload.max_tokens

number

Maximum number of tokens for the response

payload.seed

number

Seed for the random number generator

payload.messages

array

Array of messages to be processed

payload.model

string

Model to be used for processing

payload.temperature

number

Parameter controlling randomness in output

{
  "apiKey": "BFAPI_xxxxxxxx-xxxxxx-xxxxxx,
  "channels": [
    "anonymous"
  ],
  "actionName": "assistantReceiveResultsStream",
  "service": "openAI",
  "payload": {
    "apiKey": "sk-xxxxxxx-xxxxxxxx-xxxxxxx",
    "stream": true,
    "functions": [],
    "max_tokens": 4000,
    "seed": 1,
    "messages": [
      {
        "content": "You are a Chuck Norris Joke teller.",
        "role": "system"
      },
      {
        "content": "create a joke about software developers",
        "role": "user"
      }
    ],
    "model": "gpt-4-turbo-preview",
    "temperature": 0
  }
}

Last updated