A follow-up such as "now sort them by salary" builds on the earlier answers. Send the conversationId of the last answer with the next question; the table packages do this for you.
conversationId. The answer's data.conversationId names a new conversation.// On your server. `conversationId` is the last answer's; `context` is your columns.const key = process.env.GRIDSAY_SECRET_KEY;if (!key || !(key.startsWith('sk_gs_') || key.startsWith('sk_ayt_'))) throw new Error('Set GRIDSAY_SECRET_KEY to a secret key.'); // What the table shows now, read from the table just before asking: the user may have changed// it by hand since the last answer. filterOperator too: without it, the filters combine with and.const view = readTableView(); // yours: { filters, filterOperator, sorting, grouping, aggregation, pivoting } const response = await fetch('https://api.gridsay.com/api/v1/datagrid/prompt', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': key }, body: JSON.stringify({ query: 'now sort them by salary, highest first', context, conversationId, grid: { state: { filters: view.filters, filterOperator: view.filterOperator, sorting: view.sorting, grouping: view.grouping, aggregation: view.aggregation, pivoting: view.pivoting, }, }, }), redirect: 'error',});Send the view the table shows now, not the last answer: your user may have changed the table by hand, and the current view wins over the conversation. On the Data Grid endpoint, send it as grid.state with all its parts, filterOperator included: a view sent without filterOperator reaches the model as and, so an or filter would come back narrower. The TanStack Table plugin sends the view for you; the MUI X helper does when you give it apiRef.
referenceId does not separate them.A follow-up only reads turns from within your plan's request history: 30 days on Pro, 90 on Business, as your contract says on Enterprise. What is stored and when it is deleted: Data.
A new conversation starts, with a new id in the answer, when:
conversationId, or null;To start over on purpose, drop the id. Asking "start over" in the same conversation keeps the history but asks for an empty view.
A follow-up must fit the 73,728-byte limit of what the first model call for a question is sent. The question itself must fit without history; then only the newest turns that still fit are sent. The answer does not say turns were left out, and the id stays the same. On a wide table this can be only the last exchange, so make questions that depend on an older detail say it again.
| Status | Code | When | Send again unchanged? |
|---|---|---|---|
| 400 | invalid_request | conversationId is over 255 characters or not a string. | No. Fix the id. |
| 413 | context_too_large | The question is over the size limit even without history. | No. Send less context. |
An unknown id is not an error: it starts a new conversation.