20241230 AI智能体-用例学习(LlamaIndex/Ollama)
AI小白一枚,入门实行。1. Pg-Hydra
颠覆数据库体验:Hydra —— 开源的列式存储 PostgreSQL-CSDN博客
git clone https://github.com/hydradatabase/hydra && cd hydra
cp .env.example .env
docker compose up
psql postgres://postgres:hydra@127.0.0.1:5432 docker配置github仓库ghcr国内镜像加速_ghcr.io-CSDN博客
{
"registry-mirrors": ["https://ghcr.nju.edu.cn"]
} 改一下路径,用镜像
services:
hydra:
container_name: hydra
image: ghcr.nju.edu.cn/hydradatabase/hydra:latest
ports:
- ${POSTGRES_PORT}:5432
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ./volumes/db:/var/lib/postgresql/data
- ./files/postgres/postgresql.conf:/etc/postgresql/postgresql.conf
command: postgres -c 'config_file=/etc/postgresql/postgresql.conf'
2. conda 环境
- 安装conda
- 创建自定义虚拟环境
- <changeme>\anaconda3\condabin\conda_hook 文件中 conda activate XXXenv
3. jupyter lab
- 安装jupyter lab
- 快捷方式属性修改为:%windir%\system32\cmd.exe /c<changeme>\anaconda3\Scripts\jupyter.exe lab D:\<yourworkspace>
4. llamaindex / ollama
- 安装ollama, llama-index; 下载模型(随意,这里用的qwen2.5-coder,本地实行效果是代码本领确认比平常的chat要好一些)
- RAG实行数据就是网上找的DDL,
-- ===========================
-- create table ddl(s)
-- ===========================
CREATE TABLE NATION( N_NATIONKEYINTEGER NOT NULL,
N_NAME CHAR(25) NOT NULL,
N_REGIONKEYINTEGER NOT NULL,
N_COMMENT VARCHAR(152));
CREATE TABLE REGION( R_REGIONKEYINTEGER NOT NULL,
R_NAME CHAR(25) NOT NULL,
R_COMMENT VARCHAR(152));
CREATE TABLE PART( P_PARTKEY INTEGER NOT NULL,
P_NAME VARCHAR(55) NOT NULL,
P_MFGR CHAR(25) NOT NULL,
P_BRAND CHAR(10) NOT NULL,
P_TYPE VARCHAR(25) NOT NULL,
P_SIZE INTEGER NOT NULL,
P_CONTAINER CHAR(10) NOT NULL,
P_RETAILPRICE DECIMAL(15,2) NOT NULL,
P_COMMENT VARCHAR(23) NOT NULL );
CREATE TABLE SUPPLIER ( S_SUPPKEY INTEGER NOT NULL,
S_NAME CHAR(25) NOT NULL,
S_ADDRESS VARCHAR(40) NOT NULL,
S_NATIONKEY INTEGER NOT NULL,
S_PHONE CHAR(15) NOT NULL,
S_ACCTBAL DECIMAL(15,2) NOT NULL,
S_COMMENT VARCHAR(101) NOT NULL);
CREATE TABLE PARTSUPP ( PS_PARTKEY INTEGER NOT NULL,
PS_SUPPKEY INTEGER NOT NULL,
PS_AVAILQTY INTEGER NOT NULL,
PS_SUPPLYCOSTDECIMAL(15,2)NOT NULL,
PS_COMMENT VARCHAR(199) NOT NULL );
CREATE TABLE CUSTOMER ( C_CUSTKEY INTEGER NOT NULL,
C_NAME VARCHAR(25) NOT NULL,
C_ADDRESS VARCHAR(40) NOT NULL,
C_NATIONKEY INTEGER NOT NULL,
C_PHONE CHAR(15) NOT NULL,
C_ACCTBAL DECIMAL(15,2) NOT NULL,
C_MKTSEGMENTCHAR(10) NOT NULL,
C_COMMENT VARCHAR(117) NOT NULL);
CREATE TABLE ORDERS( O_ORDERKEY INTEGER NOT NULL,
O_CUSTKEY INTEGER NOT NULL,
O_ORDERSTATUS CHAR(1) NOT NULL,
O_TOTALPRICE DECIMAL(15,2) NOT NULL,
O_ORDERDATE DATE NOT NULL,
O_ORDERPRIORITYCHAR(15) NOT NULL,
O_CLERK CHAR(15) NOT NULL,
O_SHIPPRIORITY INTEGER NOT NULL,
O_COMMENT VARCHAR(79) NOT NULL);
CREATE TABLE LINEITEM ( L_ORDERKEY INTEGER NOT NULL,
L_PARTKEY INTEGER NOT NULL,
L_SUPPKEY INTEGER NOT NULL,
L_LINENUMBERINTEGER NOT NULL,
L_QUANTITY DECIMAL(15,2) NOT NULL,
L_EXTENDEDPRICEDECIMAL(15,2) NOT NULL,
L_DISCOUNT DECIMAL(15,2) NOT NULL,
L_TAX DECIMAL(15,2) NOT NULL,
L_RETURNFLAGCHAR(1) NOT NULL,
L_LINESTATUSCHAR(1) NOT NULL,
L_SHIPDATE DATE NOT NULL,
L_COMMITD
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]