生成文本块的向量嵌入
(self, chunks: list[str])
| 183 | return chunks |
| 184 | |
| 185 | async def _generate_embeddings(self, chunks: list[str]) -> list[list[float]]: |
| 186 | """生成文本块的向量嵌入""" |
| 187 | logger.info(f"Generating embeddings for {len(chunks)} chunks...") |
| 188 | |
| 189 | # 批量生成嵌入(OpenAI支持批量处理) |
| 190 | embeddings = await self.embeddings.aembed_documents(chunks) |
| 191 | |
| 192 | logger.info(f"Generated {len(embeddings)} embeddings") |
| 193 | return embeddings |
| 194 | |
| 195 | async def ingest_file(self, file_path: str, workflow_id: str | None = None) -> str: |
| 196 | """导入单个文件""" |
no test coverage detected