Create Chat Completion

View as Markdown

Generate a chat completion with guardrails applied.

The request shape is compatible with the OpenAI Chat Completions API and accepts Guardrails-specific options in the guardrails object.

Request

This endpoint expects an object.
modelstringRequired
LLM model to use for the completion.
messageslist of objectsOptional
Chat messages in the current conversation.
streambooleanOptionalDefaults to false

Return partial message deltas as server-sent events.

max_tokensintegerOptional
Maximum number of tokens to generate.
temperaturedoubleOptional
Sampling temperature.
top_pdoubleOptional

Top-p sampling parameter.

stopstring or list of stringsOptional
Stop sequence or sequences.
presence_penaltydoubleOptional
Presence penalty parameter.
frequency_penaltydoubleOptional
Frequency penalty parameter.
function_callmap from strings to anyOptional
Function call parameter.
logit_biasmap from strings to anyOptional
Logit bias parameter.
logprobsbooleanOptional
Log probabilities parameter.
guardrailsobjectOptional

Guardrails-specific request options.

Response

Chat completion response or server-sent event stream.

idstring
objectstring
createdinteger
modelstring
choiceslist of objects
guardrailsobject

Errors

422
Unprocessable Entity Error