huggingface

package
v3.82.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FINEGRAINED = "fineGrained"
	WRITE       = "write"
	READ        = "read"
)

Variables

This section is empty.

Functions

func AnalyzeAndPrintPermissions added in v3.80.5

func AnalyzeAndPrintPermissions(cfg *config.Config, key string)

AnalyzePermissions prints the permissions of a HuggingFace API key

Types

type Analyzer added in v3.80.5

type Analyzer struct {
	Cfg *config.Config
}

func (Analyzer) Analyze added in v3.80.5

func (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error)

func (Analyzer) Type added in v3.80.5

type HFTokenJSON

type HFTokenJSON struct {
	Username string `json:"name"`
	Name     string `json:"fullname"`
	Orgs     []struct {
		Name         string `json:"name"`
		Role         string `json:"roleInOrg"`
		IsEnterprise bool   `json:"isEnterprise"`
	} `json:"orgs"`
	Auth struct {
		AccessToken struct {
			Name        string `json:"displayName"`
			Type        string `json:"role"`
			CreatedAt   string `json:"createdAt"`
			FineGrained struct {
				Global []string `json:"global"`
				Scoped []struct {
					Entity struct {
						Type string `json:"type"`
						Name string `json:"name"`
						ID   string `json:"_id"`
					} `json:"entity"`
					Permissions []string `json:"permissions"`
				} `json:"scoped"`
			} `json:"fineGrained"`
		}
	} `json:"auth"`
}

HFTokenJSON is the struct for the HF /whoami-v2 API JSON response

type Model

type Model struct {
	Name        string `json:"id"`
	ID          string `json:"_id"`
	Private     bool   `json:"private"`
	Permissions Permissions
}

type Permissions

type Permissions struct {
	Read  bool
	Write bool
}

type SecretInfo added in v3.80.5

type SecretInfo struct {
	Token  HFTokenJSON
	Models []Model
}

func AnalyzePermissions

func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL