refactor: 客服agent的切片结构调整重构
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import unittest
|
||||
|
||||
from rag.embedding import EmbeddingError, embed_texts
|
||||
from rag.embedding import EMBEDDING_DIMENSION, EmbeddingError, embed_texts
|
||||
|
||||
|
||||
class EmbeddingTests(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_returns_768_dimension_vectors(self):
|
||||
async def test_returns_configured_dimension_vectors(self):
|
||||
class Client:
|
||||
async def embed(self, texts):
|
||||
return [[0.1] * 768 for _ in texts]
|
||||
return [[0.1] * EMBEDDING_DIMENSION for _ in texts]
|
||||
|
||||
vectors = await embed_texts(["基金知识"], client=Client())
|
||||
|
||||
self.assertEqual(len(vectors), 1)
|
||||
self.assertEqual(len(vectors[0]), 768)
|
||||
self.assertEqual(len(vectors[0]), EMBEDDING_DIMENSION)
|
||||
|
||||
async def test_rejects_wrong_embedding_dimension(self):
|
||||
class Client:
|
||||
|
||||
Reference in New Issue
Block a user