Chat integration with grid-based data structure
A data analytics system uses a grid-based data structure to improve the usability of LLMs in the analysis of large data sets, to synthesize information for use in other generative AI contexts, and to improve a user's ability to interface with an LLM. A grid-based data structure is a data structure or database that stores the results of column prompts applied to sources. The grid-based data structure may store the results in a relational manner. For example, a grid-based data structure may have rows that correspond to sources (e.g., documents, files, or databases) and columns that correspond to prompts. Each cell of the grid-based data structure stores the output of the column prompt applied to a source using an LLM. Thus, each column prompt may be systematically applied to each source to generate information based on the sources in an organized way.
1. A method comprising:
receiving a chat query from a client device associated with a user through a chat user interface, wherein the chat query comprises a text query;
accessing a grid-based data structure comprising a set of rows and a set of columns, where each row is associated with a source of a plurality of sources and each column is associated with a column prompt of a plurality of column prompts, and wherein the set of rows and set of columns define a set of cells for the grid-based data structure, and wherein each of the set of cells comprises contents from applying a column prompt of a corresponding column to a source of a corresponding row using a large language model;
identifying a subset of the set of cells that relate to the received chat query;
generating a final prompt based on contents of the identified subset of cells and the text query, wherein the final prompt comprises text instructions for a large language model to generate a response to the chat query from the user based on contents of the identified subset of the set of cells;
transmitting the final prompt to the large language model;
receiving a response from the large language model, wherein the response comprises text for a chat response to the chat query; and
transmitting the text for the chat response to the client device for display in the chat user interface.
2. The method of claim 1 , wherein the chat user interface is part of a matrix user interface displaying the grid-based data structure.
3. The method of claim 1 , further comprising:
generating the grid-based data structure based on the chat query.
4. The method of claim 1 , wherein identifying the subset of the set of cells comprises:
applying a set of rules to the set of cells to filter the plurality of sources.
5. The method of claim 4 , wherein the set of rules comprises at least one of a database query, a keyword search filter of sources, a semantic search filter of sources, or a filter on metadata fields.
6. The method of claim 4 , further comprising:
generating the set of rules by prompting the large language model to generate a set of rules for filtering sources based on information describing the plurality of sources.
7. The method of claim 6 , wherein a prompt to the large language model to generate the set of rules comprises instructions to generate computer-readable text according to a specified format.
8. The method of claim 1 , wherein identifying the subset of the set of cells comprises filtering the plurality of column prompts based on the chat query.
9. The method of claim 8 , wherein filtering the plurality of column prompts comprises:
generating an embedding for the chat query; and
comparing the embedding for the chat query to an embedding for each of the plurality of column prompts.
10. The method of claim 1 , wherein the final prompt further comprises a chat history in the chat user interface.
11. A non-transitory computer-readable medium storing instructions that, when executed by a processor, cause the processor to perform operations comprising:
receiving a chat query from a client device associated with a user through a chat user interface, wherein the chat query comprises a text query;
accessing a grid-based data structure comprising a set of rows and a set of columns, where each row is associated with a source of a plurality of sources and each column is associated with a column prompt of a plurality of column prompts, and wherein the set of rows and set of columns define a set of cells for the grid-based data structure, and wherein each of the set of cells comprises contents from applying a column prompt of a corresponding column to a source of a corresponding row using a large language model;
identifying a subset of the set of cells that relate to the received chat query;
generating a final prompt based on contents of the identified subset of cells and the text query, wherein the final prompt comprises text instructions for a large language model to generate a response to the chat query from the user based on contents of the identified subset of the set of cells;
transmitting the final prompt to the large language model;
receiving a response from the large language model, wherein the response comprises text for a chat response to the chat query; and
transmitting the text for the chat response to the client device for display in the chat user interface.
12. The computer-readable medium of claim 11 , wherein the chat user interface is part of a matrix user interface displaying the grid-based data structure.
13. The computer-readable medium of claim 11 , the operations further comprising:
generating the grid-based data structure based on the chat query.
14. The computer-readable medium of claim 11 , wherein identifying the subset of the set of cells comprises:
applying a set of rules to the set of cells to filter the plurality of sources.
15. The computer-readable medium of claim 14 , wherein the set of rules comprises at least one of a database query, a keyword search filter of sources, a semantic search filter of sources, or a filter on metadata fields.
16. The computer-readable medium of claim 14 , the operations further comprising:
generating the set of rules by prompting the large language model to generate a set of rules for filtering sources based on information describing the plurality of sources.
17. The computer-readable medium of claim 16 , wherein a prompt to the large language model to generate the set of rules comprises instructions to generate computer-readable text according to a specified format.
18. The computer-readable medium of claim 11 , wherein identifying the subset of the set of cells comprises filtering the plurality of column prompts based on the chat query.
19. The computer-readable medium of claim 18 , wherein filtering the plurality of column prompts comprises:
generating an embedding for the chat query; and
comparing the embedding for the chat query to an embedding for each of the plurality of column prompts.
20. The computer-readable medium of claim 11 , wherein the final prompt further comprises a chat history in the chat user interface.