@sanity/client 7.15.0 → 7.16.0

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.
@@ -1558,7 +1558,7 @@ class ObservableDatasetsClient {
1558
1558
  * Create a new dataset with the given name
1559
1559
  *
1560
1560
  * @param name - Name of the dataset to create
1561
- * @param options - Options for the dataset
1561
+ * @param options - Options for the dataset, including optional embeddings configuration
1562
1562
  */
1563
1563
  create(name, options) {
1564
1564
  return _modify(this.#client, this.#httpRequest, "PUT", name, options);
@@ -1592,6 +1592,31 @@ class ObservableDatasetsClient {
1592
1592
  tag: null
1593
1593
  });
1594
1594
  }
1595
+ /**
1596
+ * Get embeddings settings for a dataset
1597
+ *
1598
+ * @param name - Name of the dataset
1599
+ */
1600
+ getEmbeddingsSettings(name) {
1601
+ return resourceGuard("dataset", this.#client.config()), dataset(name), _request(this.#client, this.#httpRequest, {
1602
+ uri: _embeddingsSettingsUri(this.#client, name),
1603
+ tag: null
1604
+ });
1605
+ }
1606
+ /**
1607
+ * Edit embeddings settings for a dataset
1608
+ *
1609
+ * @param name - Name of the dataset
1610
+ * @param settings - Embeddings settings to apply
1611
+ */
1612
+ editEmbeddingsSettings(name, settings) {
1613
+ return resourceGuard("dataset", this.#client.config()), dataset(name), _request(this.#client, this.#httpRequest, {
1614
+ method: "PUT",
1615
+ uri: _embeddingsSettingsUri(this.#client, name),
1616
+ body: settings,
1617
+ tag: null
1618
+ });
1619
+ }
1595
1620
  }
1596
1621
  class DatasetsClient {
1597
1622
  #client;
@@ -1603,7 +1628,7 @@ class DatasetsClient {
1603
1628
  * Create a new dataset with the given name
1604
1629
  *
1605
1630
  * @param name - Name of the dataset to create
1606
- * @param options - Options for the dataset
1631
+ * @param options - Options for the dataset, including optional embeddings configuration
1607
1632
  */
1608
1633
  create(name, options) {
1609
1634
  return resourceGuard("dataset", this.#client.config()), rxjs.lastValueFrom(
@@ -1640,6 +1665,39 @@ class DatasetsClient {
1640
1665
  _request(this.#client, this.#httpRequest, { uri, tag: null })
1641
1666
  );
1642
1667
  }
1668
+ /**
1669
+ * Get embeddings settings for a dataset
1670
+ *
1671
+ * @param name - Name of the dataset
1672
+ */
1673
+ getEmbeddingsSettings(name) {
1674
+ return resourceGuard("dataset", this.#client.config()), dataset(name), rxjs.lastValueFrom(
1675
+ _request(this.#client, this.#httpRequest, {
1676
+ uri: _embeddingsSettingsUri(this.#client, name),
1677
+ tag: null
1678
+ })
1679
+ );
1680
+ }
1681
+ /**
1682
+ * Edit embeddings settings for a dataset
1683
+ *
1684
+ * @param name - Name of the dataset
1685
+ * @param settings - Embeddings settings to apply
1686
+ */
1687
+ editEmbeddingsSettings(name, settings) {
1688
+ return resourceGuard("dataset", this.#client.config()), dataset(name), rxjs.lastValueFrom(
1689
+ _request(this.#client, this.#httpRequest, {
1690
+ method: "PUT",
1691
+ uri: _embeddingsSettingsUri(this.#client, name),
1692
+ body: settings,
1693
+ tag: null
1694
+ })
1695
+ );
1696
+ }
1697
+ }
1698
+ function _embeddingsSettingsUri(client, name) {
1699
+ const config = client.config();
1700
+ return config.useProjectHostname === !1 ? `/projects/${config.projectId}/datasets/${name}/settings/embeddings` : `/datasets/${name}/settings/embeddings`;
1643
1701
  }
1644
1702
  function _modify(client, httpRequest, method, name, options) {
1645
1703
  return resourceGuard("dataset", client.config()), dataset(name), _request(client, httpRequest, {