vellum-ai 0.0.25 → 0.0.27
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/Client.js +1 -1
- package/api/resources/documents/client/Client.d.ts +11 -0
- package/api/resources/documents/client/Client.js +61 -0
- package/api/resources/documents/client/requests/SetDocumentMetadataRequestBodyRequest.d.ts +11 -0
- package/api/resources/documents/client/requests/UploadDocumentBodyRequest.d.ts +2 -0
- package/api/resources/documents/client/requests/index.d.ts +1 -0
- package/api/types/DeploymentRead.d.ts +1 -0
- package/api/types/InputVariable.d.ts +9 -0
- package/api/types/InputVariableType.d.ts +14 -0
- package/api/types/InputVariableType.js +11 -0
- package/api/types/MetadataFilterConfigRequest.d.ts +15 -0
- package/api/types/MetadataFilterRuleCombinator.d.ts +12 -0
- package/api/types/MetadataFilterRuleCombinator.js +10 -0
- package/api/types/MetadataFilterRuleRequest.d.ts +15 -0
- package/api/types/ModelVersionExecConfig.d.ts +2 -2
- package/api/types/RegisterPromptPromptInfoRequest.d.ts +2 -2
- package/api/types/RegisteredPromptInputVariableRequest.d.ts +11 -0
- package/api/types/RegisteredPromptInputVariableRequest.js +5 -0
- package/api/types/SearchFiltersRequest.d.ts +3 -0
- package/api/types/SetDocumentMetadataErrorResponse.d.ts +6 -0
- package/api/types/SetDocumentMetadataErrorResponse.js +5 -0
- package/api/types/SetDocumentMetadataResponse.d.ts +7 -0
- package/api/types/SetDocumentMetadataResponse.js +5 -0
- package/api/types/index.d.ts +8 -2
- package/api/types/index.js +8 -2
- package/dist/Client.js +1 -1
- package/dist/api/resources/documents/client/Client.d.ts +11 -0
- package/dist/api/resources/documents/client/Client.js +61 -0
- package/dist/api/resources/documents/client/requests/SetDocumentMetadataRequestBodyRequest.d.ts +11 -0
- package/dist/api/resources/documents/client/requests/SetDocumentMetadataRequestBodyRequest.js +5 -0
- package/dist/api/resources/documents/client/requests/UploadDocumentBodyRequest.d.ts +2 -0
- package/dist/api/resources/documents/client/requests/index.d.ts +1 -0
- package/dist/api/types/DeploymentRead.d.ts +1 -0
- package/dist/api/types/InputVariable.d.ts +9 -0
- package/dist/api/types/InputVariable.js +5 -0
- package/dist/api/types/InputVariableType.d.ts +14 -0
- package/dist/api/types/InputVariableType.js +11 -0
- package/dist/api/types/MetadataFilterConfigRequest.d.ts +15 -0
- package/dist/api/types/MetadataFilterConfigRequest.js +5 -0
- package/dist/api/types/MetadataFilterRuleCombinator.d.ts +12 -0
- package/dist/api/types/MetadataFilterRuleCombinator.js +10 -0
- package/dist/api/types/MetadataFilterRuleRequest.d.ts +15 -0
- package/dist/api/types/MetadataFilterRuleRequest.js +5 -0
- package/dist/api/types/ModelVersionExecConfig.d.ts +2 -2
- package/dist/api/types/RegisterPromptPromptInfoRequest.d.ts +2 -2
- package/dist/api/types/RegisteredPromptInputVariableRequest.d.ts +11 -0
- package/dist/api/types/RegisteredPromptInputVariableRequest.js +5 -0
- package/dist/api/types/SearchFiltersRequest.d.ts +3 -0
- package/dist/api/types/SetDocumentMetadataErrorResponse.d.ts +6 -0
- package/dist/api/types/SetDocumentMetadataErrorResponse.js +5 -0
- package/dist/api/types/SetDocumentMetadataResponse.d.ts +7 -0
- package/dist/api/types/SetDocumentMetadataResponse.js +5 -0
- package/dist/api/types/index.d.ts +8 -2
- package/dist/api/types/index.js +8 -2
- package/dist/serialization/resources/documents/client/index.d.ts +1 -0
- package/dist/serialization/resources/documents/client/index.js +17 -0
- package/dist/serialization/resources/documents/client/requests/SetDocumentMetadataRequestBodyRequest.d.ts +14 -0
- package/dist/serialization/resources/documents/client/requests/SetDocumentMetadataRequestBodyRequest.js +35 -0
- package/dist/serialization/resources/documents/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/documents/client/requests/index.js +5 -0
- package/dist/serialization/resources/documents/index.d.ts +1 -0
- package/dist/serialization/resources/documents/index.js +17 -0
- package/dist/serialization/resources/index.d.ts +2 -0
- package/dist/serialization/resources/index.js +3 -1
- package/dist/serialization/types/DeploymentRead.d.ts +1 -0
- package/dist/serialization/types/DeploymentRead.js +1 -0
- package/dist/serialization/types/InputVariable.d.ts +14 -0
- package/dist/serialization/types/InputVariable.js +35 -0
- package/dist/serialization/types/InputVariableType.d.ts +10 -0
- package/dist/serialization/types/{PromptTemplateInputVariable.js → InputVariableType.js} +2 -4
- package/dist/serialization/types/MetadataFilterConfigRequest.d.ts +17 -0
- package/dist/serialization/types/MetadataFilterConfigRequest.js +40 -0
- package/dist/serialization/types/MetadataFilterRuleCombinator.d.ts +10 -0
- package/{serialization/types/PromptTemplateInputVariable.js → dist/serialization/types/MetadataFilterRuleCombinator.js} +2 -4
- package/dist/serialization/types/MetadataFilterRuleRequest.d.ts +17 -0
- package/dist/serialization/types/MetadataFilterRuleRequest.js +40 -0
- package/dist/serialization/types/ModelVersionExecConfig.d.ts +1 -1
- package/dist/serialization/types/ModelVersionExecConfig.js +1 -1
- package/dist/serialization/types/RegisterPromptPromptInfoRequest.d.ts +1 -1
- package/dist/serialization/types/RegisterPromptPromptInfoRequest.js +1 -1
- package/dist/serialization/types/RegisteredPromptInputVariableRequest.d.ts +14 -0
- package/dist/serialization/types/RegisteredPromptInputVariableRequest.js +35 -0
- package/dist/serialization/types/SearchFiltersRequest.d.ts +1 -0
- package/dist/serialization/types/SearchFiltersRequest.js +1 -0
- package/dist/serialization/types/SetDocumentMetadataErrorResponse.d.ts +12 -0
- package/dist/serialization/types/{PromptTemplateInputVariableRequest.js → SetDocumentMetadataErrorResponse.js} +3 -3
- package/dist/serialization/types/SetDocumentMetadataResponse.d.ts +12 -0
- package/dist/serialization/types/SetDocumentMetadataResponse.js +33 -0
- package/dist/serialization/types/index.d.ts +8 -2
- package/dist/serialization/types/index.js +8 -2
- package/package.json +1 -1
- package/serialization/resources/documents/client/index.d.ts +1 -0
- package/serialization/resources/documents/client/index.js +17 -0
- package/serialization/resources/documents/client/requests/SetDocumentMetadataRequestBodyRequest.d.ts +14 -0
- package/serialization/resources/documents/client/requests/SetDocumentMetadataRequestBodyRequest.js +35 -0
- package/serialization/resources/documents/client/requests/index.d.ts +1 -0
- package/serialization/resources/documents/client/requests/index.js +5 -0
- package/serialization/resources/documents/index.d.ts +1 -0
- package/serialization/resources/documents/index.js +17 -0
- package/serialization/resources/index.d.ts +2 -0
- package/serialization/resources/index.js +3 -1
- package/serialization/types/DeploymentRead.d.ts +1 -0
- package/serialization/types/DeploymentRead.js +1 -0
- package/serialization/types/InputVariable.d.ts +14 -0
- package/serialization/types/InputVariable.js +35 -0
- package/serialization/types/InputVariableType.d.ts +10 -0
- package/serialization/types/InputVariableType.js +31 -0
- package/serialization/types/MetadataFilterConfigRequest.d.ts +17 -0
- package/serialization/types/MetadataFilterConfigRequest.js +40 -0
- package/serialization/types/MetadataFilterRuleCombinator.d.ts +10 -0
- package/serialization/types/MetadataFilterRuleCombinator.js +31 -0
- package/serialization/types/MetadataFilterRuleRequest.d.ts +17 -0
- package/serialization/types/MetadataFilterRuleRequest.js +40 -0
- package/serialization/types/ModelVersionExecConfig.d.ts +1 -1
- package/serialization/types/ModelVersionExecConfig.js +1 -1
- package/serialization/types/RegisterPromptPromptInfoRequest.d.ts +1 -1
- package/serialization/types/RegisterPromptPromptInfoRequest.js +1 -1
- package/serialization/types/RegisteredPromptInputVariableRequest.d.ts +14 -0
- package/serialization/types/RegisteredPromptInputVariableRequest.js +35 -0
- package/serialization/types/SearchFiltersRequest.d.ts +1 -0
- package/serialization/types/SearchFiltersRequest.js +1 -0
- package/serialization/types/SetDocumentMetadataErrorResponse.d.ts +12 -0
- package/serialization/types/{PromptTemplateInputVariableRequest.js → SetDocumentMetadataErrorResponse.js} +3 -3
- package/serialization/types/SetDocumentMetadataResponse.d.ts +12 -0
- package/serialization/types/SetDocumentMetadataResponse.js +33 -0
- package/serialization/types/index.d.ts +8 -2
- package/serialization/types/index.js +8 -2
- package/api/types/PromptTemplateInputVariable.d.ts +0 -7
- package/api/types/PromptTemplateInputVariableRequest.d.ts +0 -7
- package/dist/api/types/PromptTemplateInputVariable.d.ts +0 -7
- package/dist/api/types/PromptTemplateInputVariableRequest.d.ts +0 -7
- package/dist/serialization/types/PromptTemplateInputVariable.d.ts +0 -12
- package/dist/serialization/types/PromptTemplateInputVariableRequest.d.ts +0 -12
- package/serialization/types/PromptTemplateInputVariable.d.ts +0 -12
- package/serialization/types/PromptTemplateInputVariableRequest.d.ts +0 -12
- /package/api/{types/PromptTemplateInputVariable.js → resources/documents/client/requests/SetDocumentMetadataRequestBodyRequest.js} +0 -0
- /package/api/types/{PromptTemplateInputVariableRequest.js → InputVariable.js} +0 -0
- /package/{dist/api/types/PromptTemplateInputVariable.js → api/types/MetadataFilterConfigRequest.js} +0 -0
- /package/{dist/api/types/PromptTemplateInputVariableRequest.js → api/types/MetadataFilterRuleRequest.js} +0 -0
package/Client.js
CHANGED
|
@@ -197,7 +197,7 @@ class VellumClient {
|
|
|
197
197
|
*/
|
|
198
198
|
async search(request) {
|
|
199
199
|
const _response = await core.fetcher({
|
|
200
|
-
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).
|
|
200
|
+
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).default, "v1/search"),
|
|
201
201
|
method: "POST",
|
|
202
202
|
headers: {
|
|
203
203
|
X_API_KEY: await core.Supplier.get(this.options.apiKey),
|
|
@@ -23,6 +23,17 @@ export declare class Documents {
|
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
25
|
list(request?: Vellum.DocumentsListRequest): Promise<Vellum.PaginatedSlimDocumentList>;
|
|
26
|
+
/**
|
|
27
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
28
|
+
*
|
|
29
|
+
* Set the metadata for a document to be used for search filtering.
|
|
30
|
+
*
|
|
31
|
+
* **Note:** Uses a base url of `https://documents.vellum.ai`.
|
|
32
|
+
* @throws {Vellum.BadRequestError}
|
|
33
|
+
* @throws {Vellum.NotFoundError}
|
|
34
|
+
* @throws {Vellum.InternalServerError}
|
|
35
|
+
*/
|
|
36
|
+
setDocumentMetadata(request: Vellum.SetDocumentMetadataRequestBodyRequest): Promise<Vellum.SetDocumentMetadataResponse>;
|
|
26
37
|
/**
|
|
27
38
|
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
28
39
|
*
|
|
@@ -101,6 +101,64 @@ class Documents {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
106
|
+
*
|
|
107
|
+
* Set the metadata for a document to be used for search filtering.
|
|
108
|
+
*
|
|
109
|
+
* **Note:** Uses a base url of `https://documents.vellum.ai`.
|
|
110
|
+
* @throws {Vellum.BadRequestError}
|
|
111
|
+
* @throws {Vellum.NotFoundError}
|
|
112
|
+
* @throws {Vellum.InternalServerError}
|
|
113
|
+
*/
|
|
114
|
+
async setDocumentMetadata(request) {
|
|
115
|
+
const _response = await core.fetcher({
|
|
116
|
+
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).documents, "v1/set-document-metadata"),
|
|
117
|
+
method: "POST",
|
|
118
|
+
headers: {
|
|
119
|
+
X_API_KEY: await core.Supplier.get(this.options.apiKey),
|
|
120
|
+
},
|
|
121
|
+
contentType: "application/json",
|
|
122
|
+
body: await serializers.SetDocumentMetadataRequestBodyRequest.jsonOrThrow(request, {
|
|
123
|
+
unrecognizedObjectKeys: "strip",
|
|
124
|
+
}),
|
|
125
|
+
});
|
|
126
|
+
if (_response.ok) {
|
|
127
|
+
return await serializers.SetDocumentMetadataResponse.parseOrThrow(_response.body, {
|
|
128
|
+
unrecognizedObjectKeys: "passthrough",
|
|
129
|
+
allowUnrecognizedUnionMembers: true,
|
|
130
|
+
allowUnrecognizedEnumValues: true,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
if (_response.error.reason === "status-code") {
|
|
134
|
+
switch (_response.error.statusCode) {
|
|
135
|
+
case 400:
|
|
136
|
+
throw new Vellum.BadRequestError(_response.error.body);
|
|
137
|
+
case 404:
|
|
138
|
+
throw new Vellum.NotFoundError(_response.error.body);
|
|
139
|
+
case 500:
|
|
140
|
+
throw new Vellum.InternalServerError(_response.error.body);
|
|
141
|
+
default:
|
|
142
|
+
throw new errors.VellumError({
|
|
143
|
+
statusCode: _response.error.statusCode,
|
|
144
|
+
body: _response.error.body,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
switch (_response.error.reason) {
|
|
149
|
+
case "non-json":
|
|
150
|
+
throw new errors.VellumError({
|
|
151
|
+
statusCode: _response.error.statusCode,
|
|
152
|
+
body: _response.error.rawBody,
|
|
153
|
+
});
|
|
154
|
+
case "timeout":
|
|
155
|
+
throw new errors.VellumTimeoutError();
|
|
156
|
+
case "unknown":
|
|
157
|
+
throw new errors.VellumError({
|
|
158
|
+
message: _response.error.errorMessage,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
104
162
|
/**
|
|
105
163
|
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
106
164
|
*
|
|
@@ -128,6 +186,9 @@ class Documents {
|
|
|
128
186
|
_request.append("keywords", _item);
|
|
129
187
|
}
|
|
130
188
|
}
|
|
189
|
+
if (request.metadata != null) {
|
|
190
|
+
_request.append("metadata", request.metadata);
|
|
191
|
+
}
|
|
131
192
|
const _response = await core.fetcher({
|
|
132
193
|
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).documents, "v1/upload-document"),
|
|
133
194
|
method: "POST",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface SetDocumentMetadataRequestBodyRequest {
|
|
5
|
+
/** The ID of the document to update. Must provide either this or `external_id` */
|
|
6
|
+
documentId?: string;
|
|
7
|
+
/** The external ID of the document to update. Must provide either this or `document_id` */
|
|
8
|
+
externalId?: string;
|
|
9
|
+
/** The metadata to set on the document. This will overwrite any existing metadata. */
|
|
10
|
+
metadata: Record<string, unknown>;
|
|
11
|
+
}
|
|
@@ -10,4 +10,6 @@ export interface UploadDocumentBodyRequest {
|
|
|
10
10
|
label: string;
|
|
11
11
|
/** Optionally include a list of keywords that'll be associated with this document. Used when performing keyword searches. */
|
|
12
12
|
keywords?: string[];
|
|
13
|
+
/** A stringified JSON object containing any metadata associated with the document that you'd like to filter upon later. */
|
|
14
|
+
metadata?: string;
|
|
13
15
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* * `STRING` - STRING
|
|
6
|
+
* * `JSON` - JSON
|
|
7
|
+
* * `CHAT_HISTORY` - CHAT_HISTORY
|
|
8
|
+
*/
|
|
9
|
+
export declare type InputVariableType = "STRING" | "JSON" | "CHAT_HISTORY";
|
|
10
|
+
export declare const InputVariableType: {
|
|
11
|
+
readonly String: "STRING";
|
|
12
|
+
readonly Json: "JSON";
|
|
13
|
+
readonly ChatHistory: "CHAT_HISTORY";
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InputVariableType = void 0;
|
|
7
|
+
exports.InputVariableType = {
|
|
8
|
+
String: "STRING",
|
|
9
|
+
Json: "JSON",
|
|
10
|
+
ChatHistory: "CHAT_HISTORY",
|
|
11
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Vellum from "..";
|
|
5
|
+
export interface MetadataFilterConfigRequest {
|
|
6
|
+
combinator?: Vellum.MetadataFilterRuleCombinator;
|
|
7
|
+
negated?: boolean;
|
|
8
|
+
rules?: Vellum.MetadataFilterRuleRequest[];
|
|
9
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
10
|
+
field?: string;
|
|
11
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
12
|
+
operator?: string;
|
|
13
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
14
|
+
value?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* * `and` - AND
|
|
6
|
+
* * `or` - OR
|
|
7
|
+
*/
|
|
8
|
+
export declare type MetadataFilterRuleCombinator = "and" | "or";
|
|
9
|
+
export declare const MetadataFilterRuleCombinator: {
|
|
10
|
+
readonly And: "and";
|
|
11
|
+
readonly Or: "or";
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MetadataFilterRuleCombinator = void 0;
|
|
7
|
+
exports.MetadataFilterRuleCombinator = {
|
|
8
|
+
And: "and",
|
|
9
|
+
Or: "or",
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Vellum from "..";
|
|
5
|
+
export interface MetadataFilterRuleRequest {
|
|
6
|
+
combinator?: Vellum.MetadataFilterRuleCombinator;
|
|
7
|
+
negated?: boolean;
|
|
8
|
+
rules?: Vellum.MetadataFilterRuleRequest[];
|
|
9
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
10
|
+
field?: string;
|
|
11
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
12
|
+
operator?: string;
|
|
13
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
14
|
+
value?: string;
|
|
15
|
+
}
|
|
@@ -5,8 +5,8 @@ import * as Vellum from "..";
|
|
|
5
5
|
export interface ModelVersionExecConfig {
|
|
6
6
|
/** The generation parameters that are passed to the LLM provider at runtime. */
|
|
7
7
|
parameters: Vellum.ModelVersionExecConfigParameters;
|
|
8
|
-
/**
|
|
9
|
-
inputVariables: Vellum.
|
|
8
|
+
/** Input variables specified in the prompt template. */
|
|
9
|
+
inputVariables: Vellum.InputVariable[];
|
|
10
10
|
/** The template used to generate prompts for this model version. */
|
|
11
11
|
promptTemplate?: string;
|
|
12
12
|
promptBlockData?: Vellum.PromptTemplateBlockData;
|
|
@@ -5,6 +5,6 @@ import * as Vellum from "..";
|
|
|
5
5
|
export interface RegisterPromptPromptInfoRequest {
|
|
6
6
|
promptSyntaxVersion?: number;
|
|
7
7
|
promptBlockData: Vellum.PromptTemplateBlockDataRequest;
|
|
8
|
-
/**
|
|
9
|
-
inputVariables: Vellum.
|
|
8
|
+
/** The input variables specified in the prompt template. */
|
|
9
|
+
inputVariables: Vellum.RegisteredPromptInputVariableRequest[];
|
|
10
10
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Vellum from "..";
|
|
5
|
+
export interface RegisteredPromptInputVariableRequest {
|
|
6
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
7
|
+
key: string;
|
|
8
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
9
|
+
id?: string;
|
|
10
|
+
type?: Vellum.InputVariableType;
|
|
11
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as Vellum from "..";
|
|
4
5
|
export interface SearchFiltersRequest {
|
|
5
6
|
/** The document external IDs to filter by */
|
|
6
7
|
externalIds?: string[];
|
|
8
|
+
/** The metadata filters to apply to the search */
|
|
9
|
+
metadata?: Vellum.MetadataFilterConfigRequest;
|
|
7
10
|
}
|
package/api/types/index.d.ts
CHANGED
|
@@ -30,7 +30,12 @@ export * from "./GenerateStreamResponse";
|
|
|
30
30
|
export * from "./GenerateStreamResult";
|
|
31
31
|
export * from "./GenerateStreamResultData";
|
|
32
32
|
export * from "./IndexingStateEnum";
|
|
33
|
+
export * from "./InputVariable";
|
|
34
|
+
export * from "./InputVariableType";
|
|
33
35
|
export * from "./LogprobsEnum";
|
|
36
|
+
export * from "./MetadataFilterConfigRequest";
|
|
37
|
+
export * from "./MetadataFilterRuleCombinator";
|
|
38
|
+
export * from "./MetadataFilterRuleRequest";
|
|
34
39
|
export * from "./ModelTypeEnum";
|
|
35
40
|
export * from "./ModelVersionBuildConfig";
|
|
36
41
|
export * from "./ModelVersionCompilePromptResponse";
|
|
@@ -53,8 +58,6 @@ export * from "./PromptTemplateBlockDataRequest";
|
|
|
53
58
|
export * from "./PromptTemplateBlockProperties";
|
|
54
59
|
export * from "./PromptTemplateBlockPropertiesRequest";
|
|
55
60
|
export * from "./PromptTemplateBlockRequest";
|
|
56
|
-
export * from "./PromptTemplateInputVariable";
|
|
57
|
-
export * from "./PromptTemplateInputVariableRequest";
|
|
58
61
|
export * from "./ProviderEnum";
|
|
59
62
|
export * from "./RegisterPromptErrorResponse";
|
|
60
63
|
export * from "./RegisterPromptModelParametersRequest";
|
|
@@ -62,6 +65,7 @@ export * from "./RegisterPromptPrompt";
|
|
|
62
65
|
export * from "./RegisterPromptPromptInfoRequest";
|
|
63
66
|
export * from "./RegisterPromptResponse";
|
|
64
67
|
export * from "./RegisteredPromptDeployment";
|
|
68
|
+
export * from "./RegisteredPromptInputVariableRequest";
|
|
65
69
|
export * from "./RegisteredPromptModelVersion";
|
|
66
70
|
export * from "./RegisteredPromptSandbox";
|
|
67
71
|
export * from "./RegisteredPromptSandboxSnapshot";
|
|
@@ -82,6 +86,8 @@ export * from "./SearchResponse";
|
|
|
82
86
|
export * from "./SearchResult";
|
|
83
87
|
export * from "./SearchResultMergingRequest";
|
|
84
88
|
export * from "./SearchWeightsRequest";
|
|
89
|
+
export * from "./SetDocumentMetadataErrorResponse";
|
|
90
|
+
export * from "./SetDocumentMetadataResponse";
|
|
85
91
|
export * from "./SlimDocument";
|
|
86
92
|
export * from "./SlimDocumentStatusEnum";
|
|
87
93
|
export * from "./SubmitCompletionActualRequest";
|
package/api/types/index.js
CHANGED
|
@@ -46,7 +46,12 @@ __exportStar(require("./GenerateStreamResponse"), exports);
|
|
|
46
46
|
__exportStar(require("./GenerateStreamResult"), exports);
|
|
47
47
|
__exportStar(require("./GenerateStreamResultData"), exports);
|
|
48
48
|
__exportStar(require("./IndexingStateEnum"), exports);
|
|
49
|
+
__exportStar(require("./InputVariable"), exports);
|
|
50
|
+
__exportStar(require("./InputVariableType"), exports);
|
|
49
51
|
__exportStar(require("./LogprobsEnum"), exports);
|
|
52
|
+
__exportStar(require("./MetadataFilterConfigRequest"), exports);
|
|
53
|
+
__exportStar(require("./MetadataFilterRuleCombinator"), exports);
|
|
54
|
+
__exportStar(require("./MetadataFilterRuleRequest"), exports);
|
|
50
55
|
__exportStar(require("./ModelTypeEnum"), exports);
|
|
51
56
|
__exportStar(require("./ModelVersionBuildConfig"), exports);
|
|
52
57
|
__exportStar(require("./ModelVersionCompilePromptResponse"), exports);
|
|
@@ -69,8 +74,6 @@ __exportStar(require("./PromptTemplateBlockDataRequest"), exports);
|
|
|
69
74
|
__exportStar(require("./PromptTemplateBlockProperties"), exports);
|
|
70
75
|
__exportStar(require("./PromptTemplateBlockPropertiesRequest"), exports);
|
|
71
76
|
__exportStar(require("./PromptTemplateBlockRequest"), exports);
|
|
72
|
-
__exportStar(require("./PromptTemplateInputVariable"), exports);
|
|
73
|
-
__exportStar(require("./PromptTemplateInputVariableRequest"), exports);
|
|
74
77
|
__exportStar(require("./ProviderEnum"), exports);
|
|
75
78
|
__exportStar(require("./RegisterPromptErrorResponse"), exports);
|
|
76
79
|
__exportStar(require("./RegisterPromptModelParametersRequest"), exports);
|
|
@@ -78,6 +81,7 @@ __exportStar(require("./RegisterPromptPrompt"), exports);
|
|
|
78
81
|
__exportStar(require("./RegisterPromptPromptInfoRequest"), exports);
|
|
79
82
|
__exportStar(require("./RegisterPromptResponse"), exports);
|
|
80
83
|
__exportStar(require("./RegisteredPromptDeployment"), exports);
|
|
84
|
+
__exportStar(require("./RegisteredPromptInputVariableRequest"), exports);
|
|
81
85
|
__exportStar(require("./RegisteredPromptModelVersion"), exports);
|
|
82
86
|
__exportStar(require("./RegisteredPromptSandbox"), exports);
|
|
83
87
|
__exportStar(require("./RegisteredPromptSandboxSnapshot"), exports);
|
|
@@ -98,6 +102,8 @@ __exportStar(require("./SearchResponse"), exports);
|
|
|
98
102
|
__exportStar(require("./SearchResult"), exports);
|
|
99
103
|
__exportStar(require("./SearchResultMergingRequest"), exports);
|
|
100
104
|
__exportStar(require("./SearchWeightsRequest"), exports);
|
|
105
|
+
__exportStar(require("./SetDocumentMetadataErrorResponse"), exports);
|
|
106
|
+
__exportStar(require("./SetDocumentMetadataResponse"), exports);
|
|
101
107
|
__exportStar(require("./SlimDocument"), exports);
|
|
102
108
|
__exportStar(require("./SlimDocumentStatusEnum"), exports);
|
|
103
109
|
__exportStar(require("./SubmitCompletionActualRequest"), exports);
|
package/dist/Client.js
CHANGED
|
@@ -197,7 +197,7 @@ class VellumClient {
|
|
|
197
197
|
*/
|
|
198
198
|
async search(request) {
|
|
199
199
|
const _response = await core.fetcher({
|
|
200
|
-
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).
|
|
200
|
+
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).default, "v1/search"),
|
|
201
201
|
method: "POST",
|
|
202
202
|
headers: {
|
|
203
203
|
X_API_KEY: await core.Supplier.get(this.options.apiKey),
|
|
@@ -23,6 +23,17 @@ export declare class Documents {
|
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
25
|
list(request?: Vellum.DocumentsListRequest): Promise<Vellum.PaginatedSlimDocumentList>;
|
|
26
|
+
/**
|
|
27
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
28
|
+
*
|
|
29
|
+
* Set the metadata for a document to be used for search filtering.
|
|
30
|
+
*
|
|
31
|
+
* **Note:** Uses a base url of `https://documents.vellum.ai`.
|
|
32
|
+
* @throws {Vellum.BadRequestError}
|
|
33
|
+
* @throws {Vellum.NotFoundError}
|
|
34
|
+
* @throws {Vellum.InternalServerError}
|
|
35
|
+
*/
|
|
36
|
+
setDocumentMetadata(request: Vellum.SetDocumentMetadataRequestBodyRequest): Promise<Vellum.SetDocumentMetadataResponse>;
|
|
26
37
|
/**
|
|
27
38
|
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
28
39
|
*
|
|
@@ -101,6 +101,64 @@ class Documents {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
106
|
+
*
|
|
107
|
+
* Set the metadata for a document to be used for search filtering.
|
|
108
|
+
*
|
|
109
|
+
* **Note:** Uses a base url of `https://documents.vellum.ai`.
|
|
110
|
+
* @throws {Vellum.BadRequestError}
|
|
111
|
+
* @throws {Vellum.NotFoundError}
|
|
112
|
+
* @throws {Vellum.InternalServerError}
|
|
113
|
+
*/
|
|
114
|
+
async setDocumentMetadata(request) {
|
|
115
|
+
const _response = await core.fetcher({
|
|
116
|
+
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).documents, "v1/set-document-metadata"),
|
|
117
|
+
method: "POST",
|
|
118
|
+
headers: {
|
|
119
|
+
X_API_KEY: await core.Supplier.get(this.options.apiKey),
|
|
120
|
+
},
|
|
121
|
+
contentType: "application/json",
|
|
122
|
+
body: await serializers.SetDocumentMetadataRequestBodyRequest.jsonOrThrow(request, {
|
|
123
|
+
unrecognizedObjectKeys: "strip",
|
|
124
|
+
}),
|
|
125
|
+
});
|
|
126
|
+
if (_response.ok) {
|
|
127
|
+
return await serializers.SetDocumentMetadataResponse.parseOrThrow(_response.body, {
|
|
128
|
+
unrecognizedObjectKeys: "passthrough",
|
|
129
|
+
allowUnrecognizedUnionMembers: true,
|
|
130
|
+
allowUnrecognizedEnumValues: true,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
if (_response.error.reason === "status-code") {
|
|
134
|
+
switch (_response.error.statusCode) {
|
|
135
|
+
case 400:
|
|
136
|
+
throw new Vellum.BadRequestError(_response.error.body);
|
|
137
|
+
case 404:
|
|
138
|
+
throw new Vellum.NotFoundError(_response.error.body);
|
|
139
|
+
case 500:
|
|
140
|
+
throw new Vellum.InternalServerError(_response.error.body);
|
|
141
|
+
default:
|
|
142
|
+
throw new errors.VellumError({
|
|
143
|
+
statusCode: _response.error.statusCode,
|
|
144
|
+
body: _response.error.body,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
switch (_response.error.reason) {
|
|
149
|
+
case "non-json":
|
|
150
|
+
throw new errors.VellumError({
|
|
151
|
+
statusCode: _response.error.statusCode,
|
|
152
|
+
body: _response.error.rawBody,
|
|
153
|
+
});
|
|
154
|
+
case "timeout":
|
|
155
|
+
throw new errors.VellumTimeoutError();
|
|
156
|
+
case "unknown":
|
|
157
|
+
throw new errors.VellumError({
|
|
158
|
+
message: _response.error.errorMessage,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
104
162
|
/**
|
|
105
163
|
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
106
164
|
*
|
|
@@ -128,6 +186,9 @@ class Documents {
|
|
|
128
186
|
_request.append("keywords", _item);
|
|
129
187
|
}
|
|
130
188
|
}
|
|
189
|
+
if (request.metadata != null) {
|
|
190
|
+
_request.append("metadata", request.metadata);
|
|
191
|
+
}
|
|
131
192
|
const _response = await core.fetcher({
|
|
132
193
|
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).documents, "v1/upload-document"),
|
|
133
194
|
method: "POST",
|
package/dist/api/resources/documents/client/requests/SetDocumentMetadataRequestBodyRequest.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface SetDocumentMetadataRequestBodyRequest {
|
|
5
|
+
/** The ID of the document to update. Must provide either this or `external_id` */
|
|
6
|
+
documentId?: string;
|
|
7
|
+
/** The external ID of the document to update. Must provide either this or `document_id` */
|
|
8
|
+
externalId?: string;
|
|
9
|
+
/** The metadata to set on the document. This will overwrite any existing metadata. */
|
|
10
|
+
metadata: Record<string, unknown>;
|
|
11
|
+
}
|
|
@@ -10,4 +10,6 @@ export interface UploadDocumentBodyRequest {
|
|
|
10
10
|
label: string;
|
|
11
11
|
/** Optionally include a list of keywords that'll be associated with this document. Used when performing keyword searches. */
|
|
12
12
|
keywords?: string[];
|
|
13
|
+
/** A stringified JSON object containing any metadata associated with the document that you'd like to filter upon later. */
|
|
14
|
+
metadata?: string;
|
|
13
15
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* * `STRING` - STRING
|
|
6
|
+
* * `JSON` - JSON
|
|
7
|
+
* * `CHAT_HISTORY` - CHAT_HISTORY
|
|
8
|
+
*/
|
|
9
|
+
export declare type InputVariableType = "STRING" | "JSON" | "CHAT_HISTORY";
|
|
10
|
+
export declare const InputVariableType: {
|
|
11
|
+
readonly String: "STRING";
|
|
12
|
+
readonly Json: "JSON";
|
|
13
|
+
readonly ChatHistory: "CHAT_HISTORY";
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InputVariableType = void 0;
|
|
7
|
+
exports.InputVariableType = {
|
|
8
|
+
String: "STRING",
|
|
9
|
+
Json: "JSON",
|
|
10
|
+
ChatHistory: "CHAT_HISTORY",
|
|
11
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Vellum from "..";
|
|
5
|
+
export interface MetadataFilterConfigRequest {
|
|
6
|
+
combinator?: Vellum.MetadataFilterRuleCombinator;
|
|
7
|
+
negated?: boolean;
|
|
8
|
+
rules?: Vellum.MetadataFilterRuleRequest[];
|
|
9
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
10
|
+
field?: string;
|
|
11
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
12
|
+
operator?: string;
|
|
13
|
+
/** <span style="white-space: nowrap">`non-empty`</span> */
|
|
14
|
+
value?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* * `and` - AND
|
|
6
|
+
* * `or` - OR
|
|
7
|
+
*/
|
|
8
|
+
export declare type MetadataFilterRuleCombinator = "and" | "or";
|
|
9
|
+
export declare const MetadataFilterRuleCombinator: {
|
|
10
|
+
readonly And: "and";
|
|
11
|
+
readonly Or: "or";
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MetadataFilterRuleCombinator = void 0;
|
|
7
|
+
exports.MetadataFilterRuleCombinator = {
|
|
8
|
+
And: "and",
|
|
9
|
+
Or: "or",
|
|
10
|
+
};
|