config

package
v0.2.33 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFileEnv = "LANGSMITH_CONFIG_FILE"
	DefaultAPIURL = "https://api.smith.langchain.com"
)

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath() (string, error)

DefaultConfigPath returns the LangSmith CLI config path.

func MaskSecret

func MaskSecret(value string) string

MaskSecret returns a redacted value suitable for CLI output.

Types

type Config

type Config struct {
	CurrentProfile string             `json:"current_profile,omitempty"`
	Profiles       map[string]Profile `json:"profiles,omitempty"`
}

Config is the on-disk LangSmith CLI config.

func Load

func Load() (*Config, error)

Load reads the default config path. Missing files return an empty config.

func LoadFrom

func LoadFrom(path string) (*Config, error)

LoadFrom reads a config file. Missing files return an empty config.

func (*Config) ResolveProfile

func (c *Config) ResolveProfile(flagProfile, envProfile string) (string, Profile, bool)

ResolveProfile returns the active profile by precedence.

func (*Config) ResolveProfileName

func (c *Config) ResolveProfileName(flagProfile, envProfile string) string

ResolveProfileName returns the active profile name by precedence.

func (*Config) Save

func (c *Config) Save() error

Save writes the config to the default config path with owner-only permissions.

func (*Config) SaveTo

func (c *Config) SaveTo(path string) error

SaveTo writes the config to path with owner-only permissions.

type OAuth

type OAuth struct {
	AccessToken  string `json:"access_token,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
	ExpiresAt    string `json:"expires_at,omitempty"`
}

OAuth stores OAuth tokens written by `langsmith login`.

type Profile

type Profile struct {
	APIKey      string `json:"api_key,omitempty"`
	APIURL      string `json:"api_url,omitempty"`
	WorkspaceID string `json:"workspace_id,omitempty"`
	OAuth       OAuth  `json:"oauth,omitempty"`
}

Profile represents one named LangSmith CLI profile.

func (Profile) AccessToken

func (p Profile) AccessToken() string

AccessToken returns the OAuth access token to use for bearer auth.

func (Profile) TokenExpiresAtTime

func (p Profile) TokenExpiresAtTime() (time.Time, bool)

TokenExpiresAtTime parses oauth.expires_at.

func (Profile) TokenExpiresSoon

func (p Profile) TokenExpiresSoon(now time.Time, leeway time.Duration) bool

TokenExpiresSoon reports whether the access token should be refreshed.

Jump to

Keyboard shortcuts

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