diff --git a/clients/fern/api/generators.yml b/clients/fern/api/generators.yml index ec1689e..1e869a4 100644 --- a/clients/fern/api/generators.yml +++ b/clients/fern/api/generators.yml @@ -2,12 +2,14 @@ default-group: local groups: local: generators: + # Check for newer versions: https://github.com/fern-api/fern-typescript - name: fernapi/fern-typescript-node-sdk - version: 0.6.4 + version: 0.7.1 output: location: local-file-system path: node_sdk/prompton + # Check for newer versions: https://github.com/fern-api/fern-python - name: fernapi/fern-python-sdk version: 0.3.7 output: diff --git a/clients/fern/api/node_sdk/package.json b/clients/fern/api/node_sdk/package.json index 01d7681..f3f0196 100644 --- a/clients/fern/api/node_sdk/package.json +++ b/clients/fern/api/node_sdk/package.json @@ -1,6 +1,6 @@ { - "name": "@prompton/prompton", - "version": "0.0.5", + "name": "@prompton/prompton-sdk", + "version": "0.0.6", "description": "Chat prompt template evaluation and inference monitoring", "private": false, "publishConfig": { diff --git a/clients/fern/api/node_sdk/prompton-prompton-sdk-0.0.6.tgz b/clients/fern/api/node_sdk/prompton-prompton-sdk-0.0.6.tgz new file mode 100644 index 0000000..cdfe716 Binary files /dev/null and b/clients/fern/api/node_sdk/prompton-prompton-sdk-0.0.6.tgz differ diff --git a/clients/fern/api/node_sdk/prompton/Client.d.ts b/clients/fern/api/node_sdk/prompton/Client.d.ts index 687cf02..d758a57 100644 --- a/clients/fern/api/node_sdk/prompton/Client.d.ts +++ b/clients/fern/api/node_sdk/prompton/Client.d.ts @@ -16,8 +16,8 @@ export declare namespace PromptonApiClient { } } export declare class PromptonApiClient { - protected readonly options: PromptonApiClient.Options; - constructor(options: PromptonApiClient.Options); + protected readonly _options: PromptonApiClient.Options; + constructor(_options: PromptonApiClient.Options); protected _serverStatus: ServerStatus | undefined; get serverStatus(): ServerStatus; protected _authentication: Authentication | undefined; diff --git a/clients/fern/api/node_sdk/prompton/Client.js b/clients/fern/api/node_sdk/prompton/Client.js index 9422530..0f3d7fa 100644 --- a/clients/fern/api/node_sdk/prompton/Client.js +++ b/clients/fern/api/node_sdk/prompton/Client.js @@ -12,36 +12,36 @@ const Client_5 = require("./api/resources/inferences/client/Client"); const Client_6 = require("./api/resources/orgs/client/Client"); const Client_7 = require("./api/resources/users/client/Client"); class PromptonApiClient { - constructor(options) { - this.options = options; + constructor(_options) { + this._options = _options; } get serverStatus() { var _a; - return ((_a = this._serverStatus) !== null && _a !== void 0 ? _a : (this._serverStatus = new Client_1.ServerStatus(this.options))); + return ((_a = this._serverStatus) !== null && _a !== void 0 ? _a : (this._serverStatus = new Client_1.ServerStatus(this._options))); } get authentication() { var _a; - return ((_a = this._authentication) !== null && _a !== void 0 ? _a : (this._authentication = new Client_2.Authentication(this.options))); + return ((_a = this._authentication) !== null && _a !== void 0 ? _a : (this._authentication = new Client_2.Authentication(this._options))); } get prompts() { var _a; - return ((_a = this._prompts) !== null && _a !== void 0 ? _a : (this._prompts = new Client_3.Prompts(this.options))); + return ((_a = this._prompts) !== null && _a !== void 0 ? _a : (this._prompts = new Client_3.Prompts(this._options))); } get promptVersions() { var _a; - return ((_a = this._promptVersions) !== null && _a !== void 0 ? _a : (this._promptVersions = new Client_4.PromptVersions(this.options))); + return ((_a = this._promptVersions) !== null && _a !== void 0 ? _a : (this._promptVersions = new Client_4.PromptVersions(this._options))); } get inferences() { var _a; - return ((_a = this._inferences) !== null && _a !== void 0 ? _a : (this._inferences = new Client_5.Inferences(this.options))); + return ((_a = this._inferences) !== null && _a !== void 0 ? _a : (this._inferences = new Client_5.Inferences(this._options))); } get orgs() { var _a; - return ((_a = this._orgs) !== null && _a !== void 0 ? _a : (this._orgs = new Client_6.Orgs(this.options))); + return ((_a = this._orgs) !== null && _a !== void 0 ? _a : (this._orgs = new Client_6.Orgs(this._options))); } get users() { var _a; - return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_7.Users(this.options))); + return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_7.Users(this._options))); } } exports.PromptonApiClient = PromptonApiClient; diff --git a/clients/fern/api/node_sdk/prompton/api/errors/BadRequestError.js b/clients/fern/api/node_sdk/prompton/api/errors/BadRequestError.js index b9303cf..af77bf7 100644 --- a/clients/fern/api/node_sdk/prompton/api/errors/BadRequestError.js +++ b/clients/fern/api/node_sdk/prompton/api/errors/BadRequestError.js @@ -31,7 +31,6 @@ const errors = __importStar(require("../../errors")); class BadRequestError extends errors.PromptonApiError { constructor(body) { super({ - message: "BadRequestError", statusCode: 400, body: body, }); diff --git a/clients/fern/api/node_sdk/prompton/api/errors/NotFoundError.js b/clients/fern/api/node_sdk/prompton/api/errors/NotFoundError.js index a4bde36..51c0223 100644 --- a/clients/fern/api/node_sdk/prompton/api/errors/NotFoundError.js +++ b/clients/fern/api/node_sdk/prompton/api/errors/NotFoundError.js @@ -31,7 +31,6 @@ const errors = __importStar(require("../../errors")); class NotFoundError extends errors.PromptonApiError { constructor(body) { super({ - message: "NotFoundError", statusCode: 404, body: body, }); diff --git a/clients/fern/api/node_sdk/prompton/api/errors/UnauthorizedError.js b/clients/fern/api/node_sdk/prompton/api/errors/UnauthorizedError.js index 6fd184a..3abcfb8 100644 --- a/clients/fern/api/node_sdk/prompton/api/errors/UnauthorizedError.js +++ b/clients/fern/api/node_sdk/prompton/api/errors/UnauthorizedError.js @@ -31,7 +31,6 @@ const errors = __importStar(require("../../errors")); class UnauthorizedError extends errors.PromptonApiError { constructor(body) { super({ - message: "UnauthorizedError", statusCode: 401, body: body, }); diff --git a/clients/fern/api/node_sdk/prompton/api/errors/UnprocessableEntityError.js b/clients/fern/api/node_sdk/prompton/api/errors/UnprocessableEntityError.js index dd5720a..303acc4 100644 --- a/clients/fern/api/node_sdk/prompton/api/errors/UnprocessableEntityError.js +++ b/clients/fern/api/node_sdk/prompton/api/errors/UnprocessableEntityError.js @@ -31,7 +31,6 @@ const errors = __importStar(require("../../errors")); class UnprocessableEntityError extends errors.PromptonApiError { constructor(body) { super({ - message: "UnprocessableEntityError", statusCode: 422, body: body, }); diff --git a/clients/fern/api/node_sdk/prompton/api/resources/authentication/client/Client.d.ts b/clients/fern/api/node_sdk/prompton/api/resources/authentication/client/Client.d.ts index 167c39b..2561463 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/authentication/client/Client.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/resources/authentication/client/Client.d.ts @@ -10,8 +10,8 @@ export declare namespace Authentication { } } export declare class Authentication { - protected readonly options: Authentication.Options; - constructor(options: Authentication.Options); + protected readonly _options: Authentication.Options; + constructor(_options: Authentication.Options); /** * @throws {@link PromptonApi.BadRequestError} * @throws {@link PromptonApi.UnauthorizedError} diff --git a/clients/fern/api/node_sdk/prompton/api/resources/authentication/client/Client.js b/clients/fern/api/node_sdk/prompton/api/resources/authentication/client/Client.js index 7e86427..2ac5029 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/authentication/client/Client.js +++ b/clients/fern/api/node_sdk/prompton/api/resources/authentication/client/Client.js @@ -45,8 +45,8 @@ const url_join_1 = __importDefault(require("url-join")); const serializers = __importStar(require("../../../../serialization")); const errors = __importStar(require("../../../../errors")); class Authentication { - constructor(options) { - this.options = options; + constructor(_options) { + this._options = _options; } /** * @throws {@link PromptonApi.BadRequestError} @@ -56,7 +56,7 @@ class Authentication { getAccessTokenExtended() { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "token"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "token"), method: "POST", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -114,7 +114,7 @@ class Authentication { getAccessToken(request) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "token_basic"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "token_basic"), method: "POST", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -164,7 +164,7 @@ class Authentication { } _getAuthorizationHeader() { return __awaiter(this, void 0, void 0, function* () { - const bearer = yield core.Supplier.get(this.options.token); + const bearer = yield core.Supplier.get(this._options.token); if (bearer != null) { return `Bearer ${bearer}`; } diff --git a/clients/fern/api/node_sdk/prompton/api/resources/inferences/client/Client.d.ts b/clients/fern/api/node_sdk/prompton/api/resources/inferences/client/Client.d.ts index bb3d306..ed779f6 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/inferences/client/Client.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/resources/inferences/client/Client.d.ts @@ -10,8 +10,8 @@ export declare namespace Inferences { } } export declare class Inferences { - protected readonly options: Inferences.Options; - constructor(options: Inferences.Options); + protected readonly _options: Inferences.Options; + constructor(_options: Inferences.Options); /** * @throws {@link PromptonApi.BadRequestError} * @throws {@link PromptonApi.UnauthorizedError} diff --git a/clients/fern/api/node_sdk/prompton/api/resources/inferences/client/Client.js b/clients/fern/api/node_sdk/prompton/api/resources/inferences/client/Client.js index d681c62..39272f6 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/inferences/client/Client.js +++ b/clients/fern/api/node_sdk/prompton/api/resources/inferences/client/Client.js @@ -46,8 +46,8 @@ const url_join_1 = __importDefault(require("url-join")); const serializers = __importStar(require("../../../../serialization")); const errors = __importStar(require("../../../../errors")); class Inferences { - constructor(options) { - this.options = options; + constructor(_options) { + this._options = _options; } /** * @throws {@link PromptonApi.BadRequestError} @@ -66,7 +66,7 @@ class Inferences { _queryParams.append("prompt_id", promptId); } const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "inferences"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "inferences"), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -148,7 +148,7 @@ class Inferences { newInference(request) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "inferences"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "inferences"), method: "POST", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -205,7 +205,7 @@ class Inferences { getInferenceById(id) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), `inferences/${id}`), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `inferences/${id}`), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -256,7 +256,7 @@ class Inferences { } _getAuthorizationHeader() { return __awaiter(this, void 0, void 0, function* () { - const bearer = yield core.Supplier.get(this.options.token); + const bearer = yield core.Supplier.get(this._options.token); if (bearer != null) { return `Bearer ${bearer}`; } diff --git a/clients/fern/api/node_sdk/prompton/api/resources/orgs/client/Client.d.ts b/clients/fern/api/node_sdk/prompton/api/resources/orgs/client/Client.d.ts index 981bcf2..525cc8d 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/orgs/client/Client.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/resources/orgs/client/Client.d.ts @@ -10,8 +10,8 @@ export declare namespace Orgs { } } export declare class Orgs { - protected readonly options: Orgs.Options; - constructor(options: Orgs.Options); + protected readonly _options: Orgs.Options; + constructor(_options: Orgs.Options); getOrgsList(): Promise; /** * @throws {@link PromptonApi.BadRequestError} diff --git a/clients/fern/api/node_sdk/prompton/api/resources/orgs/client/Client.js b/clients/fern/api/node_sdk/prompton/api/resources/orgs/client/Client.js index c5ca5a6..93f18e3 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/orgs/client/Client.js +++ b/clients/fern/api/node_sdk/prompton/api/resources/orgs/client/Client.js @@ -45,13 +45,13 @@ const url_join_1 = __importDefault(require("url-join")); const serializers = __importStar(require("../../../../serialization")); const errors = __importStar(require("../../../../errors")); class Orgs { - constructor(options) { - this.options = options; + constructor(_options) { + this._options = _options; } getOrgsList() { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "orgs"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "orgs"), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -97,7 +97,7 @@ class Orgs { addOrg(request) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "orgs"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "orgs"), method: "POST", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -149,7 +149,7 @@ class Orgs { getCurrentUserOrg() { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "orgs/me"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "orgs/me"), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -207,7 +207,7 @@ class Orgs { getOrgById(id) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), `orgs/${id}`), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `orgs/${id}`), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -265,7 +265,7 @@ class Orgs { updateOrg(id, request = {}) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), `orgs/${id}`), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `orgs/${id}`), method: "PATCH", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -317,7 +317,7 @@ class Orgs { } _getAuthorizationHeader() { return __awaiter(this, void 0, void 0, function* () { - const bearer = yield core.Supplier.get(this.options.token); + const bearer = yield core.Supplier.get(this._options.token); if (bearer != null) { return `Bearer ${bearer}`; } diff --git a/clients/fern/api/node_sdk/prompton/api/resources/promptVersions/client/Client.d.ts b/clients/fern/api/node_sdk/prompton/api/resources/promptVersions/client/Client.d.ts index 78b83be..93ace67 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/promptVersions/client/Client.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/resources/promptVersions/client/Client.d.ts @@ -10,8 +10,8 @@ export declare namespace PromptVersions { } } export declare class PromptVersions { - protected readonly options: PromptVersions.Options; - constructor(options: PromptVersions.Options); + protected readonly _options: PromptVersions.Options; + constructor(_options: PromptVersions.Options); /** * @throws {@link PromptonApi.BadRequestError} * @throws {@link PromptonApi.UnauthorizedError} diff --git a/clients/fern/api/node_sdk/prompton/api/resources/promptVersions/client/Client.js b/clients/fern/api/node_sdk/prompton/api/resources/promptVersions/client/Client.js index 5509c27..21baab0 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/promptVersions/client/Client.js +++ b/clients/fern/api/node_sdk/prompton/api/resources/promptVersions/client/Client.js @@ -46,8 +46,8 @@ const url_join_1 = __importDefault(require("url-join")); const serializers = __importStar(require("../../../../serialization")); const errors = __importStar(require("../../../../errors")); class PromptVersions { - constructor(options) { - this.options = options; + constructor(_options) { + this._options = _options; } /** * @throws {@link PromptonApi.BadRequestError} @@ -63,7 +63,7 @@ class PromptVersions { _queryParams.append("prompt_id", promptId); } const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "promptVersions"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "promptVersions"), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -121,7 +121,7 @@ class PromptVersions { addPromptVersion(request) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "promptVersions"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "promptVersions"), method: "POST", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -173,7 +173,7 @@ class PromptVersions { getPromptVersionById(id) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), `promptVersions/${id}`), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `promptVersions/${id}`), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -231,7 +231,7 @@ class PromptVersions { updatePromptVersion(id, request = {}) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), `promptVersions/${id}`), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `promptVersions/${id}`), method: "PATCH", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -283,7 +283,7 @@ class PromptVersions { } _getAuthorizationHeader() { return __awaiter(this, void 0, void 0, function* () { - const bearer = yield core.Supplier.get(this.options.token); + const bearer = yield core.Supplier.get(this._options.token); if (bearer != null) { return `Bearer ${bearer}`; } diff --git a/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/Client.d.ts b/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/Client.d.ts index afc2203..4409fbb 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/Client.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/Client.d.ts @@ -10,8 +10,8 @@ export declare namespace Prompts { } } export declare class Prompts { - protected readonly options: Prompts.Options; - constructor(options: Prompts.Options); + protected readonly _options: Prompts.Options; + constructor(_options: Prompts.Options); /** * @throws {@link PromptonApi.BadRequestError} * @throws {@link PromptonApi.UnauthorizedError} diff --git a/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/Client.js b/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/Client.js index 416875f..ffabcea 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/Client.js +++ b/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/Client.js @@ -45,8 +45,8 @@ const url_join_1 = __importDefault(require("url-join")); const serializers = __importStar(require("../../../../serialization")); const errors = __importStar(require("../../../../errors")); class Prompts { - constructor(options) { - this.options = options; + constructor(_options) { + this._options = _options; } /** * @throws {@link PromptonApi.BadRequestError} @@ -57,7 +57,7 @@ class Prompts { getPromptsList() { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "prompts"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "prompts"), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -114,7 +114,7 @@ class Prompts { addPrompt(request) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "prompts"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "prompts"), method: "POST", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -166,7 +166,7 @@ class Prompts { getPromptById(id) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), `prompts/${id}`), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `prompts/${id}`), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -224,7 +224,7 @@ class Prompts { updatePrompt(id, request = {}) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), `prompts/${id}`), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `prompts/${id}`), method: "PATCH", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -282,7 +282,7 @@ class Prompts { deletePrompt(id) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), `prompts/${id}`), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `prompts/${id}`), method: "DELETE", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -324,7 +324,7 @@ class Prompts { } _getAuthorizationHeader() { return __awaiter(this, void 0, void 0, function* () { - const bearer = yield core.Supplier.get(this.options.token); + const bearer = yield core.Supplier.get(this._options.token); if (bearer != null) { return `Bearer ${bearer}`; } diff --git a/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/requests/PromptCreate.d.ts b/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/requests/PromptCreate.d.ts index af4db5f..ec78151 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/requests/PromptCreate.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/requests/PromptCreate.d.ts @@ -3,6 +3,7 @@ */ import * as PromptonApi from "../../../.."; export interface PromptCreate { + /** Prompt status for client consideration only, currently not used in server logic. */ status?: PromptonApi.PromptStatus; /** `non-empty` */ name: string; diff --git a/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/requests/PromptUpdate.d.ts b/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/requests/PromptUpdate.d.ts index e7fa732..5be74fa 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/requests/PromptUpdate.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/resources/prompts/client/requests/PromptUpdate.d.ts @@ -3,6 +3,7 @@ */ import * as PromptonApi from "../../../.."; export interface PromptUpdate { + /** Prompt status for client consideration only, currently not used in server logic. */ status?: PromptonApi.PromptStatus; /** `non-empty` */ name?: string; diff --git a/clients/fern/api/node_sdk/prompton/api/resources/serverStatus/client/Client.d.ts b/clients/fern/api/node_sdk/prompton/api/resources/serverStatus/client/Client.d.ts index 5d6cd2c..372dc99 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/serverStatus/client/Client.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/resources/serverStatus/client/Client.d.ts @@ -10,8 +10,8 @@ export declare namespace ServerStatus { } } export declare class ServerStatus { - protected readonly options: ServerStatus.Options; - constructor(options: ServerStatus.Options); + protected readonly _options: ServerStatus.Options; + constructor(_options: ServerStatus.Options); getStatus(): Promise; protected _getAuthorizationHeader(): Promise; } diff --git a/clients/fern/api/node_sdk/prompton/api/resources/serverStatus/client/Client.js b/clients/fern/api/node_sdk/prompton/api/resources/serverStatus/client/Client.js index deff3e6..2c543a5 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/serverStatus/client/Client.js +++ b/clients/fern/api/node_sdk/prompton/api/resources/serverStatus/client/Client.js @@ -44,13 +44,13 @@ const url_join_1 = __importDefault(require("url-join")); const serializers = __importStar(require("../../../../serialization")); const errors = __importStar(require("../../../../errors")); class ServerStatus { - constructor(options) { - this.options = options; + constructor(_options) { + this._options = _options; } getStatus() { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "status"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "status"), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -90,7 +90,7 @@ class ServerStatus { } _getAuthorizationHeader() { return __awaiter(this, void 0, void 0, function* () { - const bearer = yield core.Supplier.get(this.options.token); + const bearer = yield core.Supplier.get(this._options.token); if (bearer != null) { return `Bearer ${bearer}`; } diff --git a/clients/fern/api/node_sdk/prompton/api/resources/users/client/Client.d.ts b/clients/fern/api/node_sdk/prompton/api/resources/users/client/Client.d.ts index c824c3c..3116c46 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/users/client/Client.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/resources/users/client/Client.d.ts @@ -10,8 +10,8 @@ export declare namespace Users { } } export declare class Users { - protected readonly options: Users.Options; - constructor(options: Users.Options); + protected readonly _options: Users.Options; + constructor(_options: Users.Options); /** * @throws {@link PromptonApi.BadRequestError} * @throws {@link PromptonApi.UnauthorizedError} diff --git a/clients/fern/api/node_sdk/prompton/api/resources/users/client/Client.js b/clients/fern/api/node_sdk/prompton/api/resources/users/client/Client.js index 2650317..4d90783 100644 --- a/clients/fern/api/node_sdk/prompton/api/resources/users/client/Client.js +++ b/clients/fern/api/node_sdk/prompton/api/resources/users/client/Client.js @@ -45,8 +45,8 @@ const url_join_1 = __importDefault(require("url-join")); const serializers = __importStar(require("../../../../serialization")); const errors = __importStar(require("../../../../errors")); class Users { - constructor(options) { - this.options = options; + constructor(_options) { + this._options = _options; } /** * @throws {@link PromptonApi.BadRequestError} @@ -57,7 +57,7 @@ class Users { getUsersList() { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "users"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "users"), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -114,7 +114,7 @@ class Users { addNewUser(request) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "users"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "users"), method: "POST", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -166,7 +166,7 @@ class Users { getCurrentUser() { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), "users/me"), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "users/me"), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -224,7 +224,7 @@ class Users { getUserById(id) { return __awaiter(this, void 0, void 0, function* () { const _response = yield core.fetcher({ - url: (0, url_join_1.default)(yield core.Supplier.get(this.options.environment), `users/${id}`), + url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `users/${id}`), method: "GET", headers: { Authorization: yield this._getAuthorizationHeader(), @@ -275,7 +275,7 @@ class Users { } _getAuthorizationHeader() { return __awaiter(this, void 0, void 0, function* () { - const bearer = yield core.Supplier.get(this.options.token); + const bearer = yield core.Supplier.get(this._options.token); if (bearer != null) { return `Bearer ${bearer}`; } diff --git a/clients/fern/api/node_sdk/prompton/api/types/InferenceError.d.ts b/clients/fern/api/node_sdk/prompton/api/types/InferenceError.d.ts new file mode 100644 index 0000000..6e2c5ab --- /dev/null +++ b/clients/fern/api/node_sdk/prompton/api/types/InferenceError.d.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +export interface InferenceError { + errorClass: string; + message: string; + details?: unknown; +} diff --git a/clients/fern/api/node_sdk/prompton/api/types/InferenceError.js b/clients/fern/api/node_sdk/prompton/api/types/InferenceError.js new file mode 100644 index 0000000..33e43da --- /dev/null +++ b/clients/fern/api/node_sdk/prompton/api/types/InferenceError.js @@ -0,0 +1,5 @@ +"use strict"; +/** + * This file was auto-generated by Fern from our API Definition. + */ +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/clients/fern/api/node_sdk/prompton/api/types/InferenceRead.d.ts b/clients/fern/api/node_sdk/prompton/api/types/InferenceRead.d.ts index 7450263..e6acdf4 100644 --- a/clients/fern/api/node_sdk/prompton/api/types/InferenceRead.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/types/InferenceRead.d.ts @@ -2,27 +2,29 @@ * This file was auto-generated by Fern from our API Definition. */ import * as PromptonApi from ".."; +/** + * Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks + */ export interface InferenceRead { - id?: string; - createdAt?: string; - createdByUserId?: string; - createdByOrgId?: string; + id: string; + createdAt: string; + createdByUserId: string; + createdByOrgId: string; /** The API consumer's internal user reference for metrics. It is also relayed to the provider as part of the request if the provider supports it (eg. OpenAI's user field). */ endUserId?: string; /** The API consumer's source for metrics (e.g. AndroidApp etc). */ source?: string; /** The API consumer's internal reference id to able to link references to their sessions. */ clientRefId?: string; - templateArgs?: Record; + templateArgs: Record; metadata?: Record; /** Provider request timout in seconds. If not provided, then Prompton API's default timeout for the provider will be used (90sec or `DEFAULT_OPENAI_REQUEST_TIMEOUT_SECONDS` env var if provided). */ requestTimeout?: number; promptVersionId: string; - /** If inference was by prompt_id then a list of all other prompt versions considered for this inference. I.e. all prompt versions in Live status at the time of the inference */ - promptVersionIdsConsidered?: string[]; + promptVersionIdsConsidered: string[]; promptId: string; - promptVersionName?: string; - status?: PromptonApi.InferenceResponseStatus; - request?: PromptonApi.InferenceRequestData; + promptVersionName: string; + status: PromptonApi.InferenceResponseStatus; + request: PromptonApi.InferenceRequestData; response?: PromptonApi.InferenceReadResponse; } diff --git a/clients/fern/api/node_sdk/prompton/api/types/InferenceResponseError.d.ts b/clients/fern/api/node_sdk/prompton/api/types/InferenceResponseError.d.ts index 128649a..e6b6f76 100644 --- a/clients/fern/api/node_sdk/prompton/api/types/InferenceResponseError.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/types/InferenceResponseError.d.ts @@ -1,10 +1,11 @@ /** * This file was auto-generated by Fern from our API Definition. */ +import * as PromptonApi from ".."; export interface InferenceResponseError { completedAt?: string; completitionDurationSeconds?: number; isClientConnectedAtFinish?: boolean; isError?: boolean; - error?: unknown; + error: PromptonApi.InferenceError; } diff --git a/clients/fern/api/node_sdk/prompton/api/types/OrgRead.d.ts b/clients/fern/api/node_sdk/prompton/api/types/OrgRead.d.ts index b486a77..1fdb7bf 100644 --- a/clients/fern/api/node_sdk/prompton/api/types/OrgRead.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/types/OrgRead.d.ts @@ -1,11 +1,14 @@ /** * This file was auto-generated by Fern from our API Definition. */ +/** + * Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks + */ export interface OrgRead { - id?: string; - createdAt?: string; - createdByUserId?: string; - createdByOrgId?: string; + id: string; + createdAt: string; + createdByUserId: string; + createdByOrgId: string; name: string; accessKeys?: Record; } diff --git a/clients/fern/api/node_sdk/prompton/api/types/PromptRead.d.ts b/clients/fern/api/node_sdk/prompton/api/types/PromptRead.d.ts index e36304b..fd711c2 100644 --- a/clients/fern/api/node_sdk/prompton/api/types/PromptRead.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/types/PromptRead.d.ts @@ -2,12 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ import * as PromptonApi from ".."; +/** + * Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks + */ export interface PromptRead { - id?: string; - createdAt?: string; - createdByUserId?: string; - createdByOrgId?: string; - status?: PromptonApi.PromptStatus; + id: string; + createdAt: string; + createdByUserId: string; + createdByOrgId: string; + status: PromptonApi.PromptStatus; /** `non-empty` */ name: string; description?: string; diff --git a/clients/fern/api/node_sdk/prompton/api/types/PromptVersionRead.d.ts b/clients/fern/api/node_sdk/prompton/api/types/PromptVersionRead.d.ts index 01356a8..c785f74 100644 --- a/clients/fern/api/node_sdk/prompton/api/types/PromptVersionRead.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/types/PromptVersionRead.d.ts @@ -2,18 +2,22 @@ * This file was auto-generated by Fern from our API Definition. */ import * as PromptonApi from ".."; +/** + * Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks + */ export interface PromptVersionRead { - id?: string; - createdAt?: string; - createdByUserId?: string; - createdByOrgId?: string; - status?: PromptonApi.PromptVersionStatus; - provider?: PromptonApi.PromptVersionProviders; + id: string; + createdAt: string; + createdByUserId: string; + createdByOrgId: string; + status: PromptonApi.PromptVersionStatus; + provider: PromptonApi.PromptVersionProviders; /** `non-empty` */ name: string; description?: string; promptId: string; - template?: PromptonApi.ChatGptMessage[]; + template: PromptonApi.ChatGptMessage[]; modelConfig?: PromptonApi.ChatGptChatCompletitionConfig; - templateArgNames?: string[]; + /** List of args in the template - populated by server at PATHC and POST */ + templateArgNames: string[]; } diff --git a/clients/fern/api/node_sdk/prompton/api/types/UserRead.d.ts b/clients/fern/api/node_sdk/prompton/api/types/UserRead.d.ts index 63b45e6..5a8508d 100644 --- a/clients/fern/api/node_sdk/prompton/api/types/UserRead.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/types/UserRead.d.ts @@ -2,14 +2,17 @@ * This file was auto-generated by Fern from our API Definition. */ import * as PromptonApi from ".."; +/** + * Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks + */ export interface UserRead { - id?: string; - createdAt?: string; - createdByUserId?: string; - createdByOrgId?: string; + id: string; + createdAt: string; + createdByUserId: string; + createdByOrgId: string; /** `non-empty` */ fullName?: string; - disabled?: boolean; + disabled: boolean; role?: PromptonApi.UserRoles; orgId: string; email: string; diff --git a/clients/fern/api/node_sdk/prompton/api/types/index.d.ts b/clients/fern/api/node_sdk/prompton/api/types/index.d.ts index 36bec83..3f6e2eb 100644 --- a/clients/fern/api/node_sdk/prompton/api/types/index.d.ts +++ b/clients/fern/api/node_sdk/prompton/api/types/index.d.ts @@ -14,6 +14,7 @@ export * from "./DbStatus"; export * from "./HttpValidationError"; export * from "./InferenceCreateByPromptId"; export * from "./InferenceCreateByPromptVersionId"; +export * from "./InferenceError"; export * from "./InferencePostResponse"; export * from "./InferencePostResponseResponse"; export * from "./InferenceRead"; diff --git a/clients/fern/api/node_sdk/prompton/api/types/index.js b/clients/fern/api/node_sdk/prompton/api/types/index.js index bb4cc52..624ae44 100644 --- a/clients/fern/api/node_sdk/prompton/api/types/index.js +++ b/clients/fern/api/node_sdk/prompton/api/types/index.js @@ -30,6 +30,7 @@ __exportStar(require("./DbStatus"), exports); __exportStar(require("./HttpValidationError"), exports); __exportStar(require("./InferenceCreateByPromptId"), exports); __exportStar(require("./InferenceCreateByPromptVersionId"), exports); +__exportStar(require("./InferenceError"), exports); __exportStar(require("./InferencePostResponse"), exports); __exportStar(require("./InferencePostResponseResponse"), exports); __exportStar(require("./InferenceRead"), exports); diff --git a/clients/fern/api/node_sdk/prompton/core/fetcher/Fetcher.d.ts b/clients/fern/api/node_sdk/prompton/core/fetcher/Fetcher.d.ts index 639201f..b7a55e1 100644 --- a/clients/fern/api/node_sdk/prompton/core/fetcher/Fetcher.d.ts +++ b/clients/fern/api/node_sdk/prompton/core/fetcher/Fetcher.d.ts @@ -1,14 +1,7 @@ import { default as URLSearchParams } from "@ungap/url-search-params"; -import { AxiosAdapter } from "axios"; +import { AxiosAdapter, AxiosProgressEvent } from "axios"; import { APIResponse } from "./APIResponse"; -export interface FetchFunction { - (args: Fetcher.Args & { - responseType?: "json"; - }): Promise>; - (args: Fetcher.Args & { - responseType: "blob"; - }): Promise>; -} +export declare type FetchFunction = (args: Fetcher.Args) => Promise>; export declare namespace Fetcher { interface Args { url: string; @@ -21,7 +14,7 @@ export declare namespace Fetcher { withCredentials?: boolean; responseType?: "json" | "blob"; adapter?: AxiosAdapter; - onUploadProgress?: (event: ProgressEvent) => void; + onUploadProgress?: (event: AxiosProgressEvent) => void; } type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError; interface FailedStatusCodeError { diff --git a/clients/fern/api/node_sdk/prompton/core/fetcher/Fetcher.js b/clients/fern/api/node_sdk/prompton/core/fetcher/Fetcher.js index de8e0b8..6ae10ca 100644 --- a/clients/fern/api/node_sdk/prompton/core/fetcher/Fetcher.js +++ b/clients/fern/api/node_sdk/prompton/core/fetcher/Fetcher.js @@ -49,7 +49,10 @@ function fetcherImpl(args) { responseType: (_a = args.responseType) !== null && _a !== void 0 ? _a : "json", }); let body; - if (response.data != null && response.data.length > 0) { + if (args.responseType === "blob") { + body = response.data; + } + else if (response.data != null && response.data.length > 0) { try { body = (_b = JSON.parse(response.data)) !== null && _b !== void 0 ? _b : undefined; } @@ -67,7 +70,7 @@ function fetcherImpl(args) { if (response.status >= 200 && response.status < 400) { return { ok: true, - body, + body: body, }; } else { diff --git a/clients/fern/api/node_sdk/prompton/errors/PromptonApiError.js b/clients/fern/api/node_sdk/prompton/errors/PromptonApiError.js index 90e8067..37e308b 100644 --- a/clients/fern/api/node_sdk/prompton/errors/PromptonApiError.js +++ b/clients/fern/api/node_sdk/prompton/errors/PromptonApiError.js @@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.PromptonApiError = void 0; class PromptonApiError extends Error { constructor({ message, statusCode, body }) { - super(message); + super(buildMessage({ message, statusCode, body })); Object.setPrototypeOf(this, PromptonApiError.prototype); if (statusCode != null) { this.statusCode = statusCode; @@ -17,3 +17,16 @@ class PromptonApiError extends Error { } } exports.PromptonApiError = PromptonApiError; +function buildMessage({ message, statusCode, body, }) { + let lines = []; + if (message != null) { + lines.push(message); + } + if (statusCode != null) { + lines.push(`Status code: ${statusCode.toString()}`); + } + if (body != null) { + lines.push(`Body: ${JSON.stringify(body, undefined, 2)}`); + } + return lines.join("\n"); +} diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/InferenceError.d.ts b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceError.d.ts new file mode 100644 index 0000000..f272e17 --- /dev/null +++ b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceError.d.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +import * as serializers from ".."; +import * as PromptonApi from "../../api"; +import * as core from "../../core"; +export declare const InferenceError: core.serialization.ObjectSchema; +export declare namespace InferenceError { + interface Raw { + error_class: string; + message: string; + details?: unknown | null; + } +} diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/InferenceError.js b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceError.js new file mode 100644 index 0000000..60b63a5 --- /dev/null +++ b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceError.js @@ -0,0 +1,35 @@ +"use strict"; +/** + * This file was auto-generated by Fern from our API Definition. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.InferenceError = void 0; +const core = __importStar(require("../../core")); +exports.InferenceError = core.serialization.object({ + errorClass: core.serialization.property("error_class", core.serialization.string()), + message: core.serialization.string(), + details: core.serialization.unknown().optional(), +}); diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/InferenceRead.d.ts b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceRead.d.ts index abac61e..a1b857e 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/InferenceRead.d.ts +++ b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceRead.d.ts @@ -7,22 +7,22 @@ import * as core from "../../core"; export declare const InferenceRead: core.serialization.ObjectSchema; export declare namespace InferenceRead { interface Raw { - _id?: string | null; - created_at?: string | null; - created_by_user_id?: string | null; - created_by_org_id?: string | null; + _id: string; + created_at: string; + created_by_user_id: string; + created_by_org_id: string; end_user_id?: string | null; source?: string | null; client_ref_id?: string | null; - template_args?: Record | null; + template_args: Record; metadata?: Record | null; request_timeout?: number | null; prompt_version_id: string; - prompt_version_ids_considered?: string[] | null; + prompt_version_ids_considered: string[]; prompt_id: string; - prompt_version_name?: string | null; - status?: serializers.InferenceResponseStatus.Raw | null; - request?: serializers.InferenceRequestData.Raw | null; + prompt_version_name: string; + status: serializers.InferenceResponseStatus.Raw; + request: serializers.InferenceRequestData.Raw; response?: serializers.InferenceReadResponse.Raw | null; } } diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/InferenceRead.js b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceRead.js index 76f9a9c..8d797b4 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/InferenceRead.js +++ b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceRead.js @@ -38,21 +38,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.InferenceRead = void 0; const core = __importStar(require("../../core")); exports.InferenceRead = core.serialization.object({ - id: core.serialization.property("_id", core.serialization.string().optional()), - createdAt: core.serialization.property("created_at", core.serialization.string().optional()), - createdByUserId: core.serialization.property("created_by_user_id", core.serialization.string().optional()), - createdByOrgId: core.serialization.property("created_by_org_id", core.serialization.string().optional()), + id: core.serialization.property("_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.string()), + createdByUserId: core.serialization.property("created_by_user_id", core.serialization.string()), + createdByOrgId: core.serialization.property("created_by_org_id", core.serialization.string()), endUserId: core.serialization.property("end_user_id", core.serialization.string().optional()), source: core.serialization.string().optional(), clientRefId: core.serialization.property("client_ref_id", core.serialization.string().optional()), - templateArgs: core.serialization.property("template_args", core.serialization.record(core.serialization.string(), core.serialization.string()).optional()), + templateArgs: core.serialization.property("template_args", core.serialization.record(core.serialization.string(), core.serialization.string())), metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), requestTimeout: core.serialization.property("request_timeout", core.serialization.number().optional()), promptVersionId: core.serialization.property("prompt_version_id", core.serialization.string()), - promptVersionIdsConsidered: core.serialization.property("prompt_version_ids_considered", core.serialization.list(core.serialization.string()).optional()), + promptVersionIdsConsidered: core.serialization.property("prompt_version_ids_considered", core.serialization.list(core.serialization.string())), promptId: core.serialization.property("prompt_id", core.serialization.string()), - promptVersionName: core.serialization.property("prompt_version_name", core.serialization.string().optional()), - status: core.serialization.lazy(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).InferenceResponseStatus; })).optional(), - request: core.serialization.lazyObject(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).InferenceRequestData; })).optional(), + promptVersionName: core.serialization.property("prompt_version_name", core.serialization.string()), + status: core.serialization.lazy(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).InferenceResponseStatus; })), + request: core.serialization.lazyObject(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).InferenceRequestData; })), response: core.serialization.lazy(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).InferenceReadResponse; })).optional(), }); diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/InferenceResponseError.d.ts b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceResponseError.d.ts index a723387..9fd70b2 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/InferenceResponseError.d.ts +++ b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceResponseError.d.ts @@ -11,6 +11,6 @@ export declare namespace InferenceResponseError { completition_duration_seconds?: number | null; is_client_connected_at_finish?: boolean | null; isError?: boolean | null; - error?: unknown | null; + error: serializers.InferenceError.Raw; } } diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/InferenceResponseError.js b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceResponseError.js index 07b2aa7..a3a292b 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/InferenceResponseError.js +++ b/clients/fern/api/node_sdk/prompton/serialization/types/InferenceResponseError.js @@ -25,6 +25,15 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.InferenceResponseError = void 0; const core = __importStar(require("../../core")); @@ -33,5 +42,5 @@ exports.InferenceResponseError = core.serialization.object({ completitionDurationSeconds: core.serialization.property("completition_duration_seconds", core.serialization.number().optional()), isClientConnectedAtFinish: core.serialization.property("is_client_connected_at_finish", core.serialization.boolean().optional()), isError: core.serialization.boolean().optional(), - error: core.serialization.unknown().optional(), + error: core.serialization.lazyObject(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).InferenceError; })), }); diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/OrgRead.d.ts b/clients/fern/api/node_sdk/prompton/serialization/types/OrgRead.d.ts index 7f546ea..3a449f9 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/OrgRead.d.ts +++ b/clients/fern/api/node_sdk/prompton/serialization/types/OrgRead.d.ts @@ -7,10 +7,10 @@ import * as core from "../../core"; export declare const OrgRead: core.serialization.ObjectSchema; export declare namespace OrgRead { interface Raw { - _id?: string | null; - created_at?: string | null; - created_by_user_id?: string | null; - created_by_org_id?: string | null; + _id: string; + created_at: string; + created_by_user_id: string; + created_by_org_id: string; name: string; access_keys?: Record | null; } diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/OrgRead.js b/clients/fern/api/node_sdk/prompton/serialization/types/OrgRead.js index 9162f40..8200204 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/OrgRead.js +++ b/clients/fern/api/node_sdk/prompton/serialization/types/OrgRead.js @@ -29,10 +29,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.OrgRead = void 0; const core = __importStar(require("../../core")); exports.OrgRead = core.serialization.object({ - id: core.serialization.property("_id", core.serialization.string().optional()), - createdAt: core.serialization.property("created_at", core.serialization.string().optional()), - createdByUserId: core.serialization.property("created_by_user_id", core.serialization.string().optional()), - createdByOrgId: core.serialization.property("created_by_org_id", core.serialization.string().optional()), + id: core.serialization.property("_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.string()), + createdByUserId: core.serialization.property("created_by_user_id", core.serialization.string()), + createdByOrgId: core.serialization.property("created_by_org_id", core.serialization.string()), name: core.serialization.string(), accessKeys: core.serialization.property("access_keys", core.serialization.record(core.serialization.string(), core.serialization.string()).optional()), }); diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/PromptRead.d.ts b/clients/fern/api/node_sdk/prompton/serialization/types/PromptRead.d.ts index 53eac62..19dfb40 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/PromptRead.d.ts +++ b/clients/fern/api/node_sdk/prompton/serialization/types/PromptRead.d.ts @@ -7,11 +7,11 @@ import * as core from "../../core"; export declare const PromptRead: core.serialization.ObjectSchema; export declare namespace PromptRead { interface Raw { - _id?: string | null; - created_at?: string | null; - created_by_user_id?: string | null; - created_by_org_id?: string | null; - status?: serializers.PromptStatus.Raw | null; + _id: string; + created_at: string; + created_by_user_id: string; + created_by_org_id: string; + status: serializers.PromptStatus.Raw; name: string; description?: string | null; } diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/PromptRead.js b/clients/fern/api/node_sdk/prompton/serialization/types/PromptRead.js index 5e51e5a..8d02710 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/PromptRead.js +++ b/clients/fern/api/node_sdk/prompton/serialization/types/PromptRead.js @@ -38,11 +38,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.PromptRead = void 0; const core = __importStar(require("../../core")); exports.PromptRead = core.serialization.object({ - id: core.serialization.property("_id", core.serialization.string().optional()), - createdAt: core.serialization.property("created_at", core.serialization.string().optional()), - createdByUserId: core.serialization.property("created_by_user_id", core.serialization.string().optional()), - createdByOrgId: core.serialization.property("created_by_org_id", core.serialization.string().optional()), - status: core.serialization.lazy(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).PromptStatus; })).optional(), + id: core.serialization.property("_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.string()), + createdByUserId: core.serialization.property("created_by_user_id", core.serialization.string()), + createdByOrgId: core.serialization.property("created_by_org_id", core.serialization.string()), + status: core.serialization.lazy(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).PromptStatus; })), name: core.serialization.string(), description: core.serialization.string().optional(), }); diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/PromptVersionRead.d.ts b/clients/fern/api/node_sdk/prompton/serialization/types/PromptVersionRead.d.ts index d865354..78bcec8 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/PromptVersionRead.d.ts +++ b/clients/fern/api/node_sdk/prompton/serialization/types/PromptVersionRead.d.ts @@ -7,17 +7,17 @@ import * as core from "../../core"; export declare const PromptVersionRead: core.serialization.ObjectSchema; export declare namespace PromptVersionRead { interface Raw { - _id?: string | null; - created_at?: string | null; - created_by_user_id?: string | null; - created_by_org_id?: string | null; - status?: serializers.PromptVersionStatus.Raw | null; - provider?: serializers.PromptVersionProviders.Raw | null; + _id: string; + created_at: string; + created_by_user_id: string; + created_by_org_id: string; + status: serializers.PromptVersionStatus.Raw; + provider: serializers.PromptVersionProviders.Raw; name: string; description?: string | null; prompt_id: string; - template?: serializers.ChatGptMessage.Raw[] | null; + template: serializers.ChatGptMessage.Raw[]; model_config?: serializers.ChatGptChatCompletitionConfig.Raw | null; - template_arg_names?: string[] | null; + template_arg_names: string[]; } } diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/PromptVersionRead.js b/clients/fern/api/node_sdk/prompton/serialization/types/PromptVersionRead.js index 27e08e3..eef62c7 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/PromptVersionRead.js +++ b/clients/fern/api/node_sdk/prompton/serialization/types/PromptVersionRead.js @@ -38,18 +38,16 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.PromptVersionRead = void 0; const core = __importStar(require("../../core")); exports.PromptVersionRead = core.serialization.object({ - id: core.serialization.property("_id", core.serialization.string().optional()), - createdAt: core.serialization.property("created_at", core.serialization.string().optional()), - createdByUserId: core.serialization.property("created_by_user_id", core.serialization.string().optional()), - createdByOrgId: core.serialization.property("created_by_org_id", core.serialization.string().optional()), - status: core.serialization.lazy(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).PromptVersionStatus; })).optional(), - provider: core.serialization.lazy(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).PromptVersionProviders; })).optional(), + id: core.serialization.property("_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.string()), + createdByUserId: core.serialization.property("created_by_user_id", core.serialization.string()), + createdByOrgId: core.serialization.property("created_by_org_id", core.serialization.string()), + status: core.serialization.lazy(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).PromptVersionStatus; })), + provider: core.serialization.lazy(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).PromptVersionProviders; })), name: core.serialization.string(), description: core.serialization.string().optional(), promptId: core.serialization.property("prompt_id", core.serialization.string()), - template: core.serialization - .list(core.serialization.lazyObject(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).ChatGptMessage; }))) - .optional(), + template: core.serialization.list(core.serialization.lazyObject(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).ChatGptMessage; }))), modelConfig: core.serialization.property("model_config", core.serialization.lazyObject(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).ChatGptChatCompletitionConfig; })).optional()), - templateArgNames: core.serialization.property("template_arg_names", core.serialization.list(core.serialization.string()).optional()), + templateArgNames: core.serialization.property("template_arg_names", core.serialization.list(core.serialization.string())), }); diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/UserRead.d.ts b/clients/fern/api/node_sdk/prompton/serialization/types/UserRead.d.ts index 2d88494..184c017 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/UserRead.d.ts +++ b/clients/fern/api/node_sdk/prompton/serialization/types/UserRead.d.ts @@ -7,12 +7,12 @@ import * as core from "../../core"; export declare const UserRead: core.serialization.ObjectSchema; export declare namespace UserRead { interface Raw { - _id?: string | null; - created_at?: string | null; - created_by_user_id?: string | null; - created_by_org_id?: string | null; + _id: string; + created_at: string; + created_by_user_id: string; + created_by_org_id: string; full_name?: string | null; - disabled?: boolean | null; + disabled: boolean; role?: serializers.UserRoles.Raw | null; org_id: string; email: string; diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/UserRead.js b/clients/fern/api/node_sdk/prompton/serialization/types/UserRead.js index a02d6af..8453561 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/UserRead.js +++ b/clients/fern/api/node_sdk/prompton/serialization/types/UserRead.js @@ -38,12 +38,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.UserRead = void 0; const core = __importStar(require("../../core")); exports.UserRead = core.serialization.object({ - id: core.serialization.property("_id", core.serialization.string().optional()), - createdAt: core.serialization.property("created_at", core.serialization.string().optional()), - createdByUserId: core.serialization.property("created_by_user_id", core.serialization.string().optional()), - createdByOrgId: core.serialization.property("created_by_org_id", core.serialization.string().optional()), + id: core.serialization.property("_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.string()), + createdByUserId: core.serialization.property("created_by_user_id", core.serialization.string()), + createdByOrgId: core.serialization.property("created_by_org_id", core.serialization.string()), fullName: core.serialization.property("full_name", core.serialization.string().optional()), - disabled: core.serialization.boolean().optional(), + disabled: core.serialization.boolean(), role: core.serialization.lazy(() => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(() => __importStar(require("..")))).UserRoles; })).optional(), orgId: core.serialization.property("org_id", core.serialization.string()), email: core.serialization.string(), diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/index.d.ts b/clients/fern/api/node_sdk/prompton/serialization/types/index.d.ts index 36bec83..3f6e2eb 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/index.d.ts +++ b/clients/fern/api/node_sdk/prompton/serialization/types/index.d.ts @@ -14,6 +14,7 @@ export * from "./DbStatus"; export * from "./HttpValidationError"; export * from "./InferenceCreateByPromptId"; export * from "./InferenceCreateByPromptVersionId"; +export * from "./InferenceError"; export * from "./InferencePostResponse"; export * from "./InferencePostResponseResponse"; export * from "./InferenceRead"; diff --git a/clients/fern/api/node_sdk/prompton/serialization/types/index.js b/clients/fern/api/node_sdk/prompton/serialization/types/index.js index bb4cc52..624ae44 100644 --- a/clients/fern/api/node_sdk/prompton/serialization/types/index.js +++ b/clients/fern/api/node_sdk/prompton/serialization/types/index.js @@ -30,6 +30,7 @@ __exportStar(require("./DbStatus"), exports); __exportStar(require("./HttpValidationError"), exports); __exportStar(require("./InferenceCreateByPromptId"), exports); __exportStar(require("./InferenceCreateByPromptVersionId"), exports); +__exportStar(require("./InferenceError"), exports); __exportStar(require("./InferencePostResponse"), exports); __exportStar(require("./InferencePostResponseResponse"), exports); __exportStar(require("./InferenceRead"), exports); diff --git a/clients/fern/api/openapi/openapi.yml b/clients/fern/api/openapi/openapi.yml index 6e80f13..a8a2df2 100644 --- a/clients/fern/api/openapi/openapi.yml +++ b/clients/fern/api/openapi/openapi.yml @@ -1027,6 +1027,7 @@ components: type: object additionalProperties: type: string + default: {} metadata: title: Metadata type: object @@ -1074,6 +1075,7 @@ components: type: object additionalProperties: type: string + default: {} metadata: title: Metadata type: object @@ -1087,6 +1089,21 @@ components: title: Prompt Version Id type: string additionalProperties: false + InferenceError: + title: InferenceError + required: + - error_class + - message + type: object + properties: + error_class: + title: Error Class + type: string + message: + title: Message + type: string + details: + title: Details InferencePostResponse: title: InferencePostResponse required: @@ -1106,8 +1123,17 @@ components: InferenceRead: title: InferenceRead required: + - _id + - created_at + - created_by_user_id + - created_by_org_id + - template_args - prompt_version_id + - prompt_version_ids_considered - prompt_id + - prompt_version_name + - status + - request type: object properties: _id: @@ -1160,10 +1186,6 @@ components: type: array items: type: string - description: If inference was by prompt_id then a list of all other prompt - versions considered for this inference. I.e. all prompt versions in Live - status at the time of the inference - default: [] prompt_id: title: Prompt Id type: string @@ -1171,9 +1193,7 @@ components: title: Prompt Version Name type: string status: - allOf: - - $ref: '#/components/schemas/InferenceResponseStatus' - default: RequestReceived + $ref: '#/components/schemas/InferenceResponseStatus' request: $ref: '#/components/schemas/InferenceRequestData' response: @@ -1181,6 +1201,9 @@ components: anyOf: - $ref: '#/components/schemas/InferenceResponseData' - $ref: '#/components/schemas/InferenceResponseError' + description: Base model for reading from MongoDB. Same as MongoBaseCreate but + assumes all DB base fields are populated so generated clients doesn't requrie + None checks InferenceRequestData: title: InferenceRequestData required: @@ -1221,6 +1244,8 @@ components: additionalProperties: false InferenceResponseError: title: InferenceResponseError + required: + - error type: object properties: completed_at: @@ -1238,7 +1263,7 @@ components: type: boolean default: true error: - title: Error + $ref: '#/components/schemas/InferenceError' additionalProperties: false InferenceResponseStatus: title: InferenceResponseStatus @@ -1285,6 +1310,10 @@ components: OrgRead: title: OrgRead required: + - _id + - created_at + - created_by_user_id + - created_by_org_id - name type: object properties: @@ -1311,6 +1340,9 @@ components: type: string format: password writeOnly: true + description: Base model for reading from MongoDB. Same as MongoBaseCreate but + assumes all DB base fields are populated so generated clients doesn't requrie + None checks OrgUpdate: title: OrgUpdate type: object @@ -1334,6 +1366,8 @@ components: status: allOf: - $ref: '#/components/schemas/PromptStatus' + description: Prompt status for client consideration only, currently not + used in server logic. default: Active name: title: Name @@ -1346,6 +1380,11 @@ components: PromptRead: title: PromptRead required: + - _id + - created_at + - created_by_user_id + - created_by_org_id + - status - name type: object properties: @@ -1363,9 +1402,7 @@ components: title: Created By Org Id type: string status: - allOf: - - $ref: '#/components/schemas/PromptStatus' - default: Active + $ref: '#/components/schemas/PromptStatus' name: title: Name minLength: 1 @@ -1373,6 +1410,9 @@ components: description: title: Description type: string + description: Base model for reading from MongoDB. Same as MongoBaseCreate but + assumes all DB base fields are populated so generated clients doesn't requrie + None checks PromptStatus: title: PromptStatus enum: @@ -1387,6 +1427,8 @@ components: status: allOf: - $ref: '#/components/schemas/PromptStatus' + description: Prompt status for client consideration only, currently not + used in server logic. default: Active name: title: Name @@ -1438,8 +1480,16 @@ components: PromptVersionRead: title: PromptVersionRead required: + - _id + - created_at + - created_by_user_id + - created_by_org_id + - status + - provider - name - prompt_id + - template + - template_arg_names type: object properties: _id: @@ -1456,13 +1506,9 @@ components: title: Created By Org Id type: string status: - allOf: - - $ref: '#/components/schemas/PromptVersionStatus' - default: Draft + $ref: '#/components/schemas/PromptVersionStatus' provider: - allOf: - - $ref: '#/components/schemas/PromptVersionProviders' - default: OpenAI + $ref: '#/components/schemas/PromptVersionProviders' name: title: Name minLength: 1 @@ -1485,7 +1531,11 @@ components: type: array items: type: string - default: [] + description: List of args in the template - populated by server at PATHC + and POST + description: Base model for reading from MongoDB. Same as MongoBaseCreate but + assumes all DB base fields are populated so generated clients doesn't requrie + None checks PromptVersionStatus: title: PromptVersionStatus enum: @@ -1574,6 +1624,11 @@ components: UserRead: title: UserRead required: + - _id + - created_at + - created_by_user_id + - created_by_org_id + - disabled - org_id - email type: object @@ -1598,7 +1653,6 @@ components: disabled: title: Disabled type: boolean - default: false role: allOf: - $ref: '#/components/schemas/UserRoles' @@ -1609,6 +1663,9 @@ components: email: title: Email type: string + description: Base model for reading from MongoDB. Same as MongoBaseCreate but + assumes all DB base fields are populated so generated clients doesn't requrie + None checks UserRoles: title: UserRoles enum: diff --git a/clients/fern/api/python_sdk/prompton/__init__.py b/clients/fern/api/python_sdk/prompton/__init__.py index b32de33..f196c54 100644 --- a/clients/fern/api/python_sdk/prompton/__init__.py +++ b/clients/fern/api/python_sdk/prompton/__init__.py @@ -18,6 +18,7 @@ HttpValidationError, InferenceCreateByPromptId, InferenceCreateByPromptVersionId, + InferenceError, InferencePostResponse, InferencePostResponseResponse, InferenceRead, @@ -57,6 +58,7 @@ "HttpValidationError", "InferenceCreateByPromptId", "InferenceCreateByPromptVersionId", + "InferenceError", "InferencePostResponse", "InferencePostResponseResponse", "InferenceRead", diff --git a/clients/fern/api/python_sdk/prompton/types/__init__.py b/clients/fern/api/python_sdk/prompton/types/__init__.py index 50be237..704aa9b 100644 --- a/clients/fern/api/python_sdk/prompton/types/__init__.py +++ b/clients/fern/api/python_sdk/prompton/types/__init__.py @@ -15,6 +15,7 @@ from .http_validation_error import HttpValidationError from .inference_create_by_prompt_id import InferenceCreateByPromptId from .inference_create_by_prompt_version_id import InferenceCreateByPromptVersionId +from .inference_error import InferenceError from .inference_post_response import InferencePostResponse from .inference_post_response_response import InferencePostResponseResponse from .inference_read import InferenceRead @@ -52,6 +53,7 @@ "HttpValidationError", "InferenceCreateByPromptId", "InferenceCreateByPromptVersionId", + "InferenceError", "InferencePostResponse", "InferencePostResponseResponse", "InferenceRead", diff --git a/clients/fern/api/python_sdk/prompton/types/inference_error.py b/clients/fern/api/python_sdk/prompton/types/inference_error.py new file mode 100644 index 0000000..6cf3081 --- /dev/null +++ b/clients/fern/api/python_sdk/prompton/types/inference_error.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic + +from ..core.datetime_utils import serialize_datetime + + +class InferenceError(pydantic.BaseModel): + error_class: str + message: str + details: typing.Optional[typing.Any] + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/clients/fern/api/python_sdk/prompton/types/inference_read.py b/clients/fern/api/python_sdk/prompton/types/inference_read.py index 86e729c..3c5e0b5 100644 --- a/clients/fern/api/python_sdk/prompton/types/inference_read.py +++ b/clients/fern/api/python_sdk/prompton/types/inference_read.py @@ -12,10 +12,14 @@ class InferenceRead(pydantic.BaseModel): - id: typing.Optional[str] = pydantic.Field(alias="_id") - created_at: typing.Optional[str] - created_by_user_id: typing.Optional[str] - created_by_org_id: typing.Optional[str] + """ + Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks + """ + + id: str = pydantic.Field(alias="_id") + created_at: str + created_by_user_id: str + created_by_org_id: str end_user_id: typing.Optional[str] = pydantic.Field( description=( "The API consumer's internal user reference for metrics. It is also relayed to the provider as part of the request if the provider supports it (eg. OpenAI's user field).\n" @@ -27,7 +31,7 @@ class InferenceRead(pydantic.BaseModel): client_ref_id: typing.Optional[str] = pydantic.Field( description=("The API consumer's internal reference id to able to link references to their sessions.\n") ) - template_args: typing.Optional[typing.Dict[str, str]] + template_args: typing.Dict[str, str] metadata: typing.Optional[typing.Dict[str, typing.Any]] request_timeout: typing.Optional[float] = pydantic.Field( description=( @@ -35,15 +39,11 @@ class InferenceRead(pydantic.BaseModel): ) ) prompt_version_id: str - prompt_version_ids_considered: typing.Optional[typing.List[str]] = pydantic.Field( - description=( - "If inference was by prompt_id then a list of all other prompt versions considered for this inference. I.e. all prompt versions in Live status at the time of the inference\n" - ) - ) + prompt_version_ids_considered: typing.List[str] prompt_id: str - prompt_version_name: typing.Optional[str] - status: typing.Optional[InferenceResponseStatus] - request: typing.Optional[InferenceRequestData] + prompt_version_name: str + status: InferenceResponseStatus + request: InferenceRequestData response: typing.Optional[InferenceReadResponse] def json(self, **kwargs: typing.Any) -> str: diff --git a/clients/fern/api/python_sdk/prompton/types/inference_response_error.py b/clients/fern/api/python_sdk/prompton/types/inference_response_error.py index 50c2ffd..6993993 100644 --- a/clients/fern/api/python_sdk/prompton/types/inference_response_error.py +++ b/clients/fern/api/python_sdk/prompton/types/inference_response_error.py @@ -6,6 +6,7 @@ import pydantic from ..core.datetime_utils import serialize_datetime +from .inference_error import InferenceError class InferenceResponseError(pydantic.BaseModel): @@ -13,7 +14,7 @@ class InferenceResponseError(pydantic.BaseModel): completition_duration_seconds: typing.Optional[float] is_client_connected_at_finish: typing.Optional[bool] is_error: typing.Optional[bool] = pydantic.Field(alias="isError") - error: typing.Optional[typing.Any] + error: InferenceError def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/clients/fern/api/python_sdk/prompton/types/org_read.py b/clients/fern/api/python_sdk/prompton/types/org_read.py index f0f0ac6..9efba37 100644 --- a/clients/fern/api/python_sdk/prompton/types/org_read.py +++ b/clients/fern/api/python_sdk/prompton/types/org_read.py @@ -9,10 +9,14 @@ class OrgRead(pydantic.BaseModel): - id: typing.Optional[str] = pydantic.Field(alias="_id") - created_at: typing.Optional[str] - created_by_user_id: typing.Optional[str] - created_by_org_id: typing.Optional[str] + """ + Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks + """ + + id: str = pydantic.Field(alias="_id") + created_at: str + created_by_user_id: str + created_by_org_id: str name: str access_keys: typing.Optional[typing.Dict[str, str]] diff --git a/clients/fern/api/python_sdk/prompton/types/prompt_read.py b/clients/fern/api/python_sdk/prompton/types/prompt_read.py index 1c90ef0..85a954a 100644 --- a/clients/fern/api/python_sdk/prompton/types/prompt_read.py +++ b/clients/fern/api/python_sdk/prompton/types/prompt_read.py @@ -10,11 +10,15 @@ class PromptRead(pydantic.BaseModel): - id: typing.Optional[str] = pydantic.Field(alias="_id") - created_at: typing.Optional[str] - created_by_user_id: typing.Optional[str] - created_by_org_id: typing.Optional[str] - status: typing.Optional[PromptStatus] + """ + Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks + """ + + id: str = pydantic.Field(alias="_id") + created_at: str + created_by_user_id: str + created_by_org_id: str + status: PromptStatus name: str = pydantic.Field(description=('`non-empty`\n')) description: typing.Optional[str] diff --git a/clients/fern/api/python_sdk/prompton/types/prompt_version_read.py b/clients/fern/api/python_sdk/prompton/types/prompt_version_read.py index a854cb5..a8253bd 100644 --- a/clients/fern/api/python_sdk/prompton/types/prompt_version_read.py +++ b/clients/fern/api/python_sdk/prompton/types/prompt_version_read.py @@ -13,18 +13,24 @@ class PromptVersionRead(pydantic.BaseModel): - id: typing.Optional[str] = pydantic.Field(alias="_id") - created_at: typing.Optional[str] - created_by_user_id: typing.Optional[str] - created_by_org_id: typing.Optional[str] - status: typing.Optional[PromptVersionStatus] - provider: typing.Optional[PromptVersionProviders] + """ + Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks + """ + + id: str = pydantic.Field(alias="_id") + created_at: str + created_by_user_id: str + created_by_org_id: str + status: PromptVersionStatus + provider: PromptVersionProviders name: str = pydantic.Field(description=('`non-empty`\n')) description: typing.Optional[str] prompt_id: str - template: typing.Optional[typing.List[ChatGptMessage]] + template: typing.List[ChatGptMessage] model_config: typing.Optional[ChatGptChatCompletitionConfig] - template_arg_names: typing.Optional[typing.List[str]] + template_arg_names: typing.List[str] = pydantic.Field( + description=("List of args in the template - populated by server at PATHC and POST\n") + ) def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/clients/fern/api/python_sdk/prompton/types/user_read.py b/clients/fern/api/python_sdk/prompton/types/user_read.py index 05f9b9a..44f225d 100644 --- a/clients/fern/api/python_sdk/prompton/types/user_read.py +++ b/clients/fern/api/python_sdk/prompton/types/user_read.py @@ -10,14 +10,18 @@ class UserRead(pydantic.BaseModel): - id: typing.Optional[str] = pydantic.Field(alias="_id") - created_at: typing.Optional[str] - created_by_user_id: typing.Optional[str] - created_by_org_id: typing.Optional[str] + """ + Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks + """ + + id: str = pydantic.Field(alias="_id") + created_at: str + created_by_user_id: str + created_by_org_id: str full_name: typing.Optional[str] = pydantic.Field( description=('`non-empty`\n') ) - disabled: typing.Optional[bool] + disabled: bool role: typing.Optional[UserRoles] org_id: str email: str diff --git a/clients/fern/api/python_sdk/pyproject.toml b/clients/fern/api/python_sdk/pyproject.toml index bab0635..9cf169e 100644 --- a/clients/fern/api/python_sdk/pyproject.toml +++ b/clients/fern/api/python_sdk/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "prompton" -version = "0.0.4" +version = "0.0.5" description = "Chat prompt template evaluation and inference monitoring" authors = ["PromptOn "] readme = "README.md" diff --git a/clients/fern/fern.config.json b/clients/fern/fern.config.json index 0e6ce2b..6de98f8 100644 --- a/clients/fern/fern.config.json +++ b/clients/fern/fern.config.json @@ -1,4 +1,4 @@ { "organization": "prompton", - "version": "0.10.24" + "version": "0.10.26" } \ No newline at end of file diff --git a/clients/package-lock.json b/clients/package-lock.json index a3ee04d..1cd089b 100644 --- a/clients/package-lock.json +++ b/clients/package-lock.json @@ -6,7 +6,7 @@ "": { "dependencies": { "@openapitools/openapi-generator-cli": "^2.6.0", - "fern-api": "0.10.24" + "fern-api": "0.10.26" } }, "node_modules/@babel/runtime": { @@ -589,9 +589,9 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" }, "node_modules/fern-api": { - "version": "0.10.24", - "resolved": "https://registry.npmjs.org/fern-api/-/fern-api-0.10.24.tgz", - "integrity": "sha512-oPWVjuAm+PjvP2olcsaihdAPEhWTF56KWTVy3agT7llc7AAWD9tz+ZXOcHVKP+0azBbIzB1DGYomernl4HvEDA==", + "version": "0.10.26", + "resolved": "https://registry.npmjs.org/fern-api/-/fern-api-0.10.26.tgz", + "integrity": "sha512-3+af0Xe+0KIPqHWm5EwEpge7e2zqFSgIrg02jdjWKXIikStLlAE9tAOEFYEBxQAP4Xm6O2fdT5YG33lTg7z3tw==", "bin": { "fern": "cli.cjs" } diff --git a/clients/package.json b/clients/package.json index 31a7f71..25a344e 100644 --- a/clients/package.json +++ b/clients/package.json @@ -1,6 +1,6 @@ { "dependencies": { "@openapitools/openapi-generator-cli": "^2.6.0", - "fern-api": "0.10.24" + "fern-api": "0.10.26" } -} +} \ No newline at end of file diff --git a/server/generated/openapi/openapi.json b/server/generated/openapi/openapi.json index 196611a..7a4a241 100644 --- a/server/generated/openapi/openapi.json +++ b/server/generated/openapi/openapi.json @@ -1552,7 +1552,8 @@ "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "metadata": { "title": "Metadata", @@ -1598,7 +1599,8 @@ "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "metadata": { "title": "Metadata", @@ -1616,6 +1618,27 @@ }, "additionalProperties": false }, + "InferenceError": { + "title": "InferenceError", + "required": [ + "error_class", + "message" + ], + "type": "object", + "properties": { + "error_class": { + "title": "Error Class", + "type": "string" + }, + "message": { + "title": "Message", + "type": "string" + }, + "details": { + "title": "Details" + } + } + }, "InferencePostResponse": { "title": "InferencePostResponse", "required": [ @@ -1645,8 +1668,17 @@ "InferenceRead": { "title": "InferenceRead", "required": [ + "_id", + "created_at", + "created_by_user_id", + "created_by_org_id", + "template_args", "prompt_version_id", - "prompt_id" + "prompt_version_ids_considered", + "prompt_id", + "prompt_version_name", + "status", + "request" ], "type": "object", "properties": { @@ -1707,9 +1739,7 @@ "type": "array", "items": { "type": "string" - }, - "description": "If inference was by prompt_id then a list of all other prompt versions considered for this inference. I.e. all prompt versions in Live status at the time of the inference", - "default": [] + } }, "prompt_id": { "title": "Prompt Id", @@ -1720,12 +1750,7 @@ "type": "string" }, "status": { - "allOf": [ - { - "$ref": "#/components/schemas/InferenceResponseStatus" - } - ], - "default": "RequestReceived" + "$ref": "#/components/schemas/InferenceResponseStatus" }, "request": { "$ref": "#/components/schemas/InferenceRequestData" @@ -1741,7 +1766,8 @@ } ] } - } + }, + "description": "Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks" }, "InferenceRequestData": { "title": "InferenceRequestData", @@ -1797,6 +1823,9 @@ }, "InferenceResponseError": { "title": "InferenceResponseError", + "required": [ + "error" + ], "type": "object", "properties": { "completed_at": { @@ -1818,7 +1847,7 @@ "default": true }, "error": { - "title": "Error" + "$ref": "#/components/schemas/InferenceError" } }, "additionalProperties": false @@ -1881,6 +1910,10 @@ "OrgRead": { "title": "OrgRead", "required": [ + "_id", + "created_at", + "created_by_user_id", + "created_by_org_id", "name" ], "type": "object", @@ -1915,7 +1948,8 @@ "writeOnly": true } } - } + }, + "description": "Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks" }, "OrgUpdate": { "title": "OrgUpdate", @@ -1949,6 +1983,7 @@ "$ref": "#/components/schemas/PromptStatus" } ], + "description": "Prompt status for client consideration only, currently not used in server logic.", "default": "Active" }, "name": { @@ -1966,6 +2001,11 @@ "PromptRead": { "title": "PromptRead", "required": [ + "_id", + "created_at", + "created_by_user_id", + "created_by_org_id", + "status", "name" ], "type": "object", @@ -1988,12 +2028,7 @@ "type": "string" }, "status": { - "allOf": [ - { - "$ref": "#/components/schemas/PromptStatus" - } - ], - "default": "Active" + "$ref": "#/components/schemas/PromptStatus" }, "name": { "title": "Name", @@ -2004,7 +2039,8 @@ "title": "Description", "type": "string" } - } + }, + "description": "Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks" }, "PromptStatus": { "title": "PromptStatus", @@ -2025,6 +2061,7 @@ "$ref": "#/components/schemas/PromptStatus" } ], + "description": "Prompt status for client consideration only, currently not used in server logic.", "default": "Active" }, "name": { @@ -2100,8 +2137,16 @@ "PromptVersionRead": { "title": "PromptVersionRead", "required": [ + "_id", + "created_at", + "created_by_user_id", + "created_by_org_id", + "status", + "provider", "name", - "prompt_id" + "prompt_id", + "template", + "template_arg_names" ], "type": "object", "properties": { @@ -2123,20 +2168,10 @@ "type": "string" }, "status": { - "allOf": [ - { - "$ref": "#/components/schemas/PromptVersionStatus" - } - ], - "default": "Draft" + "$ref": "#/components/schemas/PromptVersionStatus" }, "provider": { - "allOf": [ - { - "$ref": "#/components/schemas/PromptVersionProviders" - } - ], - "default": "OpenAI" + "$ref": "#/components/schemas/PromptVersionProviders" }, "name": { "title": "Name", @@ -2167,9 +2202,10 @@ "items": { "type": "string" }, - "default": [] + "description": "List of args in the template - populated by server at PATHC and POST" } - } + }, + "description": "Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks" }, "PromptVersionStatus": { "title": "PromptVersionStatus", @@ -2294,6 +2330,11 @@ "UserRead": { "title": "UserRead", "required": [ + "_id", + "created_at", + "created_by_user_id", + "created_by_org_id", + "disabled", "org_id", "email" ], @@ -2323,8 +2364,7 @@ }, "disabled": { "title": "Disabled", - "type": "boolean", - "default": false + "type": "boolean" }, "role": { "allOf": [ @@ -2342,7 +2382,8 @@ "title": "Email", "type": "string" } - } + }, + "description": "Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks" }, "UserRoles": { "title": "UserRoles", diff --git a/server/generated/openapi/openapi.yml b/server/generated/openapi/openapi.yml index 6e80f13..a8a2df2 100644 --- a/server/generated/openapi/openapi.yml +++ b/server/generated/openapi/openapi.yml @@ -1027,6 +1027,7 @@ components: type: object additionalProperties: type: string + default: {} metadata: title: Metadata type: object @@ -1074,6 +1075,7 @@ components: type: object additionalProperties: type: string + default: {} metadata: title: Metadata type: object @@ -1087,6 +1089,21 @@ components: title: Prompt Version Id type: string additionalProperties: false + InferenceError: + title: InferenceError + required: + - error_class + - message + type: object + properties: + error_class: + title: Error Class + type: string + message: + title: Message + type: string + details: + title: Details InferencePostResponse: title: InferencePostResponse required: @@ -1106,8 +1123,17 @@ components: InferenceRead: title: InferenceRead required: + - _id + - created_at + - created_by_user_id + - created_by_org_id + - template_args - prompt_version_id + - prompt_version_ids_considered - prompt_id + - prompt_version_name + - status + - request type: object properties: _id: @@ -1160,10 +1186,6 @@ components: type: array items: type: string - description: If inference was by prompt_id then a list of all other prompt - versions considered for this inference. I.e. all prompt versions in Live - status at the time of the inference - default: [] prompt_id: title: Prompt Id type: string @@ -1171,9 +1193,7 @@ components: title: Prompt Version Name type: string status: - allOf: - - $ref: '#/components/schemas/InferenceResponseStatus' - default: RequestReceived + $ref: '#/components/schemas/InferenceResponseStatus' request: $ref: '#/components/schemas/InferenceRequestData' response: @@ -1181,6 +1201,9 @@ components: anyOf: - $ref: '#/components/schemas/InferenceResponseData' - $ref: '#/components/schemas/InferenceResponseError' + description: Base model for reading from MongoDB. Same as MongoBaseCreate but + assumes all DB base fields are populated so generated clients doesn't requrie + None checks InferenceRequestData: title: InferenceRequestData required: @@ -1221,6 +1244,8 @@ components: additionalProperties: false InferenceResponseError: title: InferenceResponseError + required: + - error type: object properties: completed_at: @@ -1238,7 +1263,7 @@ components: type: boolean default: true error: - title: Error + $ref: '#/components/schemas/InferenceError' additionalProperties: false InferenceResponseStatus: title: InferenceResponseStatus @@ -1285,6 +1310,10 @@ components: OrgRead: title: OrgRead required: + - _id + - created_at + - created_by_user_id + - created_by_org_id - name type: object properties: @@ -1311,6 +1340,9 @@ components: type: string format: password writeOnly: true + description: Base model for reading from MongoDB. Same as MongoBaseCreate but + assumes all DB base fields are populated so generated clients doesn't requrie + None checks OrgUpdate: title: OrgUpdate type: object @@ -1334,6 +1366,8 @@ components: status: allOf: - $ref: '#/components/schemas/PromptStatus' + description: Prompt status for client consideration only, currently not + used in server logic. default: Active name: title: Name @@ -1346,6 +1380,11 @@ components: PromptRead: title: PromptRead required: + - _id + - created_at + - created_by_user_id + - created_by_org_id + - status - name type: object properties: @@ -1363,9 +1402,7 @@ components: title: Created By Org Id type: string status: - allOf: - - $ref: '#/components/schemas/PromptStatus' - default: Active + $ref: '#/components/schemas/PromptStatus' name: title: Name minLength: 1 @@ -1373,6 +1410,9 @@ components: description: title: Description type: string + description: Base model for reading from MongoDB. Same as MongoBaseCreate but + assumes all DB base fields are populated so generated clients doesn't requrie + None checks PromptStatus: title: PromptStatus enum: @@ -1387,6 +1427,8 @@ components: status: allOf: - $ref: '#/components/schemas/PromptStatus' + description: Prompt status for client consideration only, currently not + used in server logic. default: Active name: title: Name @@ -1438,8 +1480,16 @@ components: PromptVersionRead: title: PromptVersionRead required: + - _id + - created_at + - created_by_user_id + - created_by_org_id + - status + - provider - name - prompt_id + - template + - template_arg_names type: object properties: _id: @@ -1456,13 +1506,9 @@ components: title: Created By Org Id type: string status: - allOf: - - $ref: '#/components/schemas/PromptVersionStatus' - default: Draft + $ref: '#/components/schemas/PromptVersionStatus' provider: - allOf: - - $ref: '#/components/schemas/PromptVersionProviders' - default: OpenAI + $ref: '#/components/schemas/PromptVersionProviders' name: title: Name minLength: 1 @@ -1485,7 +1531,11 @@ components: type: array items: type: string - default: [] + description: List of args in the template - populated by server at PATHC + and POST + description: Base model for reading from MongoDB. Same as MongoBaseCreate but + assumes all DB base fields are populated so generated clients doesn't requrie + None checks PromptVersionStatus: title: PromptVersionStatus enum: @@ -1574,6 +1624,11 @@ components: UserRead: title: UserRead required: + - _id + - created_at + - created_by_user_id + - created_by_org_id + - disabled - org_id - email type: object @@ -1598,7 +1653,6 @@ components: disabled: title: Disabled type: boolean - default: false role: allOf: - $ref: '#/components/schemas/UserRoles' @@ -1609,6 +1663,9 @@ components: email: title: Email type: string + description: Base model for reading from MongoDB. Same as MongoBaseCreate but + assumes all DB base fields are populated so generated clients doesn't requrie + None checks UserRoles: title: UserRoles enum: diff --git a/server/poetry.lock b/server/poetry.lock index f8c74e1..2b81dc6 100644 --- a/server/poetry.lock +++ b/server/poetry.lock @@ -562,13 +562,13 @@ idna = ">=2.0.0" [[package]] name = "fastapi" -version = "0.96.1" +version = "0.97.0" description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" optional = false python-versions = ">=3.7" files = [ - {file = "fastapi-0.96.1-py3-none-any.whl", hash = "sha256:22d773ce95f14f04f8f37a0c8998fc163e67af83b65510d2879de6cbaaa10215"}, - {file = "fastapi-0.96.1.tar.gz", hash = "sha256:5c1d243030e63089ccfc0aec69c2da6d619943917727e8e82ee502358d5119bf"}, + {file = "fastapi-0.97.0-py3-none-any.whl", hash = "sha256:95d757511c596409930bd20673358d4a4d709004edb85c5d24d6ffc48fabcbf2"}, + {file = "fastapi-0.97.0.tar.gz", hash = "sha256:b53248ee45f64f19bb7600953696e3edf94b0f7de94df1e5433fc5c6136fa986"}, ] [package.dependencies] @@ -577,9 +577,6 @@ starlette = ">=0.27.0,<0.28.0" [package.extras] all = ["email-validator (>=1.1.1)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "python-multipart (>=0.0.5)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"] -dev = ["pre-commit (>=2.17.0,<3.0.0)", "ruff (==0.0.138)", "uvicorn[standard] (>=0.12.0,<0.21.0)"] -doc = ["mdx-include (>=1.4.1,<2.0.0)", "mkdocs (>=1.1.2,<2.0.0)", "mkdocs-markdownextradata-plugin (>=0.1.7,<0.3.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "pyyaml (>=5.3.1,<7.0.0)", "typer-cli (>=0.0.13,<0.0.14)", "typer[all] (>=0.6.1,<0.8.0)"] -test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==23.1.0)", "coverage[toml] (>=6.5.0,<8.0)", "databases[sqlite] (>=0.3.2,<0.7.0)", "email-validator (>=1.1.1,<2.0.0)", "flask (>=1.1.2,<3.0.0)", "httpx (>=0.23.0,<0.24.0)", "isort (>=5.0.6,<6.0.0)", "mypy (==0.982)", "orjson (>=3.2.1,<4.0.0)", "passlib[bcrypt] (>=1.7.2,<2.0.0)", "peewee (>=3.13.3,<4.0.0)", "pytest (>=7.1.3,<8.0.0)", "python-jose[cryptography] (>=3.3.0,<4.0.0)", "python-multipart (>=0.0.5,<0.0.7)", "pyyaml (>=5.3.1,<7.0.0)", "ruff (==0.0.138)", "sqlalchemy (>=1.3.18,<1.4.43)", "types-orjson (==3.6.2)", "types-ujson (==5.7.0.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0)"] [[package]] name = "flake8" @@ -817,13 +814,13 @@ sentinels = "*" [[package]] name = "mongomock-motor" -version = "0.0.19" +version = "0.0.20" description = "Library for mocking AsyncIOMotorClient built on top of mongomock." optional = false python-versions = ">=3.6" files = [ - {file = "mongomock_motor-0.0.19-py3-none-any.whl", hash = "sha256:954444de0a6371acbd45b0ecad6a9daab99e0e652c863d15a65189a196201cc5"}, - {file = "mongomock_motor-0.0.19.tar.gz", hash = "sha256:1d716c20b982c11fad2569d0d220c570fdaf63a90a719a00bb83622fefcd6646"}, + {file = "mongomock_motor-0.0.20-py3-none-any.whl", hash = "sha256:908bc8f969ced87e11e2c526b3f215d51410c28148cc7374d0ee285d64c98d91"}, + {file = "mongomock_motor-0.0.20.tar.gz", hash = "sha256:f708073db304ebee95bfd37ea9ef93019196082cd11dd5e61d34c9e8be213521"}, ] [package.dependencies] @@ -1085,13 +1082,13 @@ files = [ [[package]] name = "platformdirs" -version = "3.5.3" +version = "3.6.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.5.3-py3-none-any.whl", hash = "sha256:0ade98a4895e87dc51d47151f7d2ec290365a585151d97b4d8d6312ed6132fed"}, - {file = "platformdirs-3.5.3.tar.gz", hash = "sha256:e48fabd87db8f3a7df7150a4a5ea22c546ee8bc39bc2473244730d4b56d2cc4e"}, + {file = "platformdirs-3.6.0-py3-none-any.whl", hash = "sha256:ffa199e3fbab8365778c4a10e1fbf1b9cd50707de826eb304b50e57ec0cc8d38"}, + {file = "platformdirs-3.6.0.tar.gz", hash = "sha256:57e28820ca8094678b807ff529196506d7a21e17156cb1cddb3e74cebce54640"}, ] [package.extras] @@ -1745,4 +1742,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "026e70492e66f1326ba6f336ee446fa399036455b751f82bf88e1d91dc114317" +content-hash = "ac7b5003f600df0309f9ad7d1d780fd5b1529cbb0933fe266a257e276d4794f1" diff --git a/server/pyproject.toml b/server/pyproject.toml index 227a598..e29acb6 100644 --- a/server/pyproject.toml +++ b/server/pyproject.toml @@ -7,7 +7,7 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.11" -fastapi = "^0.96.0" +fastapi = "0.97.0" motor = "^3.1.2" uvicorn = "^0.22.0" httpx = "^0.24.1" @@ -23,7 +23,7 @@ mangum = "^0.17.0" [tool.poetry.group.dev.dependencies] mypy = "^1.3.0" pytest = "^7.3.1" -mongomock-motor = "^0.0.19" +mongomock-motor = "0.0.20" deepdiff = "^6.3.0" python-dotenv = "^1.0.0" pyyaml = "^6.0" diff --git a/server/src/core/completition.py b/server/src/core/completition.py index 80359ea..8a12bc4 100644 --- a/server/src/core/completition.py +++ b/server/src/core/completition.py @@ -7,6 +7,7 @@ ChatGPTChatCompletitionResponse, ) from src.schemas.inference import ( + InferenceError, InferenceResponseData, InferenceResponseError, ) @@ -21,7 +22,10 @@ "usage": {"prompt_tokens": 25, "completion_tokens": 1, "total_tokens": 26}, "choices": [ { - "message": {"role": "assistant", "content": "71"}, + "message": { + "role": "assistant", + "content": "This is a mocked response - called with 'mock_me_softly'", + }, "finish_reason": "stop", "index": 0, } @@ -85,12 +89,9 @@ async def get_openai_chat_completition( except Exception as e: full_classname = f"{e.__class__.__module__}.{e.__class__.__name__}" response = InferenceResponseError( - error={ - "error_class": full_classname, - "error": vars(e)["error"] if "error" in vars(e) else None, - "message": str(e), - "details": {**vars(e)}, - }, + error=InferenceError( + error_class=full_classname, message=str(e), details={**vars(e)} + ) ) finally: end_time = time.perf_counter() diff --git a/server/src/core/templateProcessing.py b/server/src/core/templateProcessing.py index 0fd8bfb..4eb75ca 100644 --- a/server/src/core/templateProcessing.py +++ b/server/src/core/templateProcessing.py @@ -28,7 +28,7 @@ def get_arg_identifiers(template: ChatGPTMessageTemplate): def get_populated_template(template: ChatGPTMessageTemplate, args: dict[str, str]): res: ChatGPTMessageTemplate = [] - if template is not None and args is not None: + if template is not None and args is not None and len(args) > 0: for msg in template: res.append( ChatGPTMessage( @@ -40,7 +40,7 @@ def get_populated_template(template: ChatGPTMessageTemplate, args: dict[str, str } # type: ignore[arg-type] ) ) - if args is None: + else: res = copy.deepcopy(template) return res diff --git a/server/src/crud/base.py b/server/src/crud/base.py index e270a4c..cd976b6 100644 --- a/server/src/crud/base.py +++ b/server/src/crud/base.py @@ -11,11 +11,11 @@ ItemNotFoundException, NoItemUpdatedException, ) -from src.schemas.base import MongoBase +from src.schemas.base import MongoBaseCreate from src.schemas.user import UserInDB, UserRoles -DBModelType = TypeVar("DBModelType", bound=MongoBase) +DBModelType = TypeVar("DBModelType", bound=MongoBaseCreate) CreateSchemaType = TypeVar("CreateSchemaType", bound=BaseModel) UpdateSchemaType = TypeVar("UpdateSchemaType", bound=BaseModel) UpdateResponseSchemaType = TypeVar("UpdateResponseSchemaType", bound=BaseModel) diff --git a/server/src/crud/inference.py b/server/src/crud/inference.py index 2539469..f73bcf6 100644 --- a/server/src/crud/inference.py +++ b/server/src/crud/inference.py @@ -16,6 +16,7 @@ InferenceCreateByPromptVersionId, InferenceCreateByPromptId, InferenceRequestData, + InferenceResponseStatus, InferenceUpdate, ) from src.schemas.openAI import ChatGPTChatCompletitionRequest @@ -114,6 +115,7 @@ async def process_create_data( ) inferenceDB = InferenceInDB( + status=InferenceResponseStatus.REQUEST_RECEIVED, prompt_id=prompt_version.prompt_id, prompt_version_id=selected_prompt_version_id, prompt_version_name=prompt_version.name, diff --git a/server/src/endpoints/endpoint_exceptions.py b/server/src/endpoints/endpoint_exceptions.py index 341f686..204af67 100644 --- a/server/src/endpoints/endpoint_exceptions.py +++ b/server/src/endpoints/endpoint_exceptions.py @@ -1,5 +1,7 @@ from fastapi import HTTPException, status +from src.schemas.inference import InferenceResponseError + class ItemNotFoundException(HTTPException): def __init__( @@ -62,7 +64,13 @@ def __init__(self, message=None): class OpenAIError(HTTPException): - def __init__(self, message=None, inference_id=None, error=None): + def __init__( + self, + message=None, + inference_id=None, + *, + inferenceResponse: InferenceResponseError, + ): """Raises HTTP 502 Bad Gateway - use this exception when OpenAI API call returns with error.""" self.message = message super().__init__( @@ -70,9 +78,9 @@ def __init__(self, message=None, inference_id=None, error=None): detail={ "inference_id": str(inference_id), "message": self.message, - "openAI_error_class": error.get("error_class") if error else None, - "openAI_message": error.get("message") if error else None, - "openAI_error": error.get("error") if error else None, + "openAI_error_class": inferenceResponse.error.error_class, + "openAI_message": inferenceResponse.error.message, + "openAI_error": inferenceResponse.error.details, }, ) diff --git a/server/src/endpoints/inferences.py b/server/src/endpoints/inferences.py index 300ba07..21c20fd 100644 --- a/server/src/endpoints/inferences.py +++ b/server/src/endpoints/inferences.py @@ -163,7 +163,7 @@ async def new_inference( if isinstance(inferenceResponse, InferenceResponseError): inferenceResponse.isError = True - if inferenceResponse.error.get("error_class") == "openai.error.Timeout": + if inferenceResponse.error.error_class == "openai.error.Timeout": status = InferenceResponseStatus.COMPLETITION_TIMEOUT else: status = InferenceResponseStatus.COMPLETITION_ERROR @@ -183,13 +183,13 @@ async def new_inference( if status == InferenceResponseStatus.COMPLETITION_TIMEOUT: raise OpenAIError( inference_id=inferenceDB.id, - error=inferenceResponse.error, + inferenceResponse=inferenceResponse, message="OpenAI API Timeout Error", ) else: # status == InferenceResponseStatus.COMPLETITION_ERROR raise OpenAIError( inference_id=inferenceDB.id, - error=inferenceResponse.error, + inferenceResponse=inferenceResponse, message="OpenAI API Error", ) diff --git a/server/src/schemas/base.py b/server/src/schemas/base.py index cd35cf9..1ab8e19 100644 --- a/server/src/schemas/base.py +++ b/server/src/schemas/base.py @@ -37,13 +37,26 @@ def __modify_schema__(cls, field_schema): field_schema.update(type="string") -class MongoBase(MyBaseModel): +class MongoBaseCreate(MyBaseModel): + """Base model for creating a record in MongoDB. Populates `id` and `created_at` when not passed. + `created_by_user_id` and `created_by_org_id` fields should be populated by base CRUD class + """ + id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") created_at: datetime = Field(default_factory=datetime.utcnow) created_by_user_id: Optional[PyObjectId] = None created_by_org_id: Optional[PyObjectId] = None +class MongoBaseRead(MyBaseModel): + """Base model for reading from MongoDB. Same as MongoBaseCreate but assumes all DB base fields are populated so generated clients doesn't requrie None checks""" + + id: PyObjectId = Field(alias="_id") + created_at: datetime + created_by_user_id: PyObjectId + created_by_org_id: PyObjectId + + class AllOptional(pydantic.main.ModelMetaclass): """Make all fields optional on class but keep validators. Using it PATCH schema can be based on Base/Create schema `class PromptUpdate(AllOptional, PromptBase):` diff --git a/server/src/schemas/inference.py b/server/src/schemas/inference.py index 784d7b0..0c68e0f 100644 --- a/server/src/schemas/inference.py +++ b/server/src/schemas/inference.py @@ -1,6 +1,6 @@ from datetime import datetime from enum import Enum -from typing import Any, List, Optional +from typing import Any, Dict, List, Optional from pydantic import Extra, Field from src.schemas.openAI import ( ChatGPTChatCompletitionRequest, @@ -8,7 +8,7 @@ ChatGPTTokenUsage, ) -from src.schemas.base import MongoBase, MyBaseModel, PyObjectId +from src.schemas.base import MongoBaseCreate, MongoBaseRead, MyBaseModel, PyObjectId from src.schemas.promptVersion import PromptVersionProviders @@ -34,7 +34,7 @@ class InferenceBase(MyBaseModel): None, description="The API consumer's internal reference id to able to link references to their sessions.", ) - template_args: Optional[dict[str, str]] = Field(None) + template_args: Optional[dict[str, str]] = Field({}) metadata: Optional[dict[str, Any]] = Field(None) request_timeout: Optional[float] = Field( None, @@ -61,9 +61,15 @@ class InferenceResponseBase(MyBaseModel): is_client_connected_at_finish: Optional[bool] = None +class InferenceError(MyBaseModel, extra=Extra.allow): + error_class: str + message: str + details: Any + + class InferenceResponseError(InferenceResponseBase): isError: bool = True - error: Any + error: InferenceError class InferenceResponseData(InferenceResponseBase): @@ -83,22 +89,29 @@ class InferenceUpdate(MyBaseModel, extra=Extra.forbid): response: InferenceResponseData | InferenceResponseError -class InferenceInDB(InferenceBase, MongoBase, extra=Extra.allow): +class InferenceInDBBase(InferenceBase, extra=Extra.allow): prompt_version_id: PyObjectId prompt_version_ids_considered: List[PyObjectId] = Field( - [], + ..., description="If inference was by prompt_id then a list of all other prompt versions considered for this inference. I.e. all prompt versions in Live status at the time of the inference", ) prompt_id: PyObjectId - prompt_version_name: str = Field(None) - status: Optional[InferenceResponseStatus] = Field( - default=InferenceResponseStatus.REQUEST_RECEIVED - ) - request: InferenceRequestData = Field(None) + prompt_version_name: str + status: InferenceResponseStatus + request: InferenceRequestData response: Optional[InferenceResponseData | InferenceResponseError] = Field(None) -class InferenceRead(InferenceInDB, extra=Extra.ignore): +class InferenceInDB(InferenceInDBBase, MongoBaseCreate, extra=Extra.allow): + """Same as InferenceRead but status and base DB fields are not mandatory to be populated by pydantic defaults""" + + pass + + +class InferenceRead(InferenceInDBBase, MongoBaseRead, extra=Extra.ignore): + # Same as InferenceInDB but fields with default values are mandatory so clients don't need to check None values + prompt_version_ids_considered: List[PyObjectId] + template_args: Dict[str, str] pass diff --git a/server/src/schemas/org.py b/server/src/schemas/org.py index e2a4777..cd46de0 100644 --- a/server/src/schemas/org.py +++ b/server/src/schemas/org.py @@ -2,7 +2,8 @@ from pydantic import Extra, SecretStr from src.schemas.base import ( AllOptional, - MongoBase, + MongoBaseCreate, + MongoBaseRead, MyBaseModel, NonEmptyStrField, ) @@ -17,11 +18,11 @@ class OrgCreate(OrgBase, extra=Extra.forbid): pass -class OrgInDB(OrgBase, MongoBase, extra=Extra.allow): +class OrgInDB(OrgBase, MongoBaseCreate, extra=Extra.allow): pass -class OrgRead(MongoBase, extra=Extra.ignore): +class OrgRead(MongoBaseRead, extra=Extra.ignore): name: str access_keys: Dict[str, SecretStr] | None = None diff --git a/server/src/schemas/prompt.py b/server/src/schemas/prompt.py index c0b83cb..23b68db 100644 --- a/server/src/schemas/prompt.py +++ b/server/src/schemas/prompt.py @@ -2,7 +2,13 @@ from typing import Optional from pydantic import Extra, Field -from src.schemas.base import AllOptional, MongoBase, MyBaseModel, NameField +from src.schemas.base import ( + AllOptional, + MongoBaseCreate, + MongoBaseRead, + MyBaseModel, + NameField, +) class PromptStatus(str, Enum): @@ -11,17 +17,21 @@ class PromptStatus(str, Enum): class PromptCreate(MyBaseModel, extra=Extra.forbid): - status: PromptStatus = Field(default=PromptStatus.ACTIVE) + status: PromptStatus = Field( + default=PromptStatus.ACTIVE, + description="Prompt status for client consideration only, currently not used in server logic.", + ) name: NameField description: Optional[str] = Field(None) -class PromptInDB(PromptCreate, MongoBase, extra=Extra.allow): +class PromptInDB(PromptCreate, MongoBaseCreate, extra=Extra.allow): pass -class PromptRead(PromptCreate, MongoBase, extra=Extra.ignore): - pass +class PromptRead(PromptCreate, MongoBaseRead, extra=Extra.ignore): + # override status to be mandatory so clients don't need to check None values + status: PromptStatus class PromptUpdate(PromptCreate, metaclass=AllOptional): diff --git a/server/src/schemas/promptVersion.py b/server/src/schemas/promptVersion.py index 95c0476..508a170 100644 --- a/server/src/schemas/promptVersion.py +++ b/server/src/schemas/promptVersion.py @@ -2,12 +2,12 @@ from typing import List, Optional from pydantic import Extra, Field, root_validator, validator -from src.schemas.base import AllOptional, PyObjectId +from src.schemas.base import AllOptional, MongoBaseRead, PyObjectId from src.schemas.openAI import ( ChatGPTChatCompletitionConfig, ChatGPTMessageTemplate, ) -from src.schemas.base import MongoBase, MyBaseModel, NameField +from src.schemas.base import MongoBaseCreate, MyBaseModel, NameField class PromptVersionProviders(str, Enum): @@ -58,14 +58,22 @@ def nondraft_check_mandatory_fields(cls, values): return values -class PromptVersionInDB(PromptVersionBase, MongoBase, extra=Extra.allow): - # list of args in the template - calculated at patch and post +class PromptVersionInDB(PromptVersionBase, MongoBaseCreate, extra=Extra.allow): # NB: pydantic 2.0alpha has computed fields https://github.com/pydantic/pydantic/blob/48f6842c7808807e076a69065f60a40b57f5fc5a/docs/usage/computed_fields.md#L4 - template_arg_names: Optional[List[str]] = Field([]) - - -class PromptVersionRead(PromptVersionInDB, extra=Extra.ignore): - pass + template_arg_names: List[str] = Field( + default=[], + ) + + +class PromptVersionRead(PromptVersionBase, MongoBaseRead, extra=Extra.ignore): + # just overriding so all fields are mandatory so clients don't need to check None values + provider: PromptVersionProviders + status: PromptVersionStatus + template: ChatGPTMessageTemplate + template_arg_names: List[str] = Field( + ..., + description="List of args in the template - populated by server at PATHC and POST", + ) class PromptVersionUpdate(PromptVersionBase, metaclass=AllOptional, extra=Extra.forbid): diff --git a/server/src/schemas/user.py b/server/src/schemas/user.py index f5c8098..9b301f4 100644 --- a/server/src/schemas/user.py +++ b/server/src/schemas/user.py @@ -3,7 +3,8 @@ from src.schemas.base import ( AllOptional, - MongoBase, + MongoBaseCreate, + MongoBaseRead, MyBaseModel, NonEmptyStrField, PyObjectId, @@ -38,14 +39,16 @@ class UserCreate(User, extra=Extra.forbid): pass -class UserInDB(User, MongoBase, extra=Extra.allow): +class UserInDB(User, MongoBaseCreate, extra=Extra.allow): email: str hashed_password: str -class UserRead(User, MongoBase, extra=Extra.ignore): +class UserRead(User, MongoBaseRead, extra=Extra.ignore): # we ignore extra fields to prevent hashed_password to be returned + # override all fields with default values as mandatory so clients don't need to check None values email: str + disabled: bool pass diff --git a/server/tests/core/inferenceProcessing_test_data.py b/server/tests/core/inferenceProcessing_test_data.py index 5af3f76..89f3225 100644 --- a/server/tests/core/inferenceProcessing_test_data.py +++ b/server/tests/core/inferenceProcessing_test_data.py @@ -42,7 +42,6 @@ "isError": True, "error": { "error_class": "builtins.Exception", - "error": None, "message": "mocked error", "details": {}, }, diff --git a/server/tests/endpoints/inferences/inference_test_records.py b/server/tests/endpoints/inferences/inference_test_records.py index 8b359f8..c6b3f88 100644 --- a/server/tests/endpoints/inferences/inference_test_records.py +++ b/server/tests/endpoints/inferences/inference_test_records.py @@ -132,7 +132,7 @@ "end_user_id": "fail_me_softly", "client_ref_id": None, "source": "openaidocs", - "template_args": None, + "template_args": {}, "metadata": None, "request_timeout": None, "prompt_id": PROMPT_ID2, @@ -172,7 +172,6 @@ "isError": True, "error": { "error_class": "openai.error.APIError", - "error": None, "message": "mocking error", "details": { "_message": "mocking error", @@ -197,7 +196,7 @@ "client_ref_id": None, "end_user_id": None, "source": None, - "template_args": None, + "template_args": {}, "metadata": None, "request_timeout": None, "prompt_id": PROMPT_ID2, @@ -235,7 +234,6 @@ "isError": True, "error": { "error_class": "openai.error.Timeout", - "error": None, "message": "timeout error", "details": { "_message": "timeout error", diff --git a/server/tests/endpoints/inferences/inferences_post_test_spec.py b/server/tests/endpoints/inferences/inferences_post_test_spec.py index 0ca4a8e..904b916 100644 --- a/server/tests/endpoints/inferences/inferences_post_test_spec.py +++ b/server/tests/endpoints/inferences/inferences_post_test_spec.py @@ -126,8 +126,7 @@ expected_min_fields_head = { "created_by_user_id": USER_BASIC["_id"], "created_by_org_id": ORG1["_id"], - "template_args": None, - "metadata": None, + "template_args": {}, "end_user_id": None, "source": None, "client_ref_id": None, @@ -312,7 +311,6 @@ def custom_db_validator_for_post_by_prompt_id(actual_db: Dict[str, Any]) -> bool "is_client_connected_at_finish": True, "error": { "error_class": "openai.error.APIError", - "error": None, "message": "mocked error", }, }, @@ -342,7 +340,6 @@ def custom_db_validator_for_post_by_prompt_id(actual_db: Dict[str, Any]) -> bool "is_client_connected_at_finish": True, "error": { "error_class": "openai.error.Timeout", - "error": None, "message": "mocked timeout", }, }, diff --git a/server/tests/endpoints/inferences/test_inferences_get_gen.py b/server/tests/endpoints/inferences/test_inferences_get_gen.py index 2ff890a..95a2ecb 100644 --- a/server/tests/endpoints/inferences/test_inferences_get_gen.py +++ b/server/tests/endpoints/inferences/test_inferences_get_gen.py @@ -1,6 +1,6 @@ from tests.endpoints.inferences.inferences_get_test_spec import ( inferences_get_test_db, - test_spec_get as inferences_test_spec_get, + test_spec_get, ) from tests.endpoints.test_generators.get_test_genarator import ( generate_pytest_get, @@ -9,7 +9,7 @@ test_inferences_get = generate_pytest_get( - "/inferences", inferences_get_test_db, inferences_test_spec_get + "/inferences", inferences_get_test_db, test_spec_get ) test_inferences_get_empty = generate_pytest_get_empty("/inferences") diff --git a/server/tests/endpoints/inferences/test_inferences_post_gw_errors.py b/server/tests/endpoints/inferences/test_inferences_post_gw_errors.py index 7331377..5ae0626 100644 --- a/server/tests/endpoints/inferences/test_inferences_post_gw_errors.py +++ b/server/tests/endpoints/inferences/test_inferences_post_gw_errors.py @@ -57,7 +57,10 @@ async def test_inference_post_openai_errors( expected_response, response_data, ignore_order=True, - exclude_paths=["root['detail']['inference_id']"], + exclude_paths=[ + "root['detail']['inference_id']", + "root['detail']['openAI_error']", + ], ) print(" *** response vs expected diff:\n", diff.pretty()) assert diff == {}, "response data should be as expected" diff --git a/server/tests/endpoints/promptVersions/promptVersions_test_records.py b/server/tests/endpoints/promptVersions/promptVersions_test_records.py index b6517c6..d80811a 100644 --- a/server/tests/endpoints/promptVersions/promptVersions_test_records.py +++ b/server/tests/endpoints/promptVersions/promptVersions_test_records.py @@ -82,7 +82,7 @@ "description": None, "prompt_id": PROMPT_WITH_1_VER["_id"], "provider": "OpenAI", - "template": None, + "template": [], "model_config": None, "template_arg_names": [], } diff --git a/server/tests/shared_test_data.py b/server/tests/shared_test_data.py index e3ef6e5..f600a45 100644 --- a/server/tests/shared_test_data.py +++ b/server/tests/shared_test_data.py @@ -47,11 +47,13 @@ USER_BASIC: Dict[str, Any] = { "_id": ObjectId("aaaaaaaaaaaaaaaaaaaaaaa1"), + "created_at": "2021-05-15T15:46:02.051309", "org_id": ORG_ID1, "created_by_user_id": ObjectId("645d786f180786983c9eede6"), "created_by_org_id": ObjectId("ccccccccccccccccccccccc1"), "email": "basic@me.ai", "role": "Basic", + "disabled": False, "hashed_password": "$2b$12$JhlMpZQbm09aYUqpgz4gjOBD9k/vOE0QfgzXBMCwpbRbINDEScCY6", } @@ -60,6 +62,7 @@ USER_BASIC_ORG2 = { "_id": ObjectId("aaaaaaaaaaaaaaaaaaaaaaa2"), + "created_at": "2021-05-15T15:46:02.051309", "org_id": ORG_ID2, "created_by_user_id": ObjectId("645d786f180786983c9eede6"), "created_by_org_id": ObjectId("ccccccccccccccccccccccc1"), @@ -69,6 +72,7 @@ USER_ORG_ADMIN = { "_id": ObjectId("aaaaaaaaaaaaaaaaaaaaaaa3"), + "created_at": "2021-05-15T15:46:02.051309", "org_id": ORG_ID1, "created_by_user_id": ObjectId("645d786f180786983c9eede6"), "created_by_org_id": ObjectId("ccccccccccccccccccccccc1"), @@ -79,6 +83,7 @@ USER_ORG_ADMIN_ORG2 = { "_id": ObjectId("aaaaaaaaaaaaaaaaaaaaaaa4"), + "created_at": "2021-05-15T15:46:02.051309", "org_id": ORG_ID2, "created_by_user_id": ObjectId("645d786f180786983c9eede6"), "created_by_org_id": ObjectId("ccccccccccccccccccccccc1"), @@ -89,6 +94,7 @@ USER_SUPER_ADMIN = { "_id": ObjectId("aaaaaaaaaaaaaaaaaaaaaaa5"), + "created_at": "2021-05-15T15:46:02.051309", "org_id": ObjectId("ccccccccccccccccccccccc1"), "created_by_user_id": ObjectId("645d786f180786983c9eede6"), "created_by_org_id": ObjectId("ccccccccccccccccccccccc1"),