diff --git a/package.json b/package.json index fd10ae7..275d9e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@getzep/zep-cloud", - "version": "1.0.9", + "version": "1.0.10", "private": false, "repository": "https://github.com/getzep/zep-js", "description": "Zep: Fast, scalable building blocks for production LLM apps", diff --git a/src/api/resources/document/client/Client.ts b/src/api/resources/document/client/Client.ts index 5aae75b..896ac4b 100644 --- a/src/api/resources/document/client/Client.ts +++ b/src/api/resources/document/client/Client.ts @@ -49,7 +49,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -141,7 +141,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -255,7 +255,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -370,7 +370,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -484,7 +484,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -602,7 +602,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -708,7 +708,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -814,7 +814,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -920,7 +920,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1026,7 +1026,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1130,7 +1130,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1246,7 +1246,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1366,7 +1366,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), diff --git a/src/api/resources/memory/client/Client.ts b/src/api/resources/memory/client/Client.ts index 693d972..588c7b9 100644 --- a/src/api/resources/memory/client/Client.ts +++ b/src/api/resources/memory/client/Client.ts @@ -48,7 +48,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -135,7 +135,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -227,7 +227,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -336,7 +336,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -430,7 +430,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -536,7 +536,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -615,7 +615,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -711,7 +711,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -827,7 +827,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -921,7 +921,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1028,7 +1028,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1137,7 +1137,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1203,6 +1203,99 @@ export class Memory { } } + /** + * Adds facts to a session + * + * @param {string} sessionId - Session ID + * @param {Zep.AddFactsRequest} request + * @param {Memory.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.NotFoundError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.memory.addSessionFacts("sessionId") + */ + public async addSessionFacts( + sessionId: string, + request: Zep.AddFactsRequest = {}, + requestOptions?: Memory.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `sessions/${encodeURIComponent(sessionId)}/facts` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "zep-cloud", + "X-Fern-SDK-Version": "1.0.10", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.AddFactsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.SuccessResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Zep.NotFoundError( + await serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Zep.InternalServerError( + await serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.ZepError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.ZepError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.ZepTimeoutError(); + case "unknown": + throw new errors.ZepError({ + message: _response.error.errorMessage, + }); + } + } + /** * Returns a memory (latest summary, list of messages and facts for models.MemoryTypePerpetual) for a given session * @@ -1244,7 +1337,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1338,7 +1431,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1416,7 +1509,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1518,7 +1611,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1611,7 +1704,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1707,7 +1800,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1808,7 +1901,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1900,7 +1993,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1998,7 +2091,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), diff --git a/src/api/resources/memory/client/requests/AddFactsRequest.ts b/src/api/resources/memory/client/requests/AddFactsRequest.ts new file mode 100644 index 0000000..f8bae62 --- /dev/null +++ b/src/api/resources/memory/client/requests/AddFactsRequest.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface AddFactsRequest { + facts?: string[]; +} diff --git a/src/api/resources/memory/client/requests/index.ts b/src/api/resources/memory/client/requests/index.ts index 53cb50f..f52ac61 100644 --- a/src/api/resources/memory/client/requests/index.ts +++ b/src/api/resources/memory/client/requests/index.ts @@ -6,6 +6,7 @@ export { type UpdateSessionRequest } from "./UpdateSessionRequest"; export { type EndSessionRequest } from "./EndSessionRequest"; export { type ExtractDataRequest } from "./ExtractDataRequest"; export { type MemoryGetSessionFactsRequest } from "./MemoryGetSessionFactsRequest"; +export { type AddFactsRequest } from "./AddFactsRequest"; export { type MemoryGetRequest } from "./MemoryGetRequest"; export { type AddMemoryRequest } from "./AddMemoryRequest"; export { type MemoryGetSessionMessagesRequest } from "./MemoryGetSessionMessagesRequest"; diff --git a/src/api/resources/user/client/Client.ts b/src/api/resources/user/client/Client.ts index f5c67bb..e88361c 100644 --- a/src/api/resources/user/client/Client.ts +++ b/src/api/resources/user/client/Client.ts @@ -48,7 +48,7 @@ export class User { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -149,7 +149,7 @@ export class User { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -237,7 +237,7 @@ export class User { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -324,7 +324,7 @@ export class User { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -417,7 +417,7 @@ export class User { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -514,7 +514,7 @@ export class User { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), diff --git a/src/serialization/resources/memory/client/requests/AddFactsRequest.ts b/src/serialization/resources/memory/client/requests/AddFactsRequest.ts new file mode 100644 index 0000000..9c638d2 --- /dev/null +++ b/src/serialization/resources/memory/client/requests/AddFactsRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Zep from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const AddFactsRequest: core.serialization.Schema = + core.serialization.object({ + facts: core.serialization.list(core.serialization.string()).optional(), + }); + +export declare namespace AddFactsRequest { + interface Raw { + facts?: string[] | null; + } +} diff --git a/src/serialization/resources/memory/client/requests/index.ts b/src/serialization/resources/memory/client/requests/index.ts index 50e4826..004608b 100644 --- a/src/serialization/resources/memory/client/requests/index.ts +++ b/src/serialization/resources/memory/client/requests/index.ts @@ -4,6 +4,7 @@ export { SessionSearchQuery } from "./SessionSearchQuery"; export { UpdateSessionRequest } from "./UpdateSessionRequest"; export { EndSessionRequest } from "./EndSessionRequest"; export { ExtractDataRequest } from "./ExtractDataRequest"; +export { AddFactsRequest } from "./AddFactsRequest"; export { AddMemoryRequest } from "./AddMemoryRequest"; export { ModelsMessageMetadataUpdate } from "./ModelsMessageMetadataUpdate"; export { MemorySearchPayload } from "./MemorySearchPayload";