Completions

POST
Retrieve text completions based on the provided input.

Request

This endpoint expects an object.
model
stringRequired
The chat model to use for generating completions.
prompt
stringRequired
The prompt to use for generating completions.
max_tokens
integerOptional
The maximum number of tokens in the generated completion.
temperature
doubleOptional
The temperature parameter for controlling randomness in completions.
top_p
doubleOptional
The diversity of the generated text.

Response

This endpoint returns an object
id
stringOptional
Unique ID for the chat completion.
object
stringOptional
Type of object (chat completion).
created
integerOptional
Timestamp of when the chat completion was created.
choices
list of objectsOptional
The set of result choices.

Errors

POST
1curl -X POST https://api.predictionguard.com/completions \
2 -H "x-api-key: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "Neural-Chat-7B",
6 "prompt": "Will I lose my hair?",
7 "max_tokens": 1000,
8 "temperature": 1.1,
9 "top_p": 0.1
10}'
1{
2 "id": "cmpl-vt14rz28aihTwstFPuAfZQIP5FTI7",
3 "object": "text_completion",
4 "created": 1717613547,
5 "choices": [
6 {
7 "index": 0,
8 "model": "Neural-Chat-7B",
9 "status": "success",
10 "text": "if I get a hair transplant?\n\nHair transplant is a surgical procedure that involves moving hair follicles from one part of the head to another. The procedure is designed to address hair loss and restore a fuller, more natural-looking head of hair. While hair transplant does not cause hair loss, it is essential to understand that the underlying cause of hair loss must be addressed to ensure long-term success.\n\nIn some cases, hair loss may be temporary due to the stress of the surgery or the use of certain medications. However, this is usually short-lived and will resolve on its own. To minimize the risk of temporary hair loss, it is crucial to follow your surgeon's post-operative instructions carefully and maintain a healthy lifestyle.\n\nIn summary, hair transplant does not cause hair loss, but it is essential to address the underlying cause of hair loss to achieve the best results. Temporary hair loss may occur, but it is typically short-lived and resolves on its own."
11 }
12 ]
13}