Module: DurableHuggingfaceHub::Types

Defined in:
lib/durable_huggingface_hub/types.rb,
lib/durable_huggingface_hub/types.rb,
lib/durable_huggingface_hub/types/user.rb,
lib/durable_huggingface_hub/types/cache_info.rb,
lib/durable_huggingface_hub/types/model_info.rb,
lib/durable_huggingface_hub/types/space_info.rb,
lib/durable_huggingface_hub/types/commit_info.rb,
lib/durable_huggingface_hub/types/dataset_info.rb

Overview

Autoload type structures

Defined Under Namespace

Classes: CachedFileInfo, CachedRepoInfo, CachedRevisionInfo, CommitInfo, DatasetInfo, GitRefInfo, HFCacheInfo, ModelInfo, Organization, SpaceInfo, User

Constant Summary collapse

RepoId =

Repository ID type with validation.

Valid format: “organization/repository-name” or “username/repository-name” May also be just “repository-name” for models in the user’s namespace.

Examples:

Types::RepoId["bert-base-uncased"]
Types::RepoId["huggingface/transformers"]
String.constrained(min_size: 1)
RepoType =

Repository type enumeration.

Valid values: “model”, “dataset”, “space”

Examples:

Types::RepoType["model"]
Types::RepoType["dataset"]
String.enum("model", "dataset", "space")
Revision =

Revision type (branch, tag, or commit SHA).

Can be a branch name (e.g., “main”), tag (e.g., “v1.0.0”), or Git commit SHA (40 hexadecimal characters).

Examples:

Types::Revision["main"]
Types::Revision["v1.0.0"]
Types::Revision["a1b2c3d4e5f6..."]
String.constrained(min_size: 1)
StrictBool =

Strict boolean type.

Strict::Bool
OptionalString =

Optional string type.

String.optional
OptionalInteger =

Optional integer type.

Integer.optional
OptionalBool =

Optional boolean type.

Bool.optional
StringArray =

Array of strings type.

Array.of(String)
OptionalStringArray =

Optional array of strings type.

Array.of(String).optional
StringHash =

Hash with string keys type.

Hash.map(String, Any)
OptionalHash =

Optional hash type.

Hash.optional
Timestamp =

Timestamp type (Time, DateTime, or ISO 8601 string).

Time | DateTime | String
OptionalTimestamp =

Optional timestamp type.

Timestamp.optional
FileSiblings =

File siblings type (array of hashes representing files in a repository).

Array.of(Hash)
OptionalFileSiblings =

Optional file siblings type.

FileSiblings.optional
GatedType =

Gated access type (true, false, “auto”, “manual”).

Bool | String.enum("auto", "manual")
OptionalGated =

Optional gated type.

GatedType.optional
URL =

URL type for web addresses.

Accepts any string that looks like a URL.

Examples:

Types::URL["https://example.com"]
Types::URL["http://example.com/path"]
String.constrained(format: URI::DEFAULT_PARSER.make_regexp)
OptionalURL =

Optional URL type.

URL.optional
PathnameType =

Pathname type for file system paths.

Accepts strings, Pathname objects, or anything that responds to #to_path or #to_s.

Examples:

Types::PathnameType["/path/to/file"]
Types::PathnameType[Pathname.new("/path/to/file")]
Any.constructor do |value|
  case value
  when Pathname
    value
  when String
    Pathname.new(value)
  else
    Pathname.new(value.to_s)
  end
end
OptionalPathnameType =

Optional Pathname type.

PathnameType.optional