All URIs are relative to https://api.perplexity.ai
Method | HTTP request | Description |
---|---|---|
chatCompletionsPost | POST /chat/completions | Generates a model's response for the given chat conversation |
ChatCompletionResponse chatCompletionsPost()
import { } from '';
import * as fs from 'fs';
const configuration = .createConfiguration();
const apiInstance = new .DefaultApi(configuration);
let body:.DefaultApiChatCompletionsPostRequest = {
// ChatCompletionsPostRequest (optional)
chatCompletionsPostRequest: {
model: "pplx-7b-chat",
messages: [
{
role: "role_example",
content: "content_example",
},
],
maxTokens: 1,
temperature: 3.14,
topP: 3.14,
topK: 3.14,
stream: true,
presencePenalty: 3.14,
frequencyPenalty: 3.14,
},
};
apiInstance.chatCompletionsPost(body).then((data:any) => {
console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
chatCompletionsPostRequest | ChatCompletionsPostRequest |
ChatCompletionResponse
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successful response | - |
400 | Bad request | - |
401 | Unauthorized | - |
403 | Forbidden | - |
404 | Not found | - |
500 | Internal server error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]