Spaces:
Runtime error
Runtime error
Download chromadb/server/fastapi/utils.py from expressapi/chroma: direct link, hf CLI and curl.
- Browser
- Download file 502 Bytes
-
https://huggingface.co/spaces/expressapi/chroma/resolve/main/chromadb/server/fastapi/utils.py
- Command line
-
hf download hf://spaces/expressapi/chroma/chromadb/server/fastapi/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/expressapi/chroma/resolve/main/chromadb/server/fastapi/utils.py
502 Bytes
| from uuid import UUID | |
| from starlette.responses import JSONResponse | |
| from chromadb.errors import ChromaError, InvalidUUIDError | |
| def fastapi_json_response(error: ChromaError) -> JSONResponse: | |
| return JSONResponse( | |
| content={"error": error.name(), "message": error.message()}, | |
| status_code=error.code(), | |
| ) | |
| def string_to_uuid(uuid_str: str) -> UUID: | |
| try: | |
| return UUID(uuid_str) | |
| except ValueError: | |
| raise InvalidUUIDError(f"Could not parse {uuid_str} as a UUID") |