Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /BerriAI_litellm /litellm /llms /valkey /common_utils.py
| """Shared helpers for Valkey integrations (semantic cache, vector stores).""" | |
| import struct | |
| from collections.abc import Sequence | |
| from typing import Final | |
| from urllib.parse import quote | |
| def build_valkey_url(host: str, port: str, password: str | None = None, ssl: bool = False) -> str: | |
| """Deliberately reads no environment: callers of the vector store control the | |
| host, so an env-sourced password would be sent to a caller-chosen server.""" | |
| credentials: Final = f":{quote(password, safe='')}@" if password else "" | |
| scheme: Final = "rediss" if ssl else "redis" | |
| return f"{scheme}://{credentials}{host}:{port}" | |
| def pack_vector(embedding: Sequence[float]) -> bytes: | |
| return struct.pack(f"<{len(embedding)}f", *embedding) | |
Xet Storage Details
- Size:
- 742 Bytes
- Xet hash:
- 652fa1ed304490f157621ab1c7ef6c890c48e8ce24108504a76c5ae666e4f187
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.