> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vectoraidb.actian.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure cosine similarity

> Create a collection that measures angular similarity between vectors.

Cosine similarity measures the angular relationship between vectors, ignoring magnitude. It is well suited for text embeddings where semantic meaning matters more than vector length.

The following example creates a collection named `text_embeddings` configured to use cosine similarity as its distance metric.

```python Python theme={null}
from actian_vectorai import VectorAIClient, VectorParams, Distance

# Connect to VectorAI DB server
with VectorAIClient("localhost:6574") as client:
    # Create collection with cosine similarity
    client.collections.create(
        "text_embeddings",  # Collection name
        vectors_config=VectorParams(size=128, distance=Distance.Cosine)  # Cosine metric
    )
```

```javascript JavaScript theme={null}
import { VectorAIClient } from '@actian/vectorai-client';

async function main() {
    // Connect to VectorAI DB server
    const client = new VectorAIClient('localhost:6574');

    // Create collection with cosine similarity
    await client.collections.create('text_embeddings', {
        dimension: 128,
        distanceMetric: 'COSINE'
    });
}

main().catch(console.error);
```

To confirm the collection was created successfully, call `client.collections.get_info("text_embeddings")` and check that the `status` field returns `Ready`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.