Class: Braintrust::Client
- Inherits:
-
BaseClient
- Object
- BaseClient
- Braintrust::Client
- Defined in:
- lib/braintrust/client.rb
Constant Summary collapse
- DEFAULT_MAX_RETRIES =
Default max number of retries to attempt after a failed retryable request.
2
Instance Attribute Summary collapse
- #acls ⇒ Braintrust::Resources::ACLs readonly
- #ai_secrets ⇒ Braintrust::Resources::AISecrets readonly
-
#api_key ⇒ Object
readonly
Client options.
- #api_keys ⇒ Braintrust::Resources::APIKeys readonly
- #datasets ⇒ Braintrust::Resources::Datasets readonly
- #env_vars ⇒ Braintrust::Resources::EnvVars readonly
- #evals ⇒ Braintrust::Resources::Evals readonly
- #experiments ⇒ Braintrust::Resources::Experiments readonly
- #functions ⇒ Braintrust::Resources::Functions readonly
- #groups ⇒ Braintrust::Resources::Groups readonly
- #organizations ⇒ Braintrust::Resources::Organizations readonly
- #project_scores ⇒ Braintrust::Resources::ProjectScores readonly
- #project_tags ⇒ Braintrust::Resources::ProjectTags readonly
- #projects ⇒ Braintrust::Resources::Projects readonly
- #prompts ⇒ Braintrust::Resources::Prompts readonly
- #roles ⇒ Braintrust::Resources::Roles readonly
- #top_level ⇒ Braintrust::Resources::TopLevel readonly
- #users ⇒ Braintrust::Resources::Users readonly
- #views ⇒ Braintrust::Resources::Views readonly
Instance Method Summary collapse
-
#initialize(base_url: nil, api_key: nil, max_retries: nil) ⇒ Client
constructor
Creates and returns a new client for interacting with the API.
Constructor Details
#initialize(base_url: nil, api_key: nil, max_retries: nil) ⇒ Client
Creates and returns a new client for interacting with the API.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/braintrust/client.rb', line 71 def initialize(base_url: nil, api_key: nil, max_retries: nil) base_url ||= "https://api.braintrust.dev" max_retries ||= DEFAULT_MAX_RETRIES @api_key = [api_key, ENV["BRAINTRUST_API_KEY"]].find { |v| !v.nil? } super(base_url: base_url, max_retries: max_retries) @top_level = Braintrust::Resources::TopLevel.new(client: self) @projects = Braintrust::Resources::Projects.new(client: self) @experiments = Braintrust::Resources::Experiments.new(client: self) @datasets = Braintrust::Resources::Datasets.new(client: self) @prompts = Braintrust::Resources::Prompts.new(client: self) @roles = Braintrust::Resources::Roles.new(client: self) @groups = Braintrust::Resources::Groups.new(client: self) @acls = Braintrust::Resources::ACLs.new(client: self) @users = Braintrust::Resources::Users.new(client: self) @project_scores = Braintrust::Resources::ProjectScores.new(client: self) @project_tags = Braintrust::Resources::ProjectTags.new(client: self) @functions = Braintrust::Resources::Functions.new(client: self) @views = Braintrust::Resources::Views.new(client: self) @organizations = Braintrust::Resources::Organizations.new(client: self) @api_keys = Braintrust::Resources::APIKeys.new(client: self) @ai_secrets = Braintrust::Resources::AISecrets.new(client: self) @env_vars = Braintrust::Resources::EnvVars.new(client: self) @evals = Braintrust::Resources::Evals.new(client: self) end |
Instance Attribute Details
#acls ⇒ Braintrust::Resources::ACLs (readonly)
33 34 35 |
# File 'lib/braintrust/client.rb', line 33 def acls @acls end |
#ai_secrets ⇒ Braintrust::Resources::AISecrets (readonly)
57 58 59 |
# File 'lib/braintrust/client.rb', line 57 def ai_secrets @ai_secrets end |
#api_key ⇒ Object (readonly)
Client options.
9 10 11 |
# File 'lib/braintrust/client.rb', line 9 def api_key @api_key end |
#api_keys ⇒ Braintrust::Resources::APIKeys (readonly)
54 55 56 |
# File 'lib/braintrust/client.rb', line 54 def api_keys @api_keys end |
#datasets ⇒ Braintrust::Resources::Datasets (readonly)
21 22 23 |
# File 'lib/braintrust/client.rb', line 21 def datasets @datasets end |
#env_vars ⇒ Braintrust::Resources::EnvVars (readonly)
60 61 62 |
# File 'lib/braintrust/client.rb', line 60 def env_vars @env_vars end |
#evals ⇒ Braintrust::Resources::Evals (readonly)
63 64 65 |
# File 'lib/braintrust/client.rb', line 63 def evals @evals end |
#experiments ⇒ Braintrust::Resources::Experiments (readonly)
18 19 20 |
# File 'lib/braintrust/client.rb', line 18 def experiments @experiments end |
#functions ⇒ Braintrust::Resources::Functions (readonly)
45 46 47 |
# File 'lib/braintrust/client.rb', line 45 def functions @functions end |
#groups ⇒ Braintrust::Resources::Groups (readonly)
30 31 32 |
# File 'lib/braintrust/client.rb', line 30 def groups @groups end |
#organizations ⇒ Braintrust::Resources::Organizations (readonly)
51 52 53 |
# File 'lib/braintrust/client.rb', line 51 def organizations @organizations end |
#project_scores ⇒ Braintrust::Resources::ProjectScores (readonly)
39 40 41 |
# File 'lib/braintrust/client.rb', line 39 def project_scores @project_scores end |
#project_tags ⇒ Braintrust::Resources::ProjectTags (readonly)
42 43 44 |
# File 'lib/braintrust/client.rb', line 42 def @project_tags end |
#projects ⇒ Braintrust::Resources::Projects (readonly)
15 16 17 |
# File 'lib/braintrust/client.rb', line 15 def projects @projects end |
#prompts ⇒ Braintrust::Resources::Prompts (readonly)
24 25 26 |
# File 'lib/braintrust/client.rb', line 24 def prompts @prompts end |
#roles ⇒ Braintrust::Resources::Roles (readonly)
27 28 29 |
# File 'lib/braintrust/client.rb', line 27 def roles @roles end |
#top_level ⇒ Braintrust::Resources::TopLevel (readonly)
12 13 14 |
# File 'lib/braintrust/client.rb', line 12 def top_level @top_level end |
#users ⇒ Braintrust::Resources::Users (readonly)
36 37 38 |
# File 'lib/braintrust/client.rb', line 36 def users @users end |
#views ⇒ Braintrust::Resources::Views (readonly)
48 49 50 |
# File 'lib/braintrust/client.rb', line 48 def views @views end |