# Algorithm

> **Class** in `langchain_azure_postgresql`

📖 [View in docs](https://reference.langchain.com/python/langchain-azure-postgresql/common/_shared/Algorithm)

Base class for vector index algorithms and their settings.

Subclasses provide index build-time settings via :meth:`build_settings` and
the default search-time settings via :meth:`default_search_params`.

The generic type parameter ``SP`` is a :class:`SearchParams` subtype that
models the search-time parameters for the algorithm.

:param op_class: The operator class to use for the vector index.
:type op_class: VectorOpClass
:param maintenance_work_mem: The amount of memory to use for maintenance operations.
:type maintenance_work_mem: str | None
:param max_parallel_maintenance_workers: The maximum number of parallel workers
                                         for maintenance operations.
:type max_parallel_maintenance_workers: NonNegativeInt | None
:param max_parallel_workers: The maximum number of parallel workers for query
                             execution.
:type max_parallel_workers: NonNegativeInt | None

## Signature

```python
Algorithm()
```

## Extends

- `BaseModel`
- `Generic[SP]`

## Properties

- `op_class`
- `maintenance_work_mem`
- `max_parallel_maintenance_workers`
- `max_parallel_workers`

## Methods

- [`default_search_params()`](https://reference.langchain.com/python/langchain-azure-postgresql/common/_shared/Algorithm/default_search_params)
- [`build_settings()`](https://reference.langchain.com/python/langchain-azure-postgresql/common/_shared/Algorithm/build_settings)
- [`index_settings()`](https://reference.langchain.com/python/langchain-azure-postgresql/common/_shared/Algorithm/index_settings)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-azure/blob/607b649e909f217be20d7a50804ca11534c08eea/libs/azure-postgresql/src/langchain_azure_postgresql/common/_shared.py#L228)