{"id":27928488,"url":"https://github.com/wangle201210/embedding","last_synced_at":"2025-07-04T09:03:46.541Z","repository":{"id":290687604,"uuid":"975241977","full_name":"wangle201210/embedding","owner":"wangle201210","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-30T07:37:51.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T06:07:52.895Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wangle201210.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-30T02:24:18.000Z","updated_at":"2025-05-15T13:53:03.000Z","dependencies_parsed_at":"2025-04-30T03:29:27.883Z","dependency_job_id":null,"html_url":"https://github.com/wangle201210/embedding","commit_stats":null,"previous_names":["wangle201210/embedding"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wangle201210/embedding","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangle201210%2Fembedding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangle201210%2Fembedding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangle201210%2Fembedding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangle201210%2Fembedding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wangle201210","download_url":"https://codeload.github.com/wangle201210/embedding/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangle201210%2Fembedding/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263480855,"owners_count":23473162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-07T02:10:19.284Z","updated_at":"2025-07-04T09:03:46.479Z","avatar_url":"https://github.com/wangle201210.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 文本向量化HTTP服务\n\n这是一个基于Flask的HTTP服务，用于将文本转换为稠密向量和稀疏向量。该服务使用BAAI/bge-m3模型进行向量化处理。\n\n## 安装依赖\n\n```bash\npip install -r requirements.txt\n```\n\n## 启动服务\n\n```bash\npython main.py\n```\n\n服务将在 http://localhost:5000 上运行。\n\n## API接口\n\n### 1. 文本向量化\n\n- **URL**: `/encode`\n- **方法**: POST\n- **请求体**:\n  ```json\n  {\n    \"texts\": [\"需要向量化的文本1\", \"需要向量化的文本2\"],  // 字符串数组，包含需要向量化的文本\n    \"return_dense\": true,  // 可选，是否返回稠密向量，默认为true\n    \"return_sparse\": true  // 可选，是否返回稀疏向量，默认为true\n  }\n  ```\n- **响应**:\n  ```json\n  {\n    \"dense_embeddings\": [  // 稠密向量数组（当return_dense=true时返回）\n      [...],  // 第一个文本的稠密向量\n      [...]   // 第二个文本的稠密向量\n    ],\n    \"sparse_embeddings\": [  // 稀疏向量数组（当return_sparse=true时返回）\n      {  // 第一个文本的稀疏向量\n        \"raw\": {\"token_id\": weight, ...},  // 原始token_id和权重\n        \"readable\": {\"token\": weight, ...}  // 可读的token和权重\n      },\n      {  // 第二个文本的稀疏向量\n        \"raw\": {\"token_id\": weight, ...},\n        \"readable\": {\"token\": weight, ...}\n      }\n    ],\n    \"model_info\": {\n      \"name\": \"BAAI/bge-m3\",\n      \"type\": \"hybrid_embedding\"\n    }\n  }\n  ```\n\n### 2. 健康检查\n\n- **URL**: `/health`\n- **方法**: GET\n- **响应**:\n  ```json\n  {\n    \"status\": \"ok\"\n  }\n  ```\n\n## 注意事项\n\n- 确保已登录HuggingFace，以便能够下载和使用BAAI/bge-m3模型\n- 对于Mac用户，已默认设置`use_fp16=False`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwangle201210%2Fembedding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwangle201210%2Fembedding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwangle201210%2Fembedding/lists"}