@sanity/embeddings-index-ui 3.0.1 → 4.0.1

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,21 @@
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
+
11
+ ---
4
12
 
5
- Sanity Studio v3 plugins that interact with the `/embeddings-index` HTTP API.
13
+ Sanity Studio plugins that interact with the `/embeddings-index` HTTP API.
6
14
 
7
15
  The Embeddings Index API enables the creation, management, and search of named embeddings vector indexes.
8
16
 
17
+ > Using this feature requires Sanity to send data to OpenAI.com, and Pinecone.io for storing vector interpretations of documents.
18
+
9
19
  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
20
  A [GROQ projection](https://www.sanity.io/docs/query-cheat-sheet) is applied to matching documents before vectorization.
11
21
 
@@ -22,10 +32,10 @@ For a CLI alternative, check out the [Embeddings Index CLI](https://github.com/s
22
32
  npm install @sanity/embeddings-index-ui
23
33
  ```
24
34
 
25
- `@sanity/embeddings-index-ui` contains the following Sanity Studio plugins:
35
+ `@sanity/embeddings-index-ui` contains the following Sanity Studio plugins:
26
36
 
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
37
+ - [embeddingsIndexReferenceInput](#embeddings-index-reference-input): semantic search mode for reference inputs
38
+ - [embeddingsIndexDashboard](#embeddings-index-dashboard): manage indexes in a Sanity Studio UI tool
29
39
 
30
40
  For more information about using the plugins, see the relevant sections below.
31
41
 
@@ -61,19 +71,19 @@ defineField({
61
71
  embeddingsIndex: {
62
72
  indexName: 'my-index', // Name of the embeddings index
63
73
  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
- }
74
+ searchMode: 'embeddings', // Sets default search mode for the field. Enables toggling between 'embeddings' (semantic search) and 'default' (default search based on GROQ filter)
75
+ },
76
+ },
67
77
  })
68
78
  ```
69
79
 
70
80
  Setting `options.embeddings.indexName` on a reference field enables searching into the named index.
71
81
 
72
- *Note*: the search uses `to` types as a filter for the index. Therefore, the types that the
82
+ _Note_: the search uses `to` types as a filter for the index. Therefore, the types that the
73
83
  the reference field expects must exist in the index: the GROQ query specified in the embeddings index
74
84
  `filter` must include one or more documents that are relevant to the reference field.
75
85
 
76
- *Caveats*: the semantic search functionality does not honor `options.filter`.
86
+ _Caveats_: the semantic search functionality does not honor `options.filter`.
77
87
 
78
88
  ### Default embeddings index configuration
79
89
 
@@ -87,11 +97,13 @@ import {embeddingsIndexReferenceInput} from '@sanity/embeddings-index-ui'
87
97
 
88
98
  export default defineConfig({
89
99
  //...
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
- })],
100
+ plugins: [
101
+ embeddingsIndexReferenceInput({
102
+ indexName: 'my-index', // Inputs use 'my-index' as the default index
103
+ maxResults: 15, // Inputs return max. 15 results per request
104
+ searchMode: 'embeddings', // Semantic search is the default search mode
105
+ }),
106
+ ],
95
107
  })
96
108
  ```
97
109
 
@@ -104,8 +116,8 @@ defineField({
104
116
  type: 'reference',
105
117
  to: [{type: 'myType'}],
106
118
  options: {
107
- embeddingsIndex: true
108
- }
119
+ embeddingsIndex: true,
120
+ },
109
121
  })
110
122
  ```
111
123
 
@@ -126,10 +138,10 @@ import {embeddingsIndexDashboard} from '@sanity/embeddings-index-ui'
126
138
 
127
139
  export default defineConfig({
128
140
  //...
129
- plugins: [
141
+ plugins: [
130
142
  process.env.NODE_ENV === 'development'
131
- ? embeddingsIndexDashboard()
132
- : {name: 'embeddings-index-dashboard-disabled'}
143
+ ? embeddingsIndexDashboard()
144
+ : {name: 'embeddings-index-dashboard-disabled'},
133
145
  ],
134
146
  })
135
147
  ```
@@ -159,18 +171,3 @@ export default defineConfig({
159
171
  ## License
160
172
 
161
173
  [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":";UAAiB,qBAAA;;AAAjB;;EAIE,SAAA;EACA,UAAA;EADA;;;;AAUU;AACX;;;EADC,UAAA;AAAA;AAAA;EAAA,UAIU,oBAAA;IAOsC;;AAAA;;ACblD;;IDaI,eAAA,UAAyB,qBAAqB;EAAA;AAAA;AAAA,cCbrC,wBAAA,mBAAwB,MAAA;AAAA,cCAxB,6BAAA,mBAA6B,MAAA,QAAA,qBAAA;AAAA,UCVzB,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"}