Creating a Chatbot using the data stored in my huge database

I’m not using functions, but I have started using Text to SQL: https://platform.openai.com/examples/default-sql-translate

If you haven’t already done so, try duplicating the example with a couple of your tables. Don’t use CREATE statements, just give it your table layout with the actual fieldnames and descriptions.

Something like this:


solrai_log table

logId: int unsigned, 10
 title: Log ID
 description: The unique integer that identifies this log record.
logUser: varchar, 25
 title: Username
 description: The user account associated with this log record.  "system" means this record was created by a system process.
logIp: varchar, 25
 title: IP
 description: The IP address of the person or entity generating this log record.  Generally not applicable to "system" processes.
logDate: varchar, 20
 ​​​​​​​title: Date
 description: Date and time log record is created.  This is the date format: 1. **ISO 8601 Format**: `2023-08-28T00:00:00`
logType: varchar, 25
 ​​​​​​​title: Type
 description: Type of log record.
  ​​​​​​​Available types:
​​​​​​​    query - query to model that normally contains the question asked and the response returned by model
    update - update of embedded (vectorized) object
    insert - insert of new embedded (vectorized) object
    ignored - process of embedded object ignored
    rank - log record ranked and ranking inserted into logRank field
    categorization - category selected for logSubject field
logSolrId: varchar, 50
 ​​​​​​​title: SolrID
 description: Solr Id of this log record, if it is an embedded object
logNid: int unsigned, 10
 ​​​​​​​title: NID
 description: The node ID that the embedded object of this record is associated with.
logModel: varchar, 40
 ​​​​​​​title: Model
 description: The LLM (large language model) used for the processing of this log record.  If it involves an embedded object and no calls are made to an LLM, then "Solr" is used as the model name as the record involves processing with the Weaviate "Solr" classname.
logTokens: int unsigned, 10
 ​​​​​​​title: Tokens
 description: Tokens used in the processing of this log record.
logDesc: longtext, 2147483647
 ​​​​​​​title: Description
 description: The description of processing executed for this log record.  If it is a query, this will contain the Question asked by the user and the Response received.  If it is an embedding process, it will contain details about the embedded object such as titie, dsid, timestamp, etc...
logNotes: varchar, 2500
 ​​​​​​​title: Notes
 description: Notes associated with this processing.
logTime: decimal, 10
 ​​​​​​​title: Elapsed Time
 description: The elapsed time required to complete this process.
logEmail: varchar, 80
 ​​​​​​​title: Email
 description: Email address of user associated with this record.
logSource: varchar, 10
​​​​​​​ title: Source
 description: This is the user source of the process, usually a "query" process.
  ​​​​​​​Known sources so far:
    ​​​​​​​docs - documentation query
    site - query executed on site
    email -  query executed via email
    sms -  query executed via sms
logRank: int unsigned, 10
 ​​​​​​​title: Rank
 description: Ranking of query, integer between 0 and 10.  Null means it has not yet been ranked.
logUrls: text, 65535
 ​​​​​​​title: URLs
 description: Full HTML URLs returned on query.
logSubject: varchar, 100
 ​​​​​​​title: Category
 description: Category title assigned to this query record.

It’s really easy. You can test this in the playground to see if it comes up with workable SQL. If so, then you just need to come up with a system message that defines your table(s) and start firing questions at the API.

Hope this helps.