vanna-ai 私有化部署使用实战

1. 安装python 虚拟环境

安装 Miniconda3

Step 1: 下载

$ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh

Step2: 运行脚本

$ sh Miniconda3-latest-Linux-x86_64.sh

Step3: 设置环境变量

vi /etc/profile

export PATH="/data/apps/miniconda3/bin:$PATH"

source /etc/profile

Step 4: 卸载

$ rm -rf /data/apps/miniconda3/

创建虚拟环境

//创建

conda create -n test python=3.10

退出shell 重新登录 才生效

//激活

conda activate test

//销毁

conda deactivate test

//查看

conda info --env

2. Vanna 借助 OpenAI, Marqo 生成 MySql SQL语句

2.1. Vanna三个主要基础设施
  1. Database,即需要进行查询的关系型数据库
  2. VectorDB,即需要存放RAG“模型”的向量库
  3. LLM,即需要使用的大语言模型,用来执行Text2SQL任务

2.2. 下载向量数据库marqo

docker pull docker.rainbond.cc/marqoai/marqo:latest

docker run --name marqo -it -p 8882:8882 docker.rainbond.cc/marqoai/marqo:latest

需要服务器翻墙才能从hf上下载下来

open_clip/ViT-B-32/laion2b_s34b_b79k

hf/e5-base-v2

安装marqo客户端

(test) root@ubuntu:/data/scripts# pip install marqo

测试marqo client

(test) root@ubuntu:/data/scripts# cat marqo_test.py 
import marqo

mq = marqo.Client(url='http://10.0.2.15:8882')

mq.delete_index("my-first-index")
mq.create_index("my-first-index", model="hf/e5-base-v2")

mq.index("my-first-index").add_documents([
    {
        "Title": "The Travels of Marco Polo",
        "Description": "A 13th-century travelogue describing Polo's travels"
    }, 
    {
        "Title": "Extravehicular Mobility Unit (EMU)",
        "Description": "The EMU is a spacesuit that provides environmental protection, "
                       "mobility, life support, and communications for astronauts",
        "_id": "article_591"
    }],
    tensor_fields=["Description"]
)

results = mq.index("my-first-index").search(
    q="What is the best outfit to wear on the moon?"
)
print(results)
(test) root@ubuntu:/data/scripts# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值