2024-06-04 14:06:40 +08:00
2024-01-15 12:36:42 +08:00
2024-01-15 12:36:42 +08:00
2024-06-04 11:53:37 +08:00
2024-06-04 12:28:22 +08:00
2024-06-04 14:05:23 +08:00
2024-01-15 12:36:42 +08:00
2024-01-15 12:36:42 +08:00
2024-01-15 12:36:42 +08:00
2024-01-15 12:36:42 +08:00
2024-01-15 12:36:42 +08:00

Embedding API 后端服务

独立 API 服务,为分析提供 embedding 支持

配置虚拟环境

# 创建虚拟环境
python -m venv venv

# 激活虚拟环境
./vent/bin/activate

# 安装依赖
pip install -r requirements_version.txt
# (如果没有代理,使用国内镜像安装依赖)
pip install -r requirements_version.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

运行

python main.py --host 0.0.0.0 --port 7999

使用服务

支持的 model: acge-large-zhtext-embedding-ada-002

curl 示例

curl http://localhost:7999/v1/embeddings \
  -H "Content-Type: application/json" \
  -d '{
    "input": "The food was delicious and the waiter...",
    "model": "acge-large-zh"
  }'

python 示例

from openai import OpenAI
client = OpenAI(base_url="http://localhost:7999/v1", api_key='whatever')

client.embeddings.create(
  model="acge-large-zh",
  input="The food was delicious and the waiter..."
)

详细 API 文档位于 http://localhost:7999/docs

Description
No description provided
Readme 1.2 GiB
Languages
Python 86.8%
TypeScript 7.1%
Dockerfile 4%
Shell 2.1%