Public
Script
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**
* Available models
*/
type Model =
| "pplx-7b-chat"
| "pplx-70b-chat"
| "pplx-7b-online"
| "pplx-70b-online"
| "llama-2-70b-chat"
| "codellama-34b-instruct"
| "mistral-7b-instruct"
| "mixtral-8x7b-instruct";
/**
* Represents a message in a conversation
*/
interface Message {
role: "system" | "user" | "assistant";
content: string;
}
/**
* Choices made during the completion of a conversation
*/
interface CompletionChoices {
index: number;
finish_reason: "stop" | "length";
message: Message;
delta: Message;
}
/**
* Request object for pplx models
*
* @prop {Model} model
* @prop {Message[]} messages
* @prop {number} [max_tokens]
* @prop {number} [temperature]
* @prop {number} [top_p]
* @prop {number} [top_k]
* @prop {boolean} [stream]
* @prop {number} [presence_penalty]
* @prop {number} [frequency_penalty]
*/
export interface PplxRequest {
model: Model;
messages: Message[];
max_tokens?: number;
temperature?: number;
top_p?: number;
top_k?: number;
stream?: boolean;
presence_penalty?: number;
frequency_penalty?: number;
}
/**
* Response object for pplx models
* @prop {string} id
* @prop {Model} model
* @prop {'chat.completion'} object
* @prop {number} created
* @prop {CompletionChoices[]} choices
*/
export interface PplxResponse {
id: string;
model: Model;
object: "chat.completion";
created: number;
choices: CompletionChoices[];
error?: {
code: number;
message: string;
type: string;
};
}
June 18, 2024