@sanity/embeddings-index-ui 3.0.1 → 4.0.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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Sanity
3
+ Copyright (c) 2026 Sanity
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,11 +1,20 @@
1
1
  # Sanity Embeddings Index UI
2
2
 
3
- > Using this feature requires Sanity to send data to OpenAI.com, and Pinecone.io for storing vector interpretations of documents.
3
+ > ⚠️ **Deprecation Notice**
4
+ >
5
+ > The Embeddings Index API is deprecated and will be sunset in a future release. We recommend migrating to the new **Embeddings** feature, now natively available within Sanity datasets.
6
+ >
7
+ > The new Embeddings feature offers a more integrated experience with improved performance and full support going forward. **No new features or fixes will be made to this package.**
8
+ >
9
+ > If you have questions or need migration support, please [open an issue](https://github.com/sanity-io/plugins/issues) or reach out via [Sanity Community Discord](https://discord.com/servers/sanity-1304483263171264613).
10
+ ---
4
11
 
5
- Sanity Studio v3 plugins that interact with the `/embeddings-index` HTTP API.
12
+ Sanity Studio plugins that interact with the `/embeddings-index` HTTP API.
6
13
 
7
14
  The Embeddings Index API enables the creation, management, and search of named embeddings vector indexes.
8
15
 
16
+ > Using this feature requires Sanity to send data to OpenAI.com, and Pinecone.io for storing vector interpretations of documents.
17
+
9
18
  An embeddings index contains embeddings for all Sanity documents matching a configured [GROQ filter](https://www.sanity.io/docs/how-queries-work) in a dataset.
10
19
  A [GROQ projection](https://www.sanity.io/docs/query-cheat-sheet) is applied to matching documents before vectorization.
11
20
 
@@ -22,10 +31,10 @@ For a CLI alternative, check out the [Embeddings Index CLI](https://github.com/s
22
31
  npm install @sanity/embeddings-index-ui
23
32
  ```
24
33
 
25
- `@sanity/embeddings-index-ui` contains the following Sanity Studio plugins:
34
+ `@sanity/embeddings-index-ui` contains the following Sanity Studio plugins:
26
35
 
27
- * [embeddingsIndexReferenceInput](#embeddings-index-reference-input): semantic search mode for reference inputs
28
- * [embeddingsIndexDashboard](#embeddings-index-dashboard): manage indexes in a Sanity Studio UI tool
36
+ - [embeddingsIndexReferenceInput](#embeddings-index-reference-input): semantic search mode for reference inputs
37
+ - [embeddingsIndexDashboard](#embeddings-index-dashboard): manage indexes in a Sanity Studio UI tool
29
38
 
30
39
  For more information about using the plugins, see the relevant sections below.
31
40
 
@@ -61,19 +70,19 @@ defineField({
61
70
  embeddingsIndex: {
62
71
  indexName: 'my-index', // Name of the embeddings index
63
72
  maxResults: 10, // Maximum number of returned results per request. Default: 10
64
- searchMode: 'embeddings' // Sets default search mode for the field. Enables toggling between 'embeddings' (semantic search) and 'default' (default search based on GROQ filter)
65
- }
66
- }
73
+ searchMode: 'embeddings', // Sets default search mode for the field. Enables toggling between 'embeddings' (semantic search) and 'default' (default search based on GROQ filter)
74
+ },
75
+ },
67
76
  })
68
77
  ```
69
78
 
70
79
  Setting `options.embeddings.indexName` on a reference field enables searching into the named index.
71
80
 
72
- *Note*: the search uses `to` types as a filter for the index. Therefore, the types that the
81
+ _Note_: the search uses `to` types as a filter for the index. Therefore, the types that the
73
82
  the reference field expects must exist in the index: the GROQ query specified in the embeddings index
74
83
  `filter` must include one or more documents that are relevant to the reference field.
75
84
 
76
- *Caveats*: the semantic search functionality does not honor `options.filter`.
85
+ _Caveats_: the semantic search functionality does not honor `options.filter`.
77
86
 
78
87
  ### Default embeddings index configuration
79
88
 
@@ -87,11 +96,13 @@ import {embeddingsIndexReferenceInput} from '@sanity/embeddings-index-ui'
87
96
 
88
97
  export default defineConfig({
89
98
  //...
90
- plugins: [embeddingsIndexReferenceInput({
91
- indexName: 'my-index', // Inputs use 'my-index' as the default index
92
- maxResults: 15, // Inputs return max. 15 results per request
93
- searchMode: 'embeddings' // Semantic search is the default search mode
94
- })],
99
+ plugins: [
100
+ embeddingsIndexReferenceInput({
101
+ indexName: 'my-index', // Inputs use 'my-index' as the default index
102
+ maxResults: 15, // Inputs return max. 15 results per request
103
+ searchMode: 'embeddings', // Semantic search is the default search mode
104
+ }),
105
+ ],
95
106
  })
96
107
  ```
97
108
 
@@ -104,8 +115,8 @@ defineField({
104
115
  type: 'reference',
105
116
  to: [{type: 'myType'}],
106
117
  options: {
107
- embeddingsIndex: true
108
- }
118
+ embeddingsIndex: true,
119
+ },
109
120
  })
110
121
  ```
111
122
 
@@ -126,10 +137,10 @@ import {embeddingsIndexDashboard} from '@sanity/embeddings-index-ui'
126
137
 
127
138
  export default defineConfig({
128
139
  //...
129
- plugins: [
140
+ plugins: [
130
141
  process.env.NODE_ENV === 'development'
131
- ? embeddingsIndexDashboard()
132
- : {name: 'embeddings-index-dashboard-disabled'}
142
+ ? embeddingsIndexDashboard()
143
+ : {name: 'embeddings-index-dashboard-disabled'},
133
144
  ],
134
145
  })
135
146
  ```
@@ -159,18 +170,3 @@ export default defineConfig({
159
170
  ## License
160
171
 
161
172
  [MIT](LICENSE) © Sanity
162
-
163
- ## Develop and test
164
-
165
- This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
166
- with default configuration for build and watch scripts.
167
-
168
- See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
169
- on how to run this plugin with hot reload in the studio.
170
-
171
- ### Release new version
172
-
173
- Run ["CI & Release" workflow](https://github.com/sanity-io/embeddings-plugin/actions/workflows/main.yml).
174
- Make sure to select the main branch and check "Release new version".
175
-
176
- Semantic release will only release on configured branches, so it is safe to run release on any branch.
package/dist/index.d.ts CHANGED
@@ -1,74 +1,63 @@
1
- import {Plugin as Plugin_2} from 'sanity'
2
- import {SanityClient} from 'sanity'
3
-
4
- export declare function deleteIndex(indexName: string, client: SanityClient): Promise<IndexState>
5
-
6
- declare interface EmbeddingsIndexConfig {
1
+ import { SanityClient } from "sanity";
2
+ interface EmbeddingsIndexConfig {
7
3
  /**
8
4
  * Name of the index
9
5
  */
10
- indexName: string
11
- maxResults?: number
6
+ indexName: string;
7
+ maxResults?: number;
12
8
  /**
13
- * Determines if which search mode is enabled by default for the reference field.
14
- * Default is the studio default search, while 'embeddings' enables
15
- * Defaults to 'default' behaviour
9
+ * Determines which search mode is enabled by default for the reference field.
10
+ *
11
+ * - 'default': Studio's standard reference search
12
+ * - 'embeddings': Semantic search backed by the embeddings index
13
+ *
14
+ * Defaults to 'default'.
16
15
  */
17
- searchMode?: 'embeddings' | 'default'
16
+ searchMode?: 'embeddings' | 'default';
18
17
  }
19
-
20
- export declare const embeddingsIndexDashboard: Plugin_2<void>
21
-
22
- export declare const embeddingsIndexReferenceInput: Plugin_2<void | EmbeddingsIndexConfig>
23
-
24
- export declare function getIndexes(client: SanityClient): Promise<IndexState[]>
25
-
26
- export declare interface IndexState extends NamedIndex {
27
- status: string
28
- startDocumentCount: number
29
- remainingDocumentCount: number
30
- failedDocumentCount: number
31
- }
32
-
33
- export declare interface NamedIndex {
34
- indexName: string
35
- dataset: string
36
- project: string
37
- projection: string
38
- filter: string
39
- }
40
-
41
- export declare interface QueryConfig {
42
- query: string
43
- indexName: string
44
- maxResults?: number
45
- filter?: {
46
- type?: string | string[]
47
- }
48
- }
49
-
50
- export declare function queryIndex(
51
- queryConfig: QueryConfig,
52
- client: SanityClient,
53
- ): Promise<QueryResult[]>
54
-
55
- export declare interface QueryResult {
56
- score: number
57
- value: {
58
- documentId: string
59
- type: string
60
- }
61
- }
62
-
63
- export {}
64
-
65
18
  declare module 'sanity' {
66
19
  interface ReferenceBaseOptions {
67
20
  /**
68
21
  * Enables toggleable semantic search for a reference field.
69
22
  *
70
- * When `true`: will use default plugin configuration (if no config has been for the plugin provided ,this will throw an error)
23
+ * When set to `true`, the plugin will use the default plugin configuration.
24
+ * If no default configuration is provided, an error will be thrown.
71
25
  */
72
- embeddingsIndex?: true | EmbeddingsIndexConfig
26
+ embeddingsIndex?: true | EmbeddingsIndexConfig;
73
27
  }
28
+ } //# sourceMappingURL=typeDefExtensions.d.ts.map
29
+ declare const embeddingsIndexDashboard: import("sanity").Plugin<void>;
30
+ declare const embeddingsIndexReferenceInput: import("sanity").Plugin<void | EmbeddingsIndexConfig>;
31
+ interface NamedIndex {
32
+ indexName: string;
33
+ dataset: string;
34
+ project: string;
35
+ projection: string;
36
+ filter: string;
37
+ }
38
+ interface IndexState extends NamedIndex {
39
+ status: string;
40
+ startDocumentCount: number;
41
+ remainingDocumentCount: number;
42
+ failedDocumentCount: number;
43
+ }
44
+ interface QueryResult {
45
+ score: number;
46
+ value: {
47
+ documentId: string;
48
+ type: string;
49
+ };
50
+ }
51
+ interface QueryConfig {
52
+ query: string;
53
+ indexName: string;
54
+ maxResults?: number;
55
+ filter?: {
56
+ type?: string | string[];
57
+ };
74
58
  }
59
+ declare function queryIndex(queryConfig: QueryConfig, client: SanityClient): Promise<QueryResult[]>;
60
+ declare function getIndexes(client: SanityClient): Promise<IndexState[]>;
61
+ declare function deleteIndex(indexName: string, client: SanityClient): Promise<IndexState>;
62
+ export { IndexState, NamedIndex, QueryConfig, QueryResult, deleteIndex, embeddingsIndexDashboard, embeddingsIndexReferenceInput, getIndexes, queryIndex };
63
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/schemas/typeDefExtensions.ts","../src/embeddingsIndexDashboard/dashboardPlugin.ts","../src/referenceInput/referencePlugin.tsx","../src/api/embeddingsApi.ts"],"mappings":";UAEiB,qBAAA;EAAA;;;EAIf,SAAA;EACA,UAAA;EAAA;;;AASU;AACX;;;;EADC,UAAA;AAAA;AAAA;EAAA,UAKU,oBAAA;IAOsC;AAAA;;AChBlD;;;IDgBI,eAAA,UAAyB,qBAAqB;EAAA;AAAA;AAAA,cChBrC,wBAAA,mBAAwB,MAAA;AAAA,cCLxB,6BAAA,mBAA6B,MAAA,QAAA,qBAAA;AAAA,UCLzB,UAAA;EACf,SAAA;EACA,OAAA;EACA,OAAA;EACA,UAAA;EACA,MAAA;AAAA;AAAA,UAGe,UAAA,SAAmB,UAAU;EAC5C,MAAA;EACA,kBAAA;EACA,sBAAA;EACA,mBAAA;AAAA;AAAA,UAGe,WAAA;EACf,KAAA;EACA,KAAA;IACE,UAAA;IACA,IAAA;EAAA;AAAA;AAAA,UAIa,WAAA;EACf,KAAA;EACA,SAAA;EACA,UAAA;EACA,MAAA;IACE,IAAA;EAAA;AAAA;AAAA,iBAIY,UAAA,CAAW,WAAA,EAAa,WAAA,EAAa,MAAA,EAAQ,YAAA,GAAe,OAAA,CAAQ,WAAA;AAAA,iBAiBpE,UAAA,CAAW,MAAA,EAAQ,YAAA,GAAe,OAAA,CAAQ,UAAA;AAAA,iBAS1C,WAAA,CAAY,SAAA,UAAmB,MAAA,EAAQ,YAAA,GAAe,OAAA,CAAQ,UAAA"}