Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker compose and update readme #288

Merged
merged 9 commits into from
Nov 29, 2024
Merged

Conversation

moria97
Copy link
Collaborator

@moria97 moria97 commented Nov 28, 2024

No description provided.

Copy link

github-actions bot commented Nov 28, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
6386 3554 56% 40% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: b093eb4 by action🐍

@moria97 moria97 changed the title Add docker compose and update reader Add docker compose and update readme Nov 29, 2024
docs/api.md Show resolved Hide resolved
@moria97 moria97 merged commit 18eac82 into feature Nov 29, 2024
3 checks passed
@moria97 moria97 deleted the personal/yfei/docker_compose branch November 29, 2024 12:39
environment:
DASHSCOPE_API_KEY: ${DASHSCOPE_API_KEY}
OSS_ACCESS_KEY_ID: ${OSS_ACCESS_KEY_ID}
OSS_ACCESS_KEY_SECRET: ${OSS_ACCESS_KEY_SECRET}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

什么时候用环境变量,什么时候用配置还没特别理解,比如oss key设置了,bucket还要去控制台再设置一次,用户感觉是都是oss的配置,还要两个地方配置

我也没特别想好,可以讨论下

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

包括用docker compose还是用helm,好像更近一步是不是更建议用helm?可以下一步计划里面

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

环境变量这个确实和控制台有重合。目前env不是required,感觉可以在这里写一下设置了环境变量,就不用在控制台输入这些key了。如果没设置,后面也可以在控制台手动输入。
docker compose主要是本地启动,helm确实更适合部署的时候,后面可以加一个helm的配置文件。

```bash
# Support custom host (default 0.0.0.0), port (default 8001), config (default src/pai_rag/config/settings.yaml), skip-download-models (default False)
# Download [bge-large-zh-v1.5, easyocr] by default, you can skip it by setting --skip-download-models.
# you can use tool "load_model" to download other models including [bge-large-zh-v1.5, easyocr, SGPT-125M-weightedmean-nli-bitfit, bge-large-zh-v1.5, bge-m3, bge-reranker-base, bge-reranker-large, paraphrase-multilingual-MiniLM-L12-v2, qwen_1.8b, text2vec-large-chinese]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果已经load_model了,或者之前已经下载过了;是否会自动skip

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果已经存在的模型,就会跳过,只下载本地没有的

pai_rag ui [--host HOST] [--port PORT] [rag-url RAG_URL]
```

You can also open http://127.0.0.1:8002/ to configure the RAG service and upload local data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有的地方写了localhost,有的写了127.0.0.1

@@ -103,6 +103,10 @@ def index_url(self):
def list_index_url(self):
return f"{self.endpoint}v1/indexes"

@property
def health_check_url(self):
return f"{self.endpoint}health"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用urljoin代码会更健壮些,万一endpoint末尾没有以/结尾

- ./app_data:/app/localdata
entrypoint: ["pai_rag", "serve"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

所有的api,是不是加个版本号
/api/v1/health

- upload_data

```bash
curl -X 'POST' http://127.0.0.1:8000/service/upload_data -H 'Content-Type: multipart/form-data' -F 'files=@local_path/PAI.txt'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API路径,一般都是
image

这么来设计的,这个改动看大不大,大的话,优先级可以调整下


```bash
# streaming output
curl -X 'POST' http://127.0.0.1:8000/service/query -H "Content-Type: application/json" -d '{"question":"PAI是什么?", "stream":true}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

英文的示例里面,question用英文的好点,而且示例可以用通用点的,防止用户没用这种数据,出来的结果感觉不好

使用DashScope API,需要在命令行引入环境变量

```bash
export DASHSCOPE_API_KEY=""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export DASHSCOPE_API_KEY="xxx"

下面补充下请替换xxx为你自己的DASHSCOPE_API_KEY,DASHSCOPE_API_KEY获取地址为 https://dashscope.console.aliyun.com/apiKey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants