@eloquentops/ask-your-data

0.0.82 • Public • Published

Ask Your Data

A Custom Component for Retool that adds natural language capability to filter an array. It uses OpenAI GPT API to convert from natural language to SQL string.

npm version

Installation

Drag a Custom Component into your canvas in a Retool app.

Put this code into the IFrame Code area of the Custom Component:

<script src="https://unpkg.com/@eloquentops/retool-plugin-ask-your-data"></script>

Configuration

You can add options in the Model such this example (values are the default).

{
  dataset: {{ query1.data }},
  debug: false, // enable log and console.log for debugging purpose
  openai_token: '<YOUR-OPENAI-API-KEY>',
  groq_token: '<YOUR-GROQ-API-KEY>', // alternative to OpenAI
  question: 'Your question',
  config: [ // optional config for specific columns for manual summarization, they can have specific values or just a generic data type
    {key: 'mycol', value:'only string values'}
  ],
  skip:['name'], // optional, properties you don't want to summarize and send to the llm
  llm: 'gpt-4-turbo-preview' // optional, default is gpt-4-turbo-preview, you can change it. if you use Groq, the llm is llama3-70b-8192
  onError: 'onErrorQuery', // query to trigger on API error, useful to show notifications,
  debugConfig: false // set to true to expose "metaConfig" in model, the summarized dataset for the contextualized prompt. If true, no network request are dispatched
}

How to get the filtered results

Fair question. The component exposes some additional properties in its model:

{
  result: [], // Filtered Array of Object
  isFetching: false, // true durin the OpenAI request
  metaConfig: '' // only with debugConfig:true, a part of the prompt related to dataset summary
}

Licence

This plugin is released under the 3-Clause BSD license.

Copyright © 2024 EloquentOps, https://eloquentops.com

Readme

Keywords

none

Package Sidebar

Install

npm i @eloquentops/ask-your-data

Weekly Downloads

72

Version

0.0.82

License

ISC

Unpacked Size

112 kB

Total Files

5

Last publish

Collaborators

  • abusedmedia