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:
HackHuang 2025-02-14 00:41:47 +08:00 committed by GitHub
parent b82cef36a5
commit 76d32754ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,6 +59,17 @@ class InMemoryVectorStore(VectorStore):
documents = [document_1, document_2, document_3]
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:
.. code-block:: python