-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassistant_ai_openai.sublime-settings
161 lines (154 loc) · 5.19 KB
/
assistant_ai_openai.sublime-settings
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Place your settings in the file "Packages/User/assistant_ai_openai.sublime-settings",
// which overrides the settings in here. When opening this by Sublime Settings AssitantAI menu,
// your custom settings are in the right pane.
//
// In your custom settings, you must provide at least the 'credentials'. But you can also define
// custom 'prompts' and 'servers'.
//
// What you should not overwrite are 'default_prompts' nor 'default_servers' unless you really know
// the implications.
//
// This file specifies:
// * 'Completion' endpoint for OpenAI API. It's intended to continue editing the text you selected.
// * 'Edits' endpoint for OpenAI API. It's intended to edit the text you selected, after providing an instruction.
// * 'Chat Completions' endpoint for OpenAI API. Like 'Completions' but with the power of ChatGPT AI models
{
// Add your credentials in user settings file, following this structure:
"credentials": {
// Each server (default or custom) must have a unique 'id'.
// For each server id, you must specify the required credentials.
"openai": {
// Create your OpenAI API key from:
// https://platform.openai.com/account/api-keys
// "api_key": "sk-XXX..."
},
// For the example below of a custom server, then:
// "openai_local": {
// "api_key": "sk-XXX..."
// }
},
// add your custom prompts
"prompts": [],
// add your custom servers
"servers": [
// You can also define your own OpenAI servers by importing the provided in 'default_servers' key below.
// Here is an example of a localhost server (i.e.: a reverse proxy) that includes all definitions of the default one.
// See the 'import' key, that makes a copy of the default (identified by its 'id') and overwrites the defined keys.
//
// {
// "id": "openai_local", // choose a unique id for your custom server
// "import": "openai", // import from the already defined server
// "name": "OpenAI Local", // overwrite the imported name
// "url": "https://localhost:443", // overwrite the url, where a reverse proxy can be setup by the user
// },
],
// Default prompts and servers ---------------------------------------------
// WARNING
// You don't need to edit/overwrite the following specifications.
// Instead, you can use their id's to import those in your settings and effortlessly create new ones.
// This plugin may provide updates to these definitions and if you overwrite them, you may miss new features.
// prompts provided by this package (OpenAI basic prompts)
"default_prompts": [
{
"id": "continue_selected_text",
"name": "Continue selected text",
"icon": "…",
"description": "Given a selected text, continue writing from there.",
"required_inputs": ["text"],
"vars": {
"text": [
"The following is a portion of ${syntax} code.",
"Continue from there.",
"Return only the appended text.",
"",
"${text}",
],
},
"params": {
"temperature": 1.0,
"max_tokens": 1800,
},
"command": "append",
},
{
"id": "ask_change_code",
"name": "Ask for a change to ${syntax} text",
"icon": "⇆",
"description": "Give an instruction to change the selected ${syntax} text.",
"required_inputs": ["text", "instruction"],
"vars": {
"text": [
"The following is a portion of ${syntax} code.",
"Make these changes:",
"${instruction}.",
"Return only the edited ${syntax} text:",
"",
"${text}",
],
},
"params": {
"temperature": 1.0,
"max_tokens": 2048,
},
"command": "replace",
},
],
// server specs provided by this package (OpenAI)
"default_servers": [
{
"id": "openai",
"name": "OpenAI",
"url": "https://api.openai.com:443",
"timeout": 60,
"required_credentials": ["api_key"],
"headers": {
"Authorization": "Bearer ${api_key}",
"Content-Type": "application/json",
"cache-control": "no-cache",
},
"endpoints": {
"chat_completions": {
"name": "Chat Completions",
"icon": "⇆",
"method": "POST",
"resource": "/v1/chat/completions",
"required_vars": ["text"],
"valid_params": {
"model": "string",
"messages": "string",
"temperature": "number",
"top_p": "number",
"n": "integer",
"stream": "boolean",
"stop": "string",
"max_tokens": "integer",
"presence_penalty": "number",
"frequency_penalty": "number",
"logit_bias": "object",
"user": "string",
},
"request": {
"model": "gpt-4",
"messages": [
{
"role": "system",
"content": "You are an assistant embedded in a text editor. The prompts you are receiving from the user are triggered from keyboard shortcuts upon some text selected by the user from the editor's viewport. Typically, the user will expect you to reply with the same text as the user prompts but with the modifications asked for. The prompt may include some instructions to follow, those are added by the user.",
},
{
"role": "user",
"content": "${text}",
}
],
},
"response": {
"output": "${text}",
"paths": {
"error": "error",
"text": "choices/0/message/content",
},
},
},
}
},
]
}