# create_index

> **Function** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/retrievers/pinecone_hybrid_search/create_index)

Create an index from a list of contexts.

It modifies the index argument in-place!

## Signature

```python
create_index(
    contexts: List[str],
    index: Any,
    embeddings: Embeddings,
    sparse_encoder: Any,
    ids: Optional[List[str]] = None,
    metadatas: Optional[List[dict]] = None,
    namespace: Optional[str] = None,
    text_key: str = 'context',
) -> None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `contexts` | `List[str]` | Yes | List of contexts to embed. |
| `index` | `Any` | Yes | Index to use. |
| `embeddings` | `Embeddings` | Yes | Embeddings model to use. |
| `sparse_encoder` | `Any` | Yes | Sparse encoder to use. |
| `ids` | `Optional[List[str]]` | No | List of ids to use for the documents. (default: `None`) |
| `metadatas` | `Optional[List[dict]]` | No | List of metadata to use for the documents. (default: `None`) |
| `namespace` | `Optional[str]` | No | Namespace value for index partition. (default: `None`) |

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/retrievers/pinecone_hybrid_search.py#L26)