mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-28 22:14:18 +00:00
core : update the class docs of InMemoryVectorStore in in_memory.py (#29781)
- **Description:** Add the new introduction about checking `store` in in_memory.py, It’s necessary and useful for beginners. ```python Check Documents: .. code-block:: python for doc in vector_store.store.values(): print(doc) ``` --------- Co-authored-by: Chester Curme <chester.curme@gmail.com>
This commit is contained in:
parent
b82cef36a5
commit
76d32754ff
@ -59,6 +59,17 @@ class InMemoryVectorStore(VectorStore):
|
|||||||
documents = [document_1, document_2, document_3]
|
documents = [document_1, document_2, document_3]
|
||||||
vector_store.add_documents(documents=documents)
|
vector_store.add_documents(documents=documents)
|
||||||
|
|
||||||
|
Inspect documents:
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
top_n = 10
|
||||||
|
for index, (id, doc) in enumerate(vector_store.store.items()):
|
||||||
|
if index < top_n:
|
||||||
|
# docs have keys 'id', 'vector', 'text', 'metadata'
|
||||||
|
print(f"{id}: {doc['text']}")
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
Delete Documents:
|
Delete Documents:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user