A package for super analysis with ByzerLLM
Project description
🚀 Super Analysis 部署指南
本指南将帮助你部署 Super Analysis 系统,包括安装必要组件、配置服务和启动系统。
📦 安装 Super Analysis
pip install -U auto-coder
pip install super_analysis-xxxx-py3-none-any.whl
注意替换下 xxxx 为版本号。
🤖 部署 Deepseek 模型代理
在启动其他服务之前,我们需要先部署 Deepseek 模型:
byzerllm deploy --pretrained_model_type saas/openai \
--cpus_per_worker 0.001 \
--gpus_per_worker 0 \
--worker_concurrency 1000 \
--num_workers 1 \
--infer_params saas.base_url="https://api.deepseek.com/v1" saas.api_key=${MODEL_DEEPSEEK_TOKEN} saas.model=deepseek-chat \
--model deepseek_chat
注意:确保已设置环境变量 MODEL_DEEPSEEK_TOKEN
。
🛠️ 部署 Byzer-SQL
参考 安装与配置 Byzer-SQL 文档 完成部署。
根据 Byzer-SQL 和大模型整合文档 中安装插件,然后注册 deepseek_chat
函数。
启动时需要在安装有 super-analysis 的 conda 环境中启动。
当 byzer-sql 部署完成后,注册账号为 hello
,然后在 byzer-sql 控制台中执行:
!byzerllm setup single;
run command as LLM.`` where
action="infer"
and reconnect="true"
and pretrainedModelType="saas/openai"
and udfName="deepseek_chat";
示例数据
下载电影数据集: https://www.kaggle.com/datasets/rounakbanik/the-movies-dataset/download?datasetVersionNumber=7
下面的指令都是在命令行里操作哈
📊 数据预处理和服务启动
- 抽取电影数据集schema:
super-analysis.convert --data_dir /Users/allwefantasy/data/movice --doc_dir /Users/allwefantasy/data/movice/schemas/
你还可以添加 --include-rows-num 5 让系统在生成 schema 文档时同时提供一些示例数据。方便大模型更好的对这个表进行认知。
- 启动 schema 文档知识库:
auto-coder.rag serve \
--model deepseek_chat --index_filter_workers 100 \
--tokenizer_path /Users/allwefantasy/Downloads/tokenizer.json \
--doc_dir /Users/allwefantasy/data/movice/schemas/ \
--port 8001
- 下载 Byzer-SQL 文档并启动文档知识库:
git clone https://github.com/allwefantasy/llm_friendly_packages
auto-coder.rag serve \
--model deepseek_chat --index_filter_workers 100 \
--tokenizer_path /Users/allwefantasy/Downloads/tokenizer.json \
--doc_dir /Users/allwefantasy/projects/llm_friendly_packages/github.com/allwefantasy \
--port 8002
- 启动兼容 OpenAI Server 的分析服务:
super-analysis.serve --served-model-name deepseek_chat --port 8000 \
--schema-rag-base-url http://127.0.0.1:8001/v1 \
--context-rag-base-url http://127.0.0.1:8002/v1 \
--byzer-sql-url http://127.0.0.1:9003/run/script
你可以通过 --sql-func-llm-model
函数单独为 SQL 函数指定模型(比如配置一个速度极快的模型)。注意,同样的,你需要在 Byzer-SQL 中注册这个函数。
现在,Super Analysis 系统已经完全部署并启动。你可以开始使用 OpenAI SDK 进行测试和接口调用。具体测试和接口使用方法请参考 openai_local_api.ipynb。
🎉 恭喜!你已经成功部署了 Super Analysis 系统。如有任何问题,请随时查阅文档或联系支持团队。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for super_analysis-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4415d105529591a0541a7de943476dd4237ee880aa7e311e4f171c94b8a7d5c7 |
|
MD5 | 1ef0b14ba3ee597d22c8a9ef5596ff27 |
|
BLAKE2b-256 | cf827f1dd71794477c4e83f0df5142b0e4da94573eaea976fe8f35b52cd0af0d |