braintrust 0.0.143 → 0.0.144

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # Changelog
2
+
3
+ Release notes can be found [here](https://www.braintrust.dev/docs/reference/release-notes).
package/dist/browser.js CHANGED
@@ -149,11 +149,6 @@ var LazyValue = class {
149
149
  return this.value.hasComputed;
150
150
  }
151
151
  };
152
- function _urljoin(...parts) {
153
- return parts.map(
154
- (x, i) => x.replace(/^\//, "").replace(i < parts.length - 1 ? /\/$/ : "", "")
155
- ).filter((x) => x.trim() !== "").join("/");
156
- }
157
152
 
158
153
  // src/logger.ts
159
154
  var import_mustache = __toESM(require("mustache"));
@@ -619,7 +614,7 @@ var HTTPConnection = class _HTTPConnection {
619
614
  }
620
615
  async get(path, params = void 0, config) {
621
616
  const { headers, ...rest } = config || {};
622
- const url = new URL(_urljoin(this.base_url, path));
617
+ const url = new URL((0, import_core._urljoin)(this.base_url, path));
623
618
  url.search = new URLSearchParams(
624
619
  params ? Object.fromEntries(
625
620
  Object.entries(params).filter(([_, v]) => v !== void 0)
@@ -641,7 +636,7 @@ var HTTPConnection = class _HTTPConnection {
641
636
  async post(path, params, config) {
642
637
  const { headers, ...rest } = config || {};
643
638
  return await checkResponse(
644
- await this.fetch(_urljoin(this.base_url, path), {
639
+ await this.fetch((0, import_core._urljoin)(this.base_url, path), {
645
640
  method: "POST",
646
641
  headers: {
647
642
  Accept: "application/json",
@@ -1733,7 +1728,7 @@ async function loginToState(options = {}) {
1733
1728
  let conn = null;
1734
1729
  if (apiKey !== void 0) {
1735
1730
  const resp = await checkResponse(
1736
- await fetch(_urljoin(state.appUrl, `/api/apikey/login`), {
1731
+ await fetch((0, import_core._urljoin)(state.appUrl, `/api/apikey/login`), {
1737
1732
  method: "POST",
1738
1733
  headers: {
1739
1734
  "Content-Type": "application/json",
@@ -2834,7 +2829,7 @@ var Prompt = class {
2834
2829
  ...params,
2835
2830
  ...spanInfo,
2836
2831
  messages,
2837
- ...prompt.tools ? {
2832
+ ...prompt.tools?.trim() ? {
2838
2833
  tools: import_typespecs2.toolsSchema.parse(
2839
2834
  JSON.parse(import_mustache.default.render(prompt.tools, variables))
2840
2835
  )
package/dist/browser.mjs CHANGED
@@ -42,7 +42,8 @@ import {
42
42
  SpanComponentsV2,
43
43
  SpanObjectTypeV2,
44
44
  SpanRowIdsV2,
45
- gitMetadataSettingsSchema
45
+ gitMetadataSettingsSchema,
46
+ _urljoin
46
47
  } from "@braintrust/core";
47
48
  import {
48
49
  BRAINTRUST_PARAMS,
@@ -93,11 +94,6 @@ var LazyValue = class {
93
94
  return this.value.hasComputed;
94
95
  }
95
96
  };
96
- function _urljoin(...parts) {
97
- return parts.map(
98
- (x, i) => x.replace(/^\//, "").replace(i < parts.length - 1 ? /\/$/ : "", "")
99
- ).filter((x) => x.trim() !== "").join("/");
100
- }
101
97
 
102
98
  // src/logger.ts
103
99
  import Mustache from "mustache";
@@ -2780,7 +2776,7 @@ var Prompt = class {
2780
2776
  ...params,
2781
2777
  ...spanInfo,
2782
2778
  messages,
2783
- ...prompt.tools ? {
2779
+ ...prompt.tools?.trim() ? {
2784
2780
  tools: toolsSchema.parse(
2785
2781
  JSON.parse(Mustache.render(prompt.tools, variables))
2786
2782
  )
package/dist/cli.js CHANGED
@@ -1232,8 +1232,14 @@ var require_package = __commonJS({
1232
1232
  "package.json"(exports2, module2) {
1233
1233
  module2.exports = {
1234
1234
  name: "braintrust",
1235
- version: "0.0.143",
1235
+ version: "0.0.144",
1236
1236
  description: "SDK for integrating Braintrust",
1237
+ repository: {
1238
+ type: "git",
1239
+ url: "git+https://github.com/braintrustdata/braintrust-sdk.git",
1240
+ directory: "blob/main/js"
1241
+ },
1242
+ homepage: "https://www.braintrust.dev/docs",
1237
1243
  main: "./dist/index.js",
1238
1244
  module: "./dist/index.mjs",
1239
1245
  types: "./dist/index.d.ts",
@@ -1408,11 +1414,6 @@ var LazyValue = class {
1408
1414
  return this.value.hasComputed;
1409
1415
  }
1410
1416
  };
1411
- function _urljoin(...parts) {
1412
- return parts.map(
1413
- (x, i) => x.replace(/^\//, "").replace(i < parts.length - 1 ? /\/$/ : "", "")
1414
- ).filter((x) => x.trim() !== "").join("/");
1415
- }
1416
1417
 
1417
1418
  // src/logger.ts
1418
1419
  var import_mustache = __toESM(require("mustache"));
@@ -1878,7 +1879,7 @@ var HTTPConnection = class _HTTPConnection {
1878
1879
  }
1879
1880
  async get(path5, params = void 0, config2) {
1880
1881
  const { headers, ...rest } = config2 || {};
1881
- const url = new URL(_urljoin(this.base_url, path5));
1882
+ const url = new URL((0, import_core._urljoin)(this.base_url, path5));
1882
1883
  url.search = new URLSearchParams(
1883
1884
  params ? Object.fromEntries(
1884
1885
  Object.entries(params).filter(([_, v]) => v !== void 0)
@@ -1900,7 +1901,7 @@ var HTTPConnection = class _HTTPConnection {
1900
1901
  async post(path5, params, config2) {
1901
1902
  const { headers, ...rest } = config2 || {};
1902
1903
  return await checkResponse(
1903
- await this.fetch(_urljoin(this.base_url, path5), {
1904
+ await this.fetch((0, import_core._urljoin)(this.base_url, path5), {
1904
1905
  method: "POST",
1905
1906
  headers: {
1906
1907
  Accept: "application/json",
@@ -2800,7 +2801,7 @@ async function loginToState(options = {}) {
2800
2801
  let conn = null;
2801
2802
  if (apiKey !== void 0) {
2802
2803
  const resp = await checkResponse(
2803
- await fetch2(_urljoin(state.appUrl, `/api/apikey/login`), {
2804
+ await fetch2((0, import_core._urljoin)(state.appUrl, `/api/apikey/login`), {
2804
2805
  method: "POST",
2805
2806
  headers: {
2806
2807
  "Content-Type": "application/json",
package/dist/index.js CHANGED
@@ -375,11 +375,6 @@ var LazyValue = class {
375
375
  return this.value.hasComputed;
376
376
  }
377
377
  };
378
- function _urljoin(...parts) {
379
- return parts.map(
380
- (x, i) => x.replace(/^\//, "").replace(i < parts.length - 1 ? /\/$/ : "", "")
381
- ).filter((x) => x.trim() !== "").join("/");
382
- }
383
378
 
384
379
  // src/logger.ts
385
380
  var import_mustache = __toESM(require("mustache"));
@@ -845,7 +840,7 @@ var HTTPConnection = class _HTTPConnection {
845
840
  }
846
841
  async get(path2, params = void 0, config) {
847
842
  const { headers, ...rest } = config || {};
848
- const url = new URL(_urljoin(this.base_url, path2));
843
+ const url = new URL((0, import_core._urljoin)(this.base_url, path2));
849
844
  url.search = new URLSearchParams(
850
845
  params ? Object.fromEntries(
851
846
  Object.entries(params).filter(([_, v]) => v !== void 0)
@@ -867,7 +862,7 @@ var HTTPConnection = class _HTTPConnection {
867
862
  async post(path2, params, config) {
868
863
  const { headers, ...rest } = config || {};
869
864
  return await checkResponse(
870
- await this.fetch(_urljoin(this.base_url, path2), {
865
+ await this.fetch((0, import_core._urljoin)(this.base_url, path2), {
871
866
  method: "POST",
872
867
  headers: {
873
868
  Accept: "application/json",
@@ -1959,7 +1954,7 @@ async function loginToState(options = {}) {
1959
1954
  let conn = null;
1960
1955
  if (apiKey !== void 0) {
1961
1956
  const resp = await checkResponse(
1962
- await fetch(_urljoin(state.appUrl, `/api/apikey/login`), {
1957
+ await fetch((0, import_core._urljoin)(state.appUrl, `/api/apikey/login`), {
1963
1958
  method: "POST",
1964
1959
  headers: {
1965
1960
  "Content-Type": "application/json",
@@ -3060,7 +3055,7 @@ var Prompt = class {
3060
3055
  ...params,
3061
3056
  ...spanInfo,
3062
3057
  messages,
3063
- ...prompt.tools ? {
3058
+ ...prompt.tools?.trim() ? {
3064
3059
  tools: import_typespecs2.toolsSchema.parse(
3065
3060
  JSON.parse(import_mustache.default.render(prompt.tools, variables))
3066
3061
  )
package/dist/index.mjs CHANGED
@@ -261,7 +261,8 @@ import {
261
261
  SpanComponentsV2,
262
262
  SpanObjectTypeV2,
263
263
  SpanRowIdsV2,
264
- gitMetadataSettingsSchema
264
+ gitMetadataSettingsSchema,
265
+ _urljoin
265
266
  } from "@braintrust/core";
266
267
  import {
267
268
  BRAINTRUST_PARAMS,
@@ -312,11 +313,6 @@ var LazyValue = class {
312
313
  return this.value.hasComputed;
313
314
  }
314
315
  };
315
- function _urljoin(...parts) {
316
- return parts.map(
317
- (x, i) => x.replace(/^\//, "").replace(i < parts.length - 1 ? /\/$/ : "", "")
318
- ).filter((x) => x.trim() !== "").join("/");
319
- }
320
316
 
321
317
  // src/logger.ts
322
318
  import Mustache from "mustache";
@@ -2999,7 +2995,7 @@ var Prompt = class {
2999
2995
  ...params,
3000
2996
  ...spanInfo,
3001
2997
  messages,
3002
- ...prompt.tools ? {
2998
+ ...prompt.tools?.trim() ? {
3003
2999
  tools: toolsSchema.parse(
3004
3000
  JSON.parse(Mustache.render(prompt.tools, variables))
3005
3001
  )
package/package.json CHANGED
@@ -1,7 +1,13 @@
1
1
  {
2
2
  "name": "braintrust",
3
- "version": "0.0.143",
3
+ "version": "0.0.144",
4
4
  "description": "SDK for integrating Braintrust",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/braintrustdata/braintrust-sdk.git",
8
+ "directory": "blob/main/js"
9
+ },
10
+ "homepage": "https://www.braintrust.dev/docs",
5
11
  "main": "./dist/index.js",
6
12
  "module": "./dist/index.mjs",
7
13
  "types": "./dist/index.d.ts",