# create_kv_docstore

> **Function** in `langchain_classic`

📖 [View in docs](https://reference.langchain.com/python/langchain-classic/storage/_lc_store/create_kv_docstore)

Create a store for langchain `Document` objects from a bytes store.

This store does run time type checking to ensure that the values are
`Document` objects.

## Signature

```python
create_kv_docstore(
    store: ByteStore,
    *,
    key_encoder: Callable[[str], str] | None = None,
) -> BaseStore[str, Document]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `store` | `ByteStore` | Yes | A bytes store to use as the underlying store. |
| `key_encoder` | `Callable[[str], str] \| None` | No | A function to encode keys; if `None`, uses identity function. (default: `None`) |

## Returns

`BaseStore[str, Document]`

A key-value store for `Document` objects.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/51e954877efd2d2c3c5bf09364dcfec8794eadb0/libs/langchain/langchain_classic/storage/_lc_store.py#L70)