You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* ``id`` (string, optional): ID of predefined prompt.
135
133
* ``custom`` (array of objects, optional): Custom prompt messages, each containing a ``role`` and ``content``. If no ``name`` or ``id`` was provided, the custom messages provided here become the prompt. If one of those was provided, these messages will be added to that existing prompt.
136
134
* ``role`` (string): "system", "user", "assistant", or "tool".
137
-
* ``content`` (string|object): Content of the message.
138
-
* ``tool_call_id`` (string): Identifier for tool call.
139
-
* ``tool_calls`` (array): Array of tool calls.
135
+
* ``content`` (string | array): Content of the message.
136
+
* For ``role: "system"``: Must be a string.
137
+
* For ``role: "user"``: Must be an array of content blocks, e.g., ``[{"type": "text", "text": "..."}]``.
138
+
* For ``role: "assistant"``: Must be a string (the assistant's text response). May optionally include ``tool_calls``.
139
+
* For ``role: "tool"``: Must be a string (the result of the tool call). Requires ``tool_call_id``.
140
+
* ``tool_call_id`` (string, optional): Identifier for the tool call whose result this message represents (required if ``role: "tool"``).
141
+
* ``tool_calls`` (array, optional): Array of tool calls requested by the assistant (used if ``role: "assistant"``). Each object should follow the format: ``{"id": "...", "type": "function", "function": {"name": "...", "arguments": "..."}}``. Arguments should be a JSON string.
* ``tools`` (array, optional): A list of tools the model may call. Each tool
162
+
has a ``type`` ("function") and a ``function`` object with ``name``,
163
+
``description`` (optional), and ``parameters`` (JSON schema). Example:
164
+
``[{"type": "function", "function": {"name": "get_weather", "description": "Get the current weather", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}}}]``
165
+
159
166
160
167
Example request
161
168
---------------
@@ -174,11 +181,32 @@ Response
174
181
175
182
* **HTTP status**: 200 OK
176
183
* **Content-Type**: application/json
177
-
* **Body**:
184
+
* **Body**: A JSON object containing the RAG response details.
178
185
179
186
.. code-block:: json
180
187
181
-
{"response": "The sky on Mars is red."}
188
+
{
189
+
"id": "chatcmpl-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
190
+
"model": "gpt-4-turbo-preview",
191
+
"text": "The sky on Mars typically appears butterscotch or reddish due to the fine dust particles suspended in the atmosphere.",
192
+
"finish_reason": "stop",
193
+
"usage": {
194
+
"prompt_tokens": 50,
195
+
"completion_tokens": 30,
196
+
"total_tokens": 80
197
+
},
198
+
"logprobs": null,
199
+
"tool_calls": null
200
+
}
201
+
202
+
* ``id`` (string): Unique identifier for the chat completion.
203
+
* ``model`` (string): The model used for the chat completion.
204
+
* ``text`` (string | null): The main text content of the response message.
205
+
* ``finish_reason`` (string | null): The reason the model stopped generating tokens (e.g., "stop", "length", "tool_calls").
206
+
* ``usage`` (object | null): Token usage statistics for the request.
207
+
* ``logprobs`` (object | null): Log probability information for the generated tokens (if requested).
208
+
* ``tool_calls`` (array | null): Any tool calls requested by the model. Each element contains ``id``, ``type`` ("function"), ``name``, and ``args`` (parsed JSON object).
209
+
182
210
183
211
Error response
184
212
--------------
@@ -215,7 +243,7 @@ the response in a structured format:
215
243
216
244
* Event type: ``message_start``
217
245
218
-
* Data: Starts a message, specifying identifiersand roles.
246
+
* Data: Starts a message, specifying identifiers, roles, and initial usage.
219
247
220
248
.. code-block:: json
221
249
@@ -224,15 +252,16 @@ the response in a structured format:
224
252
"message": {
225
253
"id": "<message_id>",
226
254
"role": "assistant",
227
-
"model": "<model_name>"
255
+
"model": "<model_name>",
256
+
"usage": { "prompt_tokens": 10 }
228
257
}
229
258
}
230
259
231
260
2. **Content block start**
232
261
233
262
* Event type: ``content_block_start``
234
263
235
-
* Data: Marks the beginning of a new content block.
264
+
* Data: Marks the beginning of a new content block (either text or a tool call).
236
265
237
266
.. code-block:: json
238
267
@@ -245,12 +274,27 @@ the response in a structured format:
245
274
}
246
275
}
247
276
277
+
Or for a tool call:
278
+
279
+
.. code-block:: json
280
+
281
+
{
282
+
"type": "content_block_start",
283
+
"index": 0,
284
+
"content_block": {
285
+
"id": "<tool_call_id>",
286
+
"type": "tool_use",
287
+
"name": "<function_name>",
288
+
"args": "{..."
289
+
}
290
+
}
291
+
292
+
248
293
3. **Content block delta**
249
294
250
295
* Event type: ``content_block_delta``
251
296
252
-
* Data: Incrementally updates the content, appending more text to the
253
-
message.
297
+
* Data: Incrementally updates the content, appending more text or tool arguments. Includes logprobs if requested.
254
298
255
299
.. code-block:: json
256
300
@@ -260,10 +304,24 @@ the response in a structured format:
260
304
"delta": {
261
305
"type": "text_delta",
262
306
"text": "The"
263
-
}
307
+
},
308
+
"logprobs": null
264
309
}
265
310
266
-
Subsequent ``content_block_delta`` events add more text to the message.
311
+
Or for tool arguments:
312
+
313
+
.. code-block:: json
314
+
315
+
{
316
+
"type": "content_block_delta",
317
+
"index": 0,
318
+
"delta": {
319
+
"type": "tool_call_delta",
320
+
"args": "{\"location"
321
+
}
322
+
}
323
+
324
+
Subsequent ``content_block_delta`` events add more text/arguments to the message.
267
325
268
326
4. **Content block stop**
269
327
@@ -278,7 +336,24 @@ the response in a structured format:
278
336
"index": 0
279
337
}
280
338
281
-
5. **Message stop**
339
+
5. **Message delta**
340
+
341
+
* Event type: ``message_delta``
342
+
343
+
* Data: Provides final message-level updates like the stop reason and final usage statistics.
Copy file name to clipboardExpand all lines: docs/reference/auth/index.rst
+23-7Lines changed: 23 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -267,22 +267,38 @@ If you are having trouble receiving webhooks, you might need to look for any res
267
267
Configuring SMTP
268
268
================
269
269
270
-
For email-based factors, you can configure SMTP to allow the extension to send
271
-
emails on your behalf. You should either configure SMTP, or webhooks for the
272
-
relevant events.
273
270
274
-
Here is an example of configuring SMTP for local development, using something
275
-
like `Mailpit <https://mailpit.axllent.org/docs/>`__.
271
+
For email-based factors, you can configure SMTP to allow the extension to send emails on your behalf. You should either configure SMTP, or webhooks for the relevant events.
272
+
273
+
The easiest way to configure SMTP is to use the built-in UI. Here is an example of configuring SMTP for local development using EdgeQL directly, using something like `Mailpit <https://mailpit.axllent.org/docs/>`__.
274
+
275
+
.. note:: Gel Cloud users, rejoice!
276
+
277
+
If you are using Gel Cloud, you can use the built-in development SMTP provider without any configuration. This special provider is already configured for development usage and is ready to send emails while you are developing your application. This provider is tuned specifically for development: it is rate limited and the sender is hardcoded. Do not use it in production, it will not work for that purpose.
276
278
277
279
.. code-block:: edgeql
278
280
279
-
CONFIGURE CURRENT BRANCH INSERT cfg::SMTPProviderConfig {
281
+
# Create a new SMTP provider:
282
+
#
283
+
configure current branch
284
+
insert cfg::SMTPProviderConfig {
285
+
# This name must be unique and is used to reference the provider
286
+
name := 'local_mailpit',
280
287
sender := 'hello@example.com',
281
288
host := 'localhost',
282
289
port := <int32>1025,
290
+
username := 'smtpuser',
291
+
password := 'smtppassword',
283
292
security := 'STARTTLSOrPlainText',
284
293
validate_certs := false,
285
-
};
294
+
timeout_per_email := <duration>'60 seconds',
295
+
timeout_per_attempt := <duration>'15 seconds',
296
+
};
297
+
298
+
# Set this provider as the current email provider by name:
299
+
#
300
+
configure current branch
301
+
set current_email_provider_name := 'local_mailpit';
Returns a clone of the ``Client`` instance with the specified warning handler. Some queries may generate warnings while still returning a result. The ``handler`` function will be called with an array of ``GelError`` objects whenever the client encounters warnings during query execution.
749
+
750
+
By default, the warnings are logged to the console with ``console.warn``.
751
+
752
+
:arg handler: A function that takes an array of ``GelError`` objects as its argument.
// Warning: Gel warning: possibly more than one element returned by an expression in a FILTER clause
772
+
746
773
.. js:method::close():Promise<void>
747
774
748
775
Close the client's open connections gracefully. When a client is closed, all its underlying connections are awaited to complete their pending operations, then closed. A warning is produced if the pool takes more than 60 seconds to close.
0 commit comments