• Stars
    star
    190
  • Rank 203,739 (Top 5 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

AskBend: SQL-based Knowledge Base Search and Completion using Databend

AskBend: Leveraging Databend Cloud for Advanced AI Services

Demo https://ask.databend.rs/

AskBend is a project built in Rust that leverages the llmchain.rs library to create:

  • SQL-based knowledge base from Markdown files
  • GitHub Pull Request Summary

Setup

Setup Question&Answering

1. Download

https://github.com/datafuselabs/askbend/releases

2. Modify the configuration file conf/askbend.toml

# Usage:
# askbend -c askbend.toml

[server]
host = "0.0.0.0"
port = 8081


[qa]
# Path to the directory containing your markdown documents
path = "data/"

database = "askbend"
table = "doc"
# Data source name (DSN) for connecting to your Databend cloud warehouse
# https://docs.databend.com/using-databend-cloud/warehouses/connecting-a-warehouse
dsn = "databend://<sql-user>:<sql-password>@<your-databend-cloud-warehouse>/default"
top = 3

3. Prepare your Markdown files by copying them to the data/ directory

4. Parse the Markdown files and build embeddings

./target/release/askbend -c conf/askbend.toml --rebuild

[2023-04-01T07:17:13Z INFO ] Step-1: begin parser all markdown files
[2023-04-01T07:17:14Z INFO ] Step-1: finish parser all markdown files:397, sections:969, tokens:117758
[2023-04-01T07:17:14Z INFO ] Step-2: begin insert to table
[2023-04-01T07:17:14Z INFO ] Step-2: finish insert to table
[2023-04-01T07:17:14Z INFO ] Step-3: begin generate embedding, may take some minutes
[2023-04-01T07:26:03Z INFO ] Step-3: finish generate embedding
... ...

The --rebuild flag rebuilds all the embeddings for the data directory. This process may take a few minutes, depending on the number of Markdown files.

5. Start the API server

./target/release/askbend -c conf/askbend.toml

6. Query your Markdown knowledge base using the API

curl -X POST -H "Content-Type: application/json" -d '{"query": "tell me how to do copy"}' http://localhost:8081/qa/query

Response:

{"result":["\n\nYou can use the `COPY INTO <table>` command to copy data from an internal stage, Amazon S3 bucket, or a remote file into a table in Databend. \n\nFor example, to copy data from an internal stage, you can use the following command:\n\n```\nCOPY INTO <table>\nFROM (\n    SELECT <columns>\n    FROM @<stage>\n    FILE_FORMAT = (TYPE = PARQUET)\n)\n```\n\nFor more information, please refer to the [Tutorial: Load from an internal stage](../../12-load-data/00-stage.md) and [Tutorial: Load from an Amazon S3 bucket](../../12-load-data/01-s3.md) sections in the Databend documentation."]}

AskBend Query API

This API document describes how to use the Databend query API to submit queries and receive results.

Endpoint

http://:8081/qa/query

Request

The request body should be a JSON object containing a single field query, which is the query string.

Example:

{
    "query": "whats the fast way to load data to databend"
}

Response

On successful query execution, the API will return a 200 OK status code, along with a JSON object containing the field result.

The result field is an array of strings. However, we only need to consider the first string in the array as the final result.

The API assumes that if the query was successful, the first item in the result array is the most relevant answer.

How to open the UI

To open the UI, you need to make sure that you have installed Node and the Yarn/npm package manager. Once you have confirmed this, you can proceed with the following steps:

cd web
yarn
yarn run dev (or npm run dev)

If you want to expose your host:

yarn run dev-host (or npm run dev-host)
Setup Github Pull Request Summary

1. Download

https://github.com/datafuselabs/askbend/releases

2. Modify the configuration file conf/askbend.toml

# Usage:
# askbend -c askbend.toml

[server]
host = "0.0.0.0"
port = 8081


[github]
github_token = "your-github-token"
llm_max_tokens = 100000
# Data source name (DSN) for connecting to your Databend cloud warehouse
# https://docs.databend.com/using-databend-cloud/warehouses/connecting-a-warehouse
dsn = "databend://<sql-user>:<sql-password>@<your-databend-cloud-warehouse>/default"
repos = ["your-github-repo"]

3. Start the API server

./target/release/askbend -c conf/askbend.toml

More Repositories

1

databend

๐——๐—ฎ๐˜๐—ฎ, ๐—”๐—ป๐—ฎ๐—น๐˜†๐˜๐—ถ๐—ฐ๐˜€ & ๐—”๐—œ. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
Rust
7,710
star
2

openraft

rust raft with improvements
Rust
1,359
star
3

opendal

OpenDAL: Access data freely, painlessly, and efficiently
Rust
534
star
4

openkv

LSM based key-value store in rust, design for cloud
88
star
5

datafuse-presentations

Presentations, meetups and talks about Databend
HTML
72
star
6

jsonb

JSONB implement in rust
Rust
62
star
7

opensrv

opensrv for databend
Rust
58
star
8

bendsql

Databend Native Client
Rust
50
star
9

hackathon2022

Databend x Rust China Hackathon 2022
39
star
10

databend-perf

Databend Performance Data and Visualization
TypeScript
37
star
11

opencache

Cache server :)
Makefile
33
star
12

weekly

This week in Databend: an elastic and reliable cloud warehouse
25
star
13

databend-py

Databend Cloud Python Driver with native interface support
Python
19
star
14

databend-go

Golang driver for databend cloud
Go
19
star
15

wizard

A GPT4 powered tool for detecting bugs in Databend
Python
16
star
16

helm-charts

Helm charts for databend
Smarty
16
star
17

databend-sqlalchemy

Databend SQLAlchemy
Python
13
star
18

datafuse-operator

DataFuse operator manages fuse-query and fuse-store clusters atop Kubernetes using CRDs.
Go
13
star
19

datafuse-shop

datafuselabs brand toy, stickers, t-shirts etc. ๐Ÿค  ๐Ÿ‘• ๐Ÿ‘“
13
star
20

databend-docs

Official repository for Databend documentation
JavaScript
12
star
21

fusebots

I am a robot
Go
12
star
22

link

Links used by databend
Go
10
star
23

databend-jdbc

jdbc implementation for databend cloud
Java
10
star
24

databend-udf

Databend User-Defined Function Server SDK
Python
8
star
25

test-infra

This repository contains tools and configuration files for the testing and automation needs for Datafuse.
Go
7
star
26

jepsen.meta

databend metasrv jepsen test unit
Shell
6
star
27

databend_fiddle

Python
5
star
28

grafana-databend-datasource

Grafana Datasource Plugin for Databend
Go
4
star
29

databend-playground

TypeScript
3
star
30

summer-of-code

Summer of Code with Datafuse Labs
1
star