Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enterprise Search Demo Story #43

Open
kordless opened this issue Sep 24, 2023 · 1 comment
Open

Enterprise Search Demo Story #43

kordless opened this issue Sep 24, 2023 · 1 comment
Assignees
Labels
Milestone

Comments

@kordless
Copy link
Contributor

Requirements:

  • AI function
  • API endpoints
  • UI work
  • SQL queries to FB

Casual Use:
A user comes to the AI pages and creates a pipeline. They then, through whatever means, insert a bunch of data that is now in a table on FeatureBase. We assume the data may contain embeddings and things like keyterms, but the reality is that we don't know what the user is querying or how they will go about querying.

An input box is given to the user that appears to be a search box. At the top or bottom, this serves as user input. Next to it is a database selector pulldown.

The user may type whatever they want in the text box. When they hit enter or click submit, the text is sent to the system for processing. While typing the user will be shown "hints" from a AI method that is watching what they type. Hints, or suggestions, use a simple prompt and be submitted every 8 seconds or so. This uses a simple template with no history information to begin with.

Once the user hits enter, the text will be processed by another AI method, which classifies the query/input as well as extracting keyterms from it. If it is SQL, then the system executes the SQL on FeatureBase and puts the results in a Bootstrap table, probably striped. Another AI method that writes JavaScript might be of use here as well, by exploring the use of eval() on the page to eval the AI's code on the fly.

If the query they are asking about is related to the database and data, then a query is done to FB and any prompt data is populated with that information. A SQL query is then suggested for them that is displayed above or below the input box in a "history". The user may run this SQL by clicking on it. It might be that all queries result in some SQL being output, along with what it does.

If the query is indeterminant, and there is a currently selected database that exists, then a generalized AI method is run that accesses the current table and yanks in related texts by embedding vector similarity as well as any keterms that were extracted from the user's processed text. The user's input/query is placed at the bottom of a template that indicates that the bot is in discussion with the user and needs to respond accordingly.

Enterprise Search Use:
The user indexes data with SKUs, cost, price, product descriptions, urls, etc. They then come to the query page and type in "search for makita drills with the lowest perceived price while keeping the cost margin high". As this is a developer interface for demos, the idea that something that appears to be a good deal with a high margin is appealing to enterprise search providers, such as Home Depot.

The template is then populated with embedding weights and keyterms to pull back relevant info from the DB, and then formulates an answer that is provided via markdown to the browser for display. If the user asks a question like, which are the 3 cheapest drills, then we hope that the top entries from the cosine_distance function will contain that information (and may require the user indexes the data differently to improve results).

Both of these uses require embeddings and properly ingested data, but the general use AI template itself is quite simple (but will likely need to be tweaked):

0. you are an enterprise search engine that converses with a shopper at RVSupply, Inc.
1. the following database information is available regarding the user's input:
"""
$TEXT
"""
2. You will produce python dictionary keys named "answer" and "optional_sql" in step 3.
3. Using only a properly formatted python dictionary to answer, process the text in step 1, while keeping mind step 0, and step 2.
python_dict = 
python_dict = {
    "answer": "Here are the shirts we have in stock:\nRed T-Shirt (SKU: A001, Price: $19.99)",
    "optional_sql": "SELECT product_description, SKU, price FROM rvsupply_inventory WHERE SKU='A001';"
}

Likely Tasks:

  • changes to ai.py for new model methods
  • use complete_dict AI method
  • remainder of templates for methods
  • html and javascript changes
  • explore use of eval()
  • new endpoint for querying by API (this will be to the tables.py API handlers)
  • polling or socket connections for hints
@kordless kordless added the story label Sep 24, 2023
@kordless kordless added this to the October 15 milestone Sep 24, 2023
@kordless
Copy link
Contributor Author

"SKU": "A001",
        "product_description": "Red T-Shirt",
        "price": 19.99,
        "cost": 5.00,
        "# in stock": 150,
        "department_keyterms": ["clothing", "apparel", "shirt"]

the user is entering information in a search box, so provide three or four additional suggtions for search:

user> hi i'm looking fo

ChatGPT
Given the product information you provided, here are three or four additional suggestions for the user's search based on the product's attributes:

hi i'm looking for a Red T-Shirt.
hi i'm looking for clothing in red.
hi i'm looking for apparel under $20.
hi i'm looking for a shirt with SKU A001.
These suggestions are based on the product's description, department key terms, and other related attributes.

@kordless kordless mentioned this issue Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants