diff --git a/.env.example b/.env.example index da4a7e6..3288408 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,19 @@ +LOGGER_LEVEL=DEBUG VERSION=1.0.0 HOST=0.0.0.0 -PORT=8011 \ No newline at end of file +PORT=8011 +# LLM_API_KEY=sk-local-827ccb0eea8a706c4c34a16891f84e7b +# LLM_API_HOST=http://localhost:8022/v1 +# LLM_MODEL=Qwen2.5 +LLM_API_KEY=sk-390feb24-daee-11f0-a581-0242ac150003 +LLM_API_HOST=http://58.214.239.10:18080/app-2512170147-llm/v1 +LLM_MODEL=Qwen3-30B +EMBEDDING_API_KEY=sk-local-827ccb0eea8a706c4c34a16891f84e7b +EMBEDDING_API_HOST=http://localhost:8023/v1 +EMBEDDING_MODEL=Qwen3-Embedding +EMBEDDING_DIMS=1024 +ES_HOST=http://localhost +ES_PORT=9210 +ES_USER=elastic +ES_PASSWORD=12345 + diff --git a/search.es b/search.es index 0f14b6d..0e88da1 100644 --- a/search.es +++ b/search.es @@ -25,5 +25,21 @@ GET /test_kb/_search ] } +GET /test_kb_1/_search +{ + "size": 5, + "query": { + "match": { + "content": "美猴王" + } + }, + "_source": [ + "title", + "content", + "type", + "created_at" + ] +} + // 删除 // DELETE /test_kb \ No newline at end of file diff --git a/src/pipeline/core/utils.py b/src/pipeline/core/utils.py index b2024cf..888be1f 100644 --- a/src/pipeline/core/utils.py +++ b/src/pipeline/core/utils.py @@ -183,10 +183,7 @@ def rag_user_prompt(query: str, documents: list[dict]) -> str: 用户问题: {query} 回答要求: -1. 列出完整列表。 -2. 引用文档原文时,用“文档 i 原文: …”标注。 -3. 每条用编号列出。 -4. 如果文档中没有相关信息,请直接回复: "文档未提供相关信息"。 +一到两句话回复 """ logger.debug(prompt) return prompt diff --git a/src/tests/test_nodes.py b/src/tests/test_nodes.py index 0c308e7..c758a9c 100644 --- a/src/tests/test_nodes.py +++ b/src/tests/test_nodes.py @@ -14,17 +14,16 @@ async def test_embedding(): logger.debug("file to es") shared = { - "files": [ "./files/山海经01.txt"], + "files": [ "./files/西游记.txt"], "documents": [], # [{text, file_name, file_type, uuid, embedding}] - "index": "test_kb", + "index": "test_kb_1", } readNode = nodes.ReadDocumentsNode() chunkNode = nodes.ChunkDocumentsNode() embeddingNode = nodes.EmbeddingDocumentsNode() writeToESNode = nodes.WriteDocumentsToESNode() - readNode >> chunkNode >> embeddingNode - # >> writeToESNode + readNode >> chunkNode >> embeddingNode >> writeToESNode flow = AsyncFlow(readNode) await flow.run_async(shared) @@ -42,10 +41,10 @@ async def test_search(): logger.debug("search from es") shared = { - "text": "哪里盛产金属矿物", + "text": "哪里盛产矿石", "index": "test_kb", - "top_k": 1, - "results": [], # [{es_id, doc_id, title, type, created_at, score, content}] + "top_k": 5, + "results": [], # [{es_id, doc_id, title, type, created_at, score, content}] } embeddingNode = nodes.EmbeddingNode()