# uuid7

> **Function** in `langchain_core`

📖 [View in docs](https://reference.langchain.com/python/langchain-core/utils/uuid/uuid7)

Generate a UUID from a Unix timestamp in nanoseconds and random bits.

UUIDv7 objects feature monotonicity within a millisecond.

## Signature

```python
uuid7(
    nanoseconds: int | None = None,
) -> UUID
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `nanoseconds` | `int \| None` | No | Optional ns timestamp. If not provided, uses current time. (default: `None`) |

## Returns

`UUID`

A UUIDv7 object.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/fb6ab993a73180538f6cca876b3c85d46c08845f/libs/core/langchain_core/utils/uuid.py#L26)