# OpenSearchSemanticCache

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/cache/OpenSearchSemanticCache)

Cache that uses OpenSearch vector store backend

## Signature

```python
OpenSearchSemanticCache(
    self,
    opensearch_url: str,
    embedding: Embeddings,
    score_threshold: float = 0.2,
    **kwargs: Any = {},
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `opensearch_url` | `str` | Yes | URL to connect to OpenSearch. |
| `embedding` | `Embedding` | Yes | Embedding provider for semantic encoding and search. |
| `score_threshold` | `(float, 0.2)` | No |  (default: `0.2`) |

## Extends

- `BaseCache`

## Constructors

```python
__init__(
    self,
    opensearch_url: str,
    embedding: Embeddings,
    score_threshold: float = 0.2,
    **kwargs: Any = {},
)
```

| Name | Type |
|------|------|
| `opensearch_url` | `str` |
| `embedding` | `Embeddings` |
| `score_threshold` | `float` |


## Properties

- `opensearch_url`
- `embedding`
- `score_threshold`
- `connection_kwargs`

## Methods

- [`lookup()`](https://reference.langchain.com/python/langchain-community/cache/OpenSearchSemanticCache/lookup)
- [`update()`](https://reference.langchain.com/python/langchain-community/cache/OpenSearchSemanticCache/update)
- [`clear()`](https://reference.langchain.com/python/langchain-community/cache/OpenSearchSemanticCache/clear)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/d5ea8358933260ad48dd31f7f8076555c7b4885a/libs/community/langchain_community/cache.py#L1942)