Skip to content

Commit

Permalink
Merge pull request #49 from PromptOn/schema-finessing-for-sdk
Browse files Browse the repository at this point in the history
Schema finessing for sdk
  • Loading branch information
szerintedmi authored Jun 18, 2023
2 parents 61a3f4c + 0f5679a commit a59c1c7
Show file tree
Hide file tree
Showing 91 changed files with 751 additions and 390 deletions.
4 changes: 3 additions & 1 deletion clients/fern/api/generators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions clients/fern/api/node_sdk/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions clients/fern/api/node_sdk/prompton/Client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 9 additions & 9 deletions clients/fern/api/node_sdk/prompton/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const errors = __importStar(require("../../errors"));
class BadRequestError extends errors.PromptonApiError {
constructor(body) {
super({
message: "BadRequestError",
statusCode: 400,
body: body,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const errors = __importStar(require("../../errors"));
class NotFoundError extends errors.PromptonApiError {
constructor(body) {
super({
message: "NotFoundError",
statusCode: 404,
body: body,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const errors = __importStar(require("../../errors"));
class UnauthorizedError extends errors.PromptonApiError {
constructor(body) {
super({
message: "UnauthorizedError",
statusCode: 401,
body: body,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const errors = __importStar(require("../../errors"));
class UnprocessableEntityError extends errors.PromptonApiError {
constructor(body) {
super({
message: "UnprocessableEntityError",
statusCode: 422,
body: body,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PromptonApi.OrgRead[]>;
/**
* @throws {@link PromptonApi.BadRequestError}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Loading

0 comments on commit a59c1c7

Please sign in to comment.