This commit is contained in:
Eugene Yurtsev
2024-07-18 17:07:11 -04:00
parent 2c5b1704ff
commit 033adfb8b3
2 changed files with 5 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
import uuid
from typing import Any, Dict, List, Optional, Sequence
from typing import Any, Dict, List, Optional, Sequence, cast
from langchain_core.documents import Document
from langchain_core.indexing import UpsertResponse
@@ -31,7 +31,7 @@ class InMemoryDocumentIndexer(DocumentIndexer):
id_ = item.id
self.store[id_] = item_
ok_ids.append(item_.id)
ok_ids.append(cast(str, item_.id))
return UpsertResponse(succeeded=ok_ids, failed=[])

View File

@@ -6,8 +6,9 @@ from abc import ABC, abstractmethod
from typing import AsyncGenerator, Generator
import pytest
from langchain_core.documents import Document
from langchain_core.indexing import DocumentIndexer
from langchain_core.indexing import DocumentIndexer, AsyncDocumentIndexer
class DocumentIndexerTestSuite(ABC):
@@ -211,7 +212,7 @@ class AsyncDocumentIndexerTestSuite(ABC):
@abstractmethod
@pytest.fixture
async def indexer(self) -> AsyncGenerator[DocumentIndexer, None]:
async def indexer(self) -> AsyncGenerator[AsyncDocumentIndexer, None]:
"""Get the indexer."""
async def test_upsert_documents_has_no_ids(self, indexer: DocumentIndexer) -> None: