text
Create Chat Completion
Create a Chat Completion.
post/v1/chat/completions
Request body
Example request
{
"max_tokens": 128,
"messages": [
{
"content": "You are a helpful assistant. Keep your responses limited to one short paragraph if possible.",
"role": "system"
},
{
"content": "Hello world",
"role": "user"
}
],
"model": "llama-2-13b-chat-fp16",
"temperature": 0.1,
"top_p": 0.9
}Response
An OctoAI text endpoint can be requested in either a synchronous orstreaming mode.When the request body has stream: False set the content type will beapplication/json. When the request body has stream: True set thecontent type will be text-event-stream and will respond with a stream ofserver-send-events (SSE).
Example response
{
"choices": [],
"created": 11,
"id": "chat-cmpl-123",
"model": "my_model",
"usage": {
"completion_tokens": 20,
"prompt_tokens": 10,
"total_tokens": 30
}
}