From 492695824b6723ea416e23d94161ede109821c1c Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:11:49 +0000 Subject: [PATCH] SDK regeneration --- src/Client.ts | 14 + src/api/resources/document/client/Client.ts | 54 ++- src/api/resources/graph/client/Client.ts | 236 +++++++++++ src/api/resources/graph/client/index.ts | 1 + .../graph/client/requests/AddDataRequest.ts | 16 + .../graph/client/requests/GraphSearchQuery.ts | 30 ++ .../resources/graph/client/requests/index.ts | 2 + src/api/resources/graph/index.ts | 2 + .../graph/resources/edge/client/Client.ts | 392 ++++++++++++++++++ .../graph/resources/edge/client/index.ts | 1 + .../resources/graph/resources/edge/index.ts | 1 + .../graph/resources/episode/client/Client.ts | 318 ++++++++++++++ .../graph/resources/episode/client/index.ts | 1 + .../requests/EpisodeGetByGroupIdRequest.ts | 14 + .../requests/EpisodeGetByUserIdRequest.ts | 14 + .../episode/client/requests/index.ts | 2 + .../graph/resources/episode/index.ts | 1 + src/api/resources/graph/resources/index.ts | 4 + .../graph/resources/node/client/Client.ts | 305 ++++++++++++++ .../graph/resources/node/client/index.ts | 1 + .../resources/graph/resources/node/index.ts | 1 + src/api/resources/group/client/Client.ts | 225 ++++++++++ src/api/resources/group/client/index.ts | 1 + .../client/requests/CreateGroupRequest.ts | 14 + .../client/requests/UpdateGroupRequest.ts | 12 + .../resources/group/client/requests/index.ts | 2 + src/api/resources/group/index.ts | 1 + src/api/resources/index.ts | 4 + src/api/resources/memory/client/Client.ts | 78 ++-- .../memory/client/requests/AddFactsRequest.ts | 2 +- ...yRequest.ts => ApidataAddMemoryRequest.ts} | 6 +- .../client/requests/MemoryGetRequest.ts | 6 - .../requests/MemoryGetSessionFactsRequest.ts | 2 +- .../requests/ModelsMessageMetadataUpdate.ts | 4 +- .../client/requests/SessionSearchQuery.ts | 9 +- .../client/requests/UpdateSessionRequest.ts | 4 +- .../resources/memory/client/requests/index.ts | 2 +- src/api/resources/user/client/Client.ts | 101 ++++- ...DocumentResponse.ts => ApidataDocument.ts} | 2 +- ...sponse.ts => ApidataDocumentCollection.ts} | 4 +- ...ge.ts => ApidataDocumentSearchResponse.ts} | 4 +- ...hResult.ts => ApidataDocumentWithScore.ts} | 2 +- src/api/types/EndSessionResponse.ts | 2 +- src/api/types/EntityEdge.ts | 26 ++ src/api/types/EntityNode.ts | 16 + src/api/types/Episode.ts | 14 + src/api/types/EpisodeResponse.ts | 9 + src/api/types/EpisodeType.ts | 11 + src/api/types/Fact.ts | 3 + src/api/types/GraphSearchResults.ts | 10 + src/api/types/GraphSearchScope.ts | 10 + src/api/types/Group.ts | 13 + src/api/types/Memory.ts | 9 +- src/api/types/MemoryType.ts | 11 - src/api/types/ModelsGraphDataType.ts | 11 + src/api/types/{AddedFact.ts => NewFact.ts} | 2 +- src/api/types/Reranker.ts | 12 + src/api/types/Session.ts | 3 +- ...onResponse.ts => SessionClassification.ts} | 4 +- src/api/types/SessionFactRatingExamples.ts | 9 + src/api/types/SessionFactRatingInstruction.ts | 23 + src/api/types/index.ts | 39 +- .../resources/document/client/addDocuments.ts | 6 +- .../document/client/batchGetDocuments.ts | 8 +- .../document/client/listCollections.ts | 8 +- .../resources/graph/client/index.ts | 1 + .../graph/client/requests/AddDataRequest.ts | 25 ++ .../graph/client/requests/GraphSearchQuery.ts | 36 ++ .../resources/graph/client/requests/index.ts | 2 + src/serialization/resources/graph/index.ts | 2 + .../resources/edge/client/getByGroupId.ts | 15 + .../resources/edge/client/getByUserId.ts | 15 + .../graph/resources/edge/client/index.ts | 2 + .../resources/graph/resources/edge/index.ts | 1 + .../resources/graph/resources/index.ts | 2 + .../resources/node/client/getByGroupId.ts | 15 + .../resources/node/client/getByUserId.ts | 15 + .../graph/resources/node/client/index.ts | 2 + .../resources/graph/resources/node/index.ts | 1 + .../resources/group/client/index.ts | 1 + .../client/requests/CreateGroupRequest.ts | 27 ++ .../client/requests/UpdateGroupRequest.ts | 20 + .../resources/group/client/requests/index.ts | 2 + src/serialization/resources/group/index.ts | 1 + src/serialization/resources/index.ts | 4 + .../memory/client/requests/AddFactsRequest.ts | 6 +- .../client/requests/AddMemoryRequest.ts | 23 - .../requests/ApidataAddMemoryRequest.ts | 25 ++ .../resources/memory/client/requests/index.ts | 2 +- .../resources/user/client/getSessions.ts | 6 +- ...DocumentResponse.ts => ApidataDocument.ts} | 4 +- ...sponse.ts => ApidataDocumentCollection.ts} | 8 +- ...ge.ts => ApidataDocumentSearchResponse.ts} | 14 +- ...hResult.ts => ApidataDocumentWithScore.ts} | 8 +- src/serialization/types/EndSessionResponse.ts | 6 +- src/serialization/types/EntityEdge.ts | 36 ++ src/serialization/types/EntityNode.ts | 26 ++ src/serialization/types/Episode.ts | 30 ++ src/serialization/types/EpisodeResponse.ts | 19 + src/serialization/types/EpisodeType.ts | 14 + src/serialization/types/Fact.ts | 6 + src/serialization/types/GraphSearchResults.ts | 24 ++ src/serialization/types/GraphSearchScope.ts | 14 + src/serialization/types/Group.ts | 29 ++ src/serialization/types/Memory.ts | 2 - src/serialization/types/MemoryType.ts | 14 - .../types/ModelsGraphDataType.ts | 16 + .../types/{AddedFact.ts => NewFact.ts} | 9 +- src/serialization/types/Reranker.ts | 18 + src/serialization/types/Session.ts | 11 +- ...onResponse.ts => SessionClassification.ts} | 12 +- .../types/SessionFactRatingExamples.ts | 24 ++ .../types/SessionFactRatingInstruction.ts | 23 + src/serialization/types/index.ts | 39 +- 114 files changed, 2573 insertions(+), 238 deletions(-) create mode 100644 src/api/resources/graph/client/Client.ts create mode 100644 src/api/resources/graph/client/index.ts create mode 100644 src/api/resources/graph/client/requests/AddDataRequest.ts create mode 100644 src/api/resources/graph/client/requests/GraphSearchQuery.ts create mode 100644 src/api/resources/graph/client/requests/index.ts create mode 100644 src/api/resources/graph/index.ts create mode 100644 src/api/resources/graph/resources/edge/client/Client.ts create mode 100644 src/api/resources/graph/resources/edge/client/index.ts create mode 100644 src/api/resources/graph/resources/edge/index.ts create mode 100644 src/api/resources/graph/resources/episode/client/Client.ts create mode 100644 src/api/resources/graph/resources/episode/client/index.ts create mode 100644 src/api/resources/graph/resources/episode/client/requests/EpisodeGetByGroupIdRequest.ts create mode 100644 src/api/resources/graph/resources/episode/client/requests/EpisodeGetByUserIdRequest.ts create mode 100644 src/api/resources/graph/resources/episode/client/requests/index.ts create mode 100644 src/api/resources/graph/resources/episode/index.ts create mode 100644 src/api/resources/graph/resources/index.ts create mode 100644 src/api/resources/graph/resources/node/client/Client.ts create mode 100644 src/api/resources/graph/resources/node/client/index.ts create mode 100644 src/api/resources/graph/resources/node/index.ts create mode 100644 src/api/resources/group/client/Client.ts create mode 100644 src/api/resources/group/client/index.ts create mode 100644 src/api/resources/group/client/requests/CreateGroupRequest.ts create mode 100644 src/api/resources/group/client/requests/UpdateGroupRequest.ts create mode 100644 src/api/resources/group/client/requests/index.ts create mode 100644 src/api/resources/group/index.ts rename src/api/resources/memory/client/requests/{AddMemoryRequest.ts => ApidataAddMemoryRequest.ts} (56%) rename src/api/types/{DocumentResponse.ts => ApidataDocument.ts} (88%) rename src/api/types/{DocumentCollectionResponse.ts => ApidataDocumentCollection.ts} (75%) rename src/api/types/{DocumentSearchResultPage.ts => ApidataDocumentSearchResponse.ts} (69%) rename src/api/types/{DocumentSearchResult.ts => ApidataDocumentWithScore.ts} (87%) create mode 100644 src/api/types/EntityEdge.ts create mode 100644 src/api/types/EntityNode.ts create mode 100644 src/api/types/Episode.ts create mode 100644 src/api/types/EpisodeResponse.ts create mode 100644 src/api/types/EpisodeType.ts create mode 100644 src/api/types/GraphSearchResults.ts create mode 100644 src/api/types/GraphSearchScope.ts create mode 100644 src/api/types/Group.ts delete mode 100644 src/api/types/MemoryType.ts create mode 100644 src/api/types/ModelsGraphDataType.ts rename src/api/types/{AddedFact.ts => NewFact.ts} (76%) create mode 100644 src/api/types/Reranker.ts rename src/api/types/{ClassifySessionResponse.ts => SessionClassification.ts} (60%) create mode 100644 src/api/types/SessionFactRatingExamples.ts create mode 100644 src/api/types/SessionFactRatingInstruction.ts create mode 100644 src/serialization/resources/graph/client/index.ts create mode 100644 src/serialization/resources/graph/client/requests/AddDataRequest.ts create mode 100644 src/serialization/resources/graph/client/requests/GraphSearchQuery.ts create mode 100644 src/serialization/resources/graph/client/requests/index.ts create mode 100644 src/serialization/resources/graph/index.ts create mode 100644 src/serialization/resources/graph/resources/edge/client/getByGroupId.ts create mode 100644 src/serialization/resources/graph/resources/edge/client/getByUserId.ts create mode 100644 src/serialization/resources/graph/resources/edge/client/index.ts create mode 100644 src/serialization/resources/graph/resources/edge/index.ts create mode 100644 src/serialization/resources/graph/resources/index.ts create mode 100644 src/serialization/resources/graph/resources/node/client/getByGroupId.ts create mode 100644 src/serialization/resources/graph/resources/node/client/getByUserId.ts create mode 100644 src/serialization/resources/graph/resources/node/client/index.ts create mode 100644 src/serialization/resources/graph/resources/node/index.ts create mode 100644 src/serialization/resources/group/client/index.ts create mode 100644 src/serialization/resources/group/client/requests/CreateGroupRequest.ts create mode 100644 src/serialization/resources/group/client/requests/UpdateGroupRequest.ts create mode 100644 src/serialization/resources/group/client/requests/index.ts create mode 100644 src/serialization/resources/group/index.ts delete mode 100644 src/serialization/resources/memory/client/requests/AddMemoryRequest.ts create mode 100644 src/serialization/resources/memory/client/requests/ApidataAddMemoryRequest.ts rename src/serialization/types/{DocumentResponse.ts => ApidataDocument.ts} (88%) rename src/serialization/types/{DocumentCollectionResponse.ts => ApidataDocumentCollection.ts} (90%) rename src/serialization/types/{DocumentSearchResultPage.ts => ApidataDocumentSearchResponse.ts} (66%) rename src/serialization/types/{DocumentSearchResult.ts => ApidataDocumentWithScore.ts} (86%) create mode 100644 src/serialization/types/EntityEdge.ts create mode 100644 src/serialization/types/EntityNode.ts create mode 100644 src/serialization/types/Episode.ts create mode 100644 src/serialization/types/EpisodeResponse.ts create mode 100644 src/serialization/types/EpisodeType.ts create mode 100644 src/serialization/types/GraphSearchResults.ts create mode 100644 src/serialization/types/GraphSearchScope.ts create mode 100644 src/serialization/types/Group.ts delete mode 100644 src/serialization/types/MemoryType.ts create mode 100644 src/serialization/types/ModelsGraphDataType.ts rename src/serialization/types/{AddedFact.ts => NewFact.ts} (63%) create mode 100644 src/serialization/types/Reranker.ts rename src/serialization/types/{ClassifySessionResponse.ts => SessionClassification.ts} (54%) create mode 100644 src/serialization/types/SessionFactRatingExamples.ts create mode 100644 src/serialization/types/SessionFactRatingInstruction.ts diff --git a/src/Client.ts b/src/Client.ts index 4eb829f..a2c45ce 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -6,6 +6,8 @@ import * as environments from "./environments"; import * as core from "./core"; import { Document } from "./api/resources/document/client/Client"; import { Memory } from "./api/resources/memory/client/Client"; +import { Graph } from "./api/resources/graph/client/Client"; +import { Group } from "./api/resources/group/client/Client"; import { User } from "./api/resources/user/client/Client"; export declare namespace ZepClient { @@ -37,6 +39,18 @@ export class ZepClient { return (this._memory ??= new Memory(this._options)); } + protected _graph: Graph | undefined; + + public get graph(): Graph { + return (this._graph ??= new Graph(this._options)); + } + + protected _group: Group | undefined; + + public get group(): Group { + return (this._group ??= new Group(this._options)); + } + protected _user: User | undefined; public get user(): User { diff --git a/src/api/resources/document/client/Client.ts b/src/api/resources/document/client/Client.ts index e46d9e1..c428fba 100644 --- a/src/api/resources/document/client/Client.ts +++ b/src/api/resources/document/client/Client.ts @@ -37,9 +37,7 @@ export class Document { * @example * await zep.document.listCollections() */ - public async listCollections( - requestOptions?: Document.RequestOptions - ): Promise { + public async listCollections(requestOptions?: Document.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, @@ -49,7 +47,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -131,7 +129,7 @@ export class Document { public async getCollection( collectionName: string, requestOptions?: Document.RequestOptions - ): Promise { + ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, @@ -141,7 +139,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -152,7 +150,7 @@ export class Document { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.DocumentCollectionResponse.parseOrThrow(_response.body, { + return await serializers.ApidataDocumentCollection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -255,7 +253,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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 +368,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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 +482,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -592,7 +590,7 @@ export class Document { collectionName: string, request: Zep.CreateDocumentRequest[], requestOptions?: Document.RequestOptions - ): Promise { + ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, @@ -602,7 +600,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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 +706,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -804,7 +802,7 @@ export class Document { collectionName: string, request: Zep.GetDocumentListRequest = {}, requestOptions?: Document.RequestOptions - ): Promise { + ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, @@ -814,7 +812,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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 +918,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1010,13 +1008,13 @@ export class Document { * @throws {@link Zep.InternalServerError} * * @example - * await zep.document.getsADocumentFromADocumentCollectionByUuid("collectionName", "documentUUID") + * await zep.document.getsADocumentFromADocumentCollectionByUuidCloudOnly("collectionName", "documentUUID") */ - public async getsADocumentFromADocumentCollectionByUuid( + public async getsADocumentFromADocumentCollectionByUuidCloudOnly( collectionName: string, documentUuid: string, requestOptions?: Document.RequestOptions - ): Promise { + ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, @@ -1026,7 +1024,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1037,7 +1035,7 @@ export class Document { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.DocumentResponse.parseOrThrow(_response.body, { + return await serializers.ApidataDocument.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -1130,7 +1128,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1229,9 +1227,9 @@ export class Document { * @throws {@link Zep.InternalServerError} * * @example - * await zep.document.updatesADocument("collectionName", "documentUUID") + * await zep.document.updatesADocumentCloudOnly("collectionName", "documentUUID") */ - public async updatesADocument( + public async updatesADocumentCloudOnly( collectionName: string, documentUuid: string, request: Zep.UpdateDocumentRequest = {}, @@ -1246,7 +1244,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1350,7 +1348,7 @@ export class Document { collectionName: string, request: Zep.DocumentSearchPayload = {}, requestOptions?: Document.RequestOptions - ): Promise { + ): Promise { const { limit, ..._body } = request; const _queryParams: Record = {}; if (limit != null) { @@ -1366,7 +1364,7 @@ export class Document { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1379,7 +1377,7 @@ export class Document { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.DocumentSearchResultPage.parseOrThrow(_response.body, { + return await serializers.ApidataDocumentSearchResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/graph/client/Client.ts b/src/api/resources/graph/client/Client.ts new file mode 100644 index 0000000..0b9768f --- /dev/null +++ b/src/api/resources/graph/client/Client.ts @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Zep from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; +import { Edge } from "../resources/edge/client/Client"; +import { Episode } from "../resources/episode/client/Client"; +import { Node } from "../resources/node/client/Client"; + +export declare namespace Graph { + interface Options { + environment?: core.Supplier; + apiKey?: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class Graph { + constructor(protected readonly _options: Graph.Options = {}) {} + + /** + * Add data to the graph + * + * @param {Zep.AddDataRequest} request + * @param {Graph.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.add() + */ + public async add( + request: Zep.AddDataRequest = {}, + requestOptions?: Graph.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + "graph" + ), + 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.AddDataRequest.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 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + /** + * Perform a graph search query + * + * @param {Zep.GraphSearchQuery} request + * @param {Graph.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.search() + */ + public async search( + request: Zep.GraphSearchQuery = {}, + requestOptions?: Graph.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + "graph/search" + ), + 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.GraphSearchQuery.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.GraphSearchResults.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + protected _edge: Edge | undefined; + + public get edge(): Edge { + return (this._edge ??= new Edge(this._options)); + } + + protected _episode: Episode | undefined; + + public get episode(): Episode { + return (this._episode ??= new Episode(this._options)); + } + + protected _node: Node | undefined; + + public get node(): Node { + return (this._node ??= new Node(this._options)); + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["ZEP_API_KEY"]; + return { Authorization: `Api-Key ${apiKeyValue}` }; + } +} diff --git a/src/api/resources/graph/client/index.ts b/src/api/resources/graph/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/graph/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/graph/client/requests/AddDataRequest.ts b/src/api/resources/graph/client/requests/AddDataRequest.ts new file mode 100644 index 0000000..ce4b2ca --- /dev/null +++ b/src/api/resources/graph/client/requests/AddDataRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Zep from "../../../../index"; + +/** + * @example + * {} + */ +export interface AddDataRequest { + data?: string; + groupId?: string; + type?: Zep.ModelsGraphDataType; + userId?: string; +} diff --git a/src/api/resources/graph/client/requests/GraphSearchQuery.ts b/src/api/resources/graph/client/requests/GraphSearchQuery.ts new file mode 100644 index 0000000..595dab9 --- /dev/null +++ b/src/api/resources/graph/client/requests/GraphSearchQuery.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Zep from "../../../../index"; + +/** + * @example + * {} + */ +export interface GraphSearchQuery { + /** Node to rerank around for node distance reranking */ + centerNodeUuid?: string; + /** one of user_id or group_id must be provided */ + groupId?: string; + /** The maximum number of facts to retrieve */ + limit?: number; + /** minimum similarity score for a result to be returned */ + minScore?: number; + /** weighting for maximal marginal relevance */ + mmrLambda?: number; + /** The string to search for (required) */ + query?: string; + /** Defaults to RRF */ + reranker?: Zep.Reranker; + /** Defaults to Edges. Nodes and Communities will be added in the future. */ + scope?: Zep.GraphSearchScope; + /** one of user_id or group_id must be provided */ + userId?: string; +} diff --git a/src/api/resources/graph/client/requests/index.ts b/src/api/resources/graph/client/requests/index.ts new file mode 100644 index 0000000..5d9e4e4 --- /dev/null +++ b/src/api/resources/graph/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type AddDataRequest } from "./AddDataRequest"; +export { type GraphSearchQuery } from "./GraphSearchQuery"; diff --git a/src/api/resources/graph/index.ts b/src/api/resources/graph/index.ts new file mode 100644 index 0000000..33a87f1 --- /dev/null +++ b/src/api/resources/graph/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/graph/resources/edge/client/Client.ts b/src/api/resources/graph/resources/edge/client/Client.ts new file mode 100644 index 0000000..10cec23 --- /dev/null +++ b/src/api/resources/graph/resources/edge/client/Client.ts @@ -0,0 +1,392 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Zep from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Edge { + interface Options { + environment?: core.Supplier; + apiKey?: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class Edge { + constructor(protected readonly _options: Edge.Options = {}) {} + + /** + * Get all edges for a group + * + * @param {string} groupId - Group ID + * @param {Edge.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.edge.getByGroupId("group_id") + */ + public async getByGroupId(groupId: string, requestOptions?: Edge.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `graph/edge/group/${encodeURIComponent(groupId)}` + ), + method: "GET", + 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", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.graph.edge.getByGroupId.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + /** + * Get all edges for a user + * + * @param {string} userId - User ID + * @param {Edge.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.edge.getByUserId("user_id") + */ + public async getByUserId(userId: string, requestOptions?: Edge.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `graph/edge/user/${encodeURIComponent(userId)}` + ), + method: "GET", + 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", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.graph.edge.getByUserId.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + /** + * Get a specific edge by its UUID + * + * @param {string} uuid - Edge UUID + * @param {Edge.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.NotFoundError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.edge.get("uuid") + */ + public async get(uuid: string, requestOptions?: Edge.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `graph/edge/${encodeURIComponent(uuid)}` + ), + method: "GET", + 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", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EntityEdge.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + await serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + 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, + }); + } + } + + /** + * Delete an edge by UUID + * + * @param {string} uuid - Edge UUID + * @param {Edge.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.edge.delete("uuid") + */ + public async delete(uuid: string, requestOptions?: Edge.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `graph/edge/${encodeURIComponent(uuid)}` + ), + method: "DELETE", + 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", + 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 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["ZEP_API_KEY"]; + return { Authorization: `Api-Key ${apiKeyValue}` }; + } +} diff --git a/src/api/resources/graph/resources/edge/client/index.ts b/src/api/resources/graph/resources/edge/client/index.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/src/api/resources/graph/resources/edge/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/graph/resources/edge/index.ts b/src/api/resources/graph/resources/edge/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/graph/resources/edge/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/graph/resources/episode/client/Client.ts b/src/api/resources/graph/resources/episode/client/Client.ts new file mode 100644 index 0000000..088a1f8 --- /dev/null +++ b/src/api/resources/graph/resources/episode/client/Client.ts @@ -0,0 +1,318 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Zep from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Episode { + interface Options { + environment?: core.Supplier; + apiKey?: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class Episode { + constructor(protected readonly _options: Episode.Options = {}) {} + + /** + * Get episodes by Group ID + * + * @param {string} groupId - Group ID + * @param {Zep.graph.EpisodeGetByGroupIdRequest} request + * @param {Episode.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.episode.getByGroupId("group_id") + */ + public async getByGroupId( + groupId: string, + request: Zep.graph.EpisodeGetByGroupIdRequest = {}, + requestOptions?: Episode.RequestOptions + ): Promise { + const { lastn } = request; + const _queryParams: Record = {}; + if (lastn != null) { + _queryParams["lastn"] = lastn.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `graph/episodes/group/${encodeURIComponent(groupId)}` + ), + method: "GET", + 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", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EpisodeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + /** + * Get episodes by User ID + * + * @param {string} userId - User ID + * @param {Zep.graph.EpisodeGetByUserIdRequest} request + * @param {Episode.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.episode.getByUserId("user_id") + */ + public async getByUserId( + userId: string, + request: Zep.graph.EpisodeGetByUserIdRequest = {}, + requestOptions?: Episode.RequestOptions + ): Promise { + const { lastn } = request; + const _queryParams: Record = {}; + if (lastn != null) { + _queryParams["lastn"] = lastn.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `graph/episodes/user/${encodeURIComponent(userId)}` + ), + method: "GET", + 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", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EpisodeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + /** + * Get episode by UUID + * + * @param {string} uuid - Episode UUID + * @param {Episode.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.episode.get("uuid") + */ + public async get(uuid: string, requestOptions?: Episode.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `graph/episodes/${encodeURIComponent(uuid)}` + ), + method: "GET", + 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", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EpisodeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["ZEP_API_KEY"]; + return { Authorization: `Api-Key ${apiKeyValue}` }; + } +} diff --git a/src/api/resources/graph/resources/episode/client/index.ts b/src/api/resources/graph/resources/episode/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/graph/resources/episode/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/graph/resources/episode/client/requests/EpisodeGetByGroupIdRequest.ts b/src/api/resources/graph/resources/episode/client/requests/EpisodeGetByGroupIdRequest.ts new file mode 100644 index 0000000..f9b902f --- /dev/null +++ b/src/api/resources/graph/resources/episode/client/requests/EpisodeGetByGroupIdRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface EpisodeGetByGroupIdRequest { + /** + * The number of most recent episodes to retrieve. + */ + lastn?: number; +} diff --git a/src/api/resources/graph/resources/episode/client/requests/EpisodeGetByUserIdRequest.ts b/src/api/resources/graph/resources/episode/client/requests/EpisodeGetByUserIdRequest.ts new file mode 100644 index 0000000..8b9290a --- /dev/null +++ b/src/api/resources/graph/resources/episode/client/requests/EpisodeGetByUserIdRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface EpisodeGetByUserIdRequest { + /** + * The number of most recent episodes entries to retrieve. + */ + lastn?: number; +} diff --git a/src/api/resources/graph/resources/episode/client/requests/index.ts b/src/api/resources/graph/resources/episode/client/requests/index.ts new file mode 100644 index 0000000..6131e28 --- /dev/null +++ b/src/api/resources/graph/resources/episode/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type EpisodeGetByGroupIdRequest } from "./EpisodeGetByGroupIdRequest"; +export { type EpisodeGetByUserIdRequest } from "./EpisodeGetByUserIdRequest"; diff --git a/src/api/resources/graph/resources/episode/index.ts b/src/api/resources/graph/resources/episode/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/graph/resources/episode/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/graph/resources/index.ts b/src/api/resources/graph/resources/index.ts new file mode 100644 index 0000000..820c97e --- /dev/null +++ b/src/api/resources/graph/resources/index.ts @@ -0,0 +1,4 @@ +export * as edge from "./edge"; +export * as episode from "./episode"; +export * as node from "./node"; +export * from "./episode/client/requests"; diff --git a/src/api/resources/graph/resources/node/client/Client.ts b/src/api/resources/graph/resources/node/client/Client.ts new file mode 100644 index 0000000..f4ce124 --- /dev/null +++ b/src/api/resources/graph/resources/node/client/Client.ts @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Zep from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Node { + interface Options { + environment?: core.Supplier; + apiKey?: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class Node { + constructor(protected readonly _options: Node.Options = {}) {} + + /** + * Get all nodes for a group + * + * @param {string} groupId - Group ID + * @param {Node.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.node.getByGroupId("group_id") + */ + public async getByGroupId(groupId: string, requestOptions?: Node.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `graph/node/group/${encodeURIComponent(groupId)}` + ), + method: "GET", + 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", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.graph.node.getByGroupId.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + /** + * Get all nodes for a user + * + * @param {string} userId - User ID + * @param {Node.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.node.getByUserId("user_id") + */ + public async getByUserId(userId: string, requestOptions?: Node.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `graph/node/user/${encodeURIComponent(userId)}` + ), + method: "GET", + 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", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.graph.node.getByUserId.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + /** + * Get a specific node by its UUID + * + * @param {string} uuid - Node UUID + * @param {Node.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.NotFoundError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.graph.node.get("uuid") + */ + public async get(uuid: string, requestOptions?: Node.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `graph/node/${encodeURIComponent(uuid)}` + ), + method: "GET", + 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", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EntityNode.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + await serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + 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, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["ZEP_API_KEY"]; + return { Authorization: `Api-Key ${apiKeyValue}` }; + } +} diff --git a/src/api/resources/graph/resources/node/client/index.ts b/src/api/resources/graph/resources/node/client/index.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/src/api/resources/graph/resources/node/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/graph/resources/node/index.ts b/src/api/resources/graph/resources/node/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/graph/resources/node/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/group/client/Client.ts b/src/api/resources/group/client/Client.ts new file mode 100644 index 0000000..b432196 --- /dev/null +++ b/src/api/resources/group/client/Client.ts @@ -0,0 +1,225 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Zep from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Group { + interface Options { + environment?: core.Supplier; + apiKey?: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class Group { + constructor(protected readonly _options: Group.Options = {}) {} + + /** + * Create a new user group + * + * @param {Zep.CreateGroupRequest} request + * @param {Group.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.group.add() + */ + public async add(request: Zep.CreateGroupRequest = {}, requestOptions?: Group.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + "groups" + ), + 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.CreateGroupRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.Group.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + 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, + }); + } + } + + /** + * Update group information + * + * @param {string} groupId - Group ID + * @param {Zep.UpdateGroupRequest} request + * @param {Group.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.BadRequestError} + * @throws {@link Zep.NotFoundError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.group.update("groupId") + */ + public async update( + groupId: string, + request: Zep.UpdateGroupRequest = {}, + requestOptions?: Group.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `groups/${encodeURIComponent(groupId)}` + ), + method: "PATCH", + 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.UpdateGroupRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.Group.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Zep.BadRequestError( + await serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + 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, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["ZEP_API_KEY"]; + return { Authorization: `Api-Key ${apiKeyValue}` }; + } +} diff --git a/src/api/resources/group/client/index.ts b/src/api/resources/group/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/group/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/group/client/requests/CreateGroupRequest.ts b/src/api/resources/group/client/requests/CreateGroupRequest.ts new file mode 100644 index 0000000..1e0f56b --- /dev/null +++ b/src/api/resources/group/client/requests/CreateGroupRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface CreateGroupRequest { + description?: string; + groupId?: string; + name?: string; + userIds?: string[]; +} diff --git a/src/api/resources/group/client/requests/UpdateGroupRequest.ts b/src/api/resources/group/client/requests/UpdateGroupRequest.ts new file mode 100644 index 0000000..8b101b0 --- /dev/null +++ b/src/api/resources/group/client/requests/UpdateGroupRequest.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface UpdateGroupRequest { + description?: string; + name?: string; +} diff --git a/src/api/resources/group/client/requests/index.ts b/src/api/resources/group/client/requests/index.ts new file mode 100644 index 0000000..431fdb1 --- /dev/null +++ b/src/api/resources/group/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type CreateGroupRequest } from "./CreateGroupRequest"; +export { type UpdateGroupRequest } from "./UpdateGroupRequest"; diff --git a/src/api/resources/group/index.ts b/src/api/resources/group/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/group/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index cc425b4..472ba25 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,6 +1,10 @@ export * as document from "./document"; export * as memory from "./memory"; +export * as graph from "./graph"; +export * as group from "./group"; export * as user from "./user"; export * from "./document/client/requests"; export * from "./memory/client/requests"; +export * from "./graph/client/requests"; +export * from "./group/client/requests"; export * from "./user/client/requests"; diff --git a/src/api/resources/memory/client/Client.ts b/src/api/resources/memory/client/Client.ts index 6593ca3..b1af70f 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.11", + "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.11", + "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.11", + "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.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -403,7 +403,7 @@ export class Memory { } /** - * End multiple sessions by their IDs + * End multiple sessions by their IDs. * * @param {Zep.EndSessionsRequest} request * @param {Memory.RequestOptions} requestOptions - Request-specific configuration. @@ -430,7 +430,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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.11", + "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.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -694,7 +694,9 @@ export class Memory { * * @example * await zep.memory.updateSession("sessionId", { - * metadata: {} + * metadata: { + * "key": "value" + * } * }) */ public async updateSession( @@ -711,7 +713,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -798,7 +800,7 @@ export class Memory { } /** - * classify a session by session id + * classify a session by session id. * * @param {string} sessionId - Session ID * @param {Zep.ClassifySessionRequest} request @@ -817,7 +819,7 @@ export class Memory { sessionId: string, request: Zep.ClassifySessionRequest, requestOptions?: Memory.RequestOptions - ): Promise { + ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, @@ -827,7 +829,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -839,7 +841,7 @@ export class Memory { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ClassifySessionResponse.parseOrThrow(_response.body, { + return await serializers.SessionClassification.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -894,7 +896,7 @@ export class Memory { } /** - * End a session by ID + * End a session by ID. * * @param {string} sessionId - Session ID * @param {Zep.EndSessionRequest} request @@ -921,7 +923,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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 +1030,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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 +1139,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1230,7 +1232,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1297,7 +1299,7 @@ export class Memory { } /** - * Returns a memory (latest summary, list of messages and facts for models.MemoryTypePerpetual) for a given session + * Returns a memory (latest summary, list of messages and facts) for a given session * * @param {string} sessionId - The ID of the session for which to retrieve memory. * @param {Zep.MemoryGetRequest} request @@ -1314,12 +1316,8 @@ export class Memory { request: Zep.MemoryGetRequest = {}, requestOptions?: Memory.RequestOptions ): Promise { - const { memoryType, lastn, minRating } = request; + const { lastn, minRating } = request; const _queryParams: Record = {}; - if (memoryType != null) { - _queryParams["memoryType"] = memoryType; - } - if (lastn != null) { _queryParams["lastn"] = lastn.toString(); } @@ -1337,7 +1335,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1407,7 +1405,7 @@ export class Memory { * Add memory to the specified session. * * @param {string} sessionId - The ID of the session to which memory should be added. - * @param {Zep.AddMemoryRequest} request + * @param {Zep.ApidataAddMemoryRequest} request * @param {Memory.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Zep.InternalServerError} @@ -1419,7 +1417,7 @@ export class Memory { */ public async add( sessionId: string, - request: Zep.AddMemoryRequest, + request: Zep.ApidataAddMemoryRequest, requestOptions?: Memory.RequestOptions ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -1431,13 +1429,13 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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.AddMemoryRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + body: await serializers.ApidataAddMemoryRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1509,7 +1507,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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 +1609,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1704,7 +1702,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1782,7 +1780,9 @@ export class Memory { * * @example * await zep.memory.updateMessageMetadata("sessionId", "messageUUID", { - * metadata: {} + * metadata: { + * "key": "value" + * } * }) */ public async updateMessageMetadata( @@ -1800,7 +1800,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1869,7 +1869,7 @@ export class Memory { } /** - * Search memory for the specified session. + * Search memory for the specified session. Deprecated, please use search_sessions method instead * * @param {string} sessionId - The ID of the session for which memory should be searched. * @param {Zep.MemorySearchPayload} request @@ -1901,7 +1901,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -1993,7 +1993,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -2091,7 +2091,7 @@ export class Memory { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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 index 50a0ac6..811898b 100644 --- a/src/api/resources/memory/client/requests/AddFactsRequest.ts +++ b/src/api/resources/memory/client/requests/AddFactsRequest.ts @@ -9,5 +9,5 @@ import * as Zep from "../../../../index"; * {} */ export interface AddFactsRequest { - facts?: Zep.AddedFact[]; + facts?: Zep.NewFact[]; } diff --git a/src/api/resources/memory/client/requests/AddMemoryRequest.ts b/src/api/resources/memory/client/requests/ApidataAddMemoryRequest.ts similarity index 56% rename from src/api/resources/memory/client/requests/AddMemoryRequest.ts rename to src/api/resources/memory/client/requests/ApidataAddMemoryRequest.ts index f05e9f2..4c896ae 100644 --- a/src/api/resources/memory/client/requests/AddMemoryRequest.ts +++ b/src/api/resources/memory/client/requests/ApidataAddMemoryRequest.ts @@ -10,11 +10,11 @@ import * as Zep from "../../../../index"; * messages: [{}] * } */ -export interface AddMemoryRequest { - /** Additional instruction for generating the facts. */ +export interface ApidataAddMemoryRequest { + /** Additional instruction for generating the facts. Zep Cloud Only, will be ignored on Community Edition. */ factInstruction?: string; /** A list of message objects, where each message contains a role and content. */ messages: Zep.Message[]; - /** Additional instruction for generating the summary. */ + /** Additional instruction for generating the summary. Zep Cloud Only, will be ignored on Community Edition. */ summaryInstruction?: string; } diff --git a/src/api/resources/memory/client/requests/MemoryGetRequest.ts b/src/api/resources/memory/client/requests/MemoryGetRequest.ts index d17edc0..6677bf5 100644 --- a/src/api/resources/memory/client/requests/MemoryGetRequest.ts +++ b/src/api/resources/memory/client/requests/MemoryGetRequest.ts @@ -2,17 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Zep from "../../../../index"; - /** * @example * {} */ export interface MemoryGetRequest { - /** - * The type of memory to retrieve: perpetual, summary_retriever, or message_window. Defaults to perpetual. - */ - memoryType?: Zep.MemoryType; /** * The number of most recent memory entries to retrieve. */ diff --git a/src/api/resources/memory/client/requests/MemoryGetSessionFactsRequest.ts b/src/api/resources/memory/client/requests/MemoryGetSessionFactsRequest.ts index 074b294..6d77c30 100644 --- a/src/api/resources/memory/client/requests/MemoryGetSessionFactsRequest.ts +++ b/src/api/resources/memory/client/requests/MemoryGetSessionFactsRequest.ts @@ -8,7 +8,7 @@ */ export interface MemoryGetSessionFactsRequest { /** - * Minimum rating by which to filter facts + * Minimum rating by which to filter facts (Zep Cloud only) */ minRating?: number; } diff --git a/src/api/resources/memory/client/requests/ModelsMessageMetadataUpdate.ts b/src/api/resources/memory/client/requests/ModelsMessageMetadataUpdate.ts index 4e0860d..3dd927f 100644 --- a/src/api/resources/memory/client/requests/ModelsMessageMetadataUpdate.ts +++ b/src/api/resources/memory/client/requests/ModelsMessageMetadataUpdate.ts @@ -5,7 +5,9 @@ /** * @example * { - * metadata: {} + * metadata: { + * "key": "value" + * } * } */ export interface ModelsMessageMetadataUpdate { diff --git a/src/api/resources/memory/client/requests/SessionSearchQuery.ts b/src/api/resources/memory/client/requests/SessionSearchQuery.ts index 1370be8..212c496 100644 --- a/src/api/resources/memory/client/requests/SessionSearchQuery.ts +++ b/src/api/resources/memory/client/requests/SessionSearchQuery.ts @@ -13,15 +13,22 @@ export interface SessionSearchQuery { * The maximum number of search results to return. Defaults to None (no limit). */ limit?: number; + /** The minimum fact rating to filter on. Only supported on cloud. Will be ignored on Community Edition. */ minFactRating?: number; + /** The minimum score for search results. Only supported on cloud. Will be ignored on Community Edition. */ minScore?: number; + /** The lambda parameter for the MMR Reranking Algorithm. Only supported on cloud. Will be ignored on Community Edition. */ mmrLambda?: number; - /** filter on the metadata */ + /** Record filter on the metadata. Only supported on cloud. Will be ignored on Community Edition. */ recordFilter?: Record; + /** Search scope. Only supported on cloud. On Community Edition the search scope is always "facts". */ searchScope?: Zep.SearchScope; + /** Search type. Only supported on cloud. Will be ignored on Community Edition. */ searchType?: Zep.SearchType; /** the session ids to search */ sessionIds?: string[]; + /** The search text. */ text?: string; + /** User ID used to determine which sessions to search. Required on Community Edition. */ userId?: string; } diff --git a/src/api/resources/memory/client/requests/UpdateSessionRequest.ts b/src/api/resources/memory/client/requests/UpdateSessionRequest.ts index 91bd057..cd916a7 100644 --- a/src/api/resources/memory/client/requests/UpdateSessionRequest.ts +++ b/src/api/resources/memory/client/requests/UpdateSessionRequest.ts @@ -7,7 +7,9 @@ import * as Zep from "../../../../index"; /** * @example * { - * metadata: {} + * metadata: { + * "key": "value" + * } * } */ export interface UpdateSessionRequest { diff --git a/src/api/resources/memory/client/requests/index.ts b/src/api/resources/memory/client/requests/index.ts index f52ac61..c1e45fa 100644 --- a/src/api/resources/memory/client/requests/index.ts +++ b/src/api/resources/memory/client/requests/index.ts @@ -8,7 +8,7 @@ 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 ApidataAddMemoryRequest } from "./ApidataAddMemoryRequest"; export { type MemoryGetSessionMessagesRequest } from "./MemoryGetSessionMessagesRequest"; export { type ModelsMessageMetadataUpdate } from "./ModelsMessageMetadataUpdate"; export { type MemorySearchPayload } from "./MemorySearchPayload"; diff --git a/src/api/resources/user/client/Client.ts b/src/api/resources/user/client/Client.ts index 7efe30e..67fe110 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.11", + "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.11", + "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.11", + "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.11", + "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.11", + "X-Fern-SDK-Version": "1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), @@ -493,6 +493,93 @@ export class User { } } + /** + * Get user facts. + * + * @param {string} userId - The user_id of the user to get. + * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Zep.NotFoundError} + * @throws {@link Zep.InternalServerError} + * + * @example + * await zep.user.getFacts("userId") + */ + public async getFacts(userId: string, requestOptions?: User.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, + `users/${encodeURIComponent(userId)}/facts` + ), + method: "GET", + 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", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.FactsResponse.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, + }); + } + } + /** * list all sessions for a user by user id * @@ -504,7 +591,7 @@ export class User { * @example * await zep.user.getSessions("userId") */ - public async getSessions(userId: string, requestOptions?: User.RequestOptions): Promise { + public async getSessions(userId: string, requestOptions?: User.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.ZepEnvironment.Default, @@ -514,7 +601,7 @@ export class User { headers: { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "1.0.11", + "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/types/DocumentResponse.ts b/src/api/types/ApidataDocument.ts similarity index 88% rename from src/api/types/DocumentResponse.ts rename to src/api/types/ApidataDocument.ts index 586c2b2..aaadb53 100644 --- a/src/api/types/DocumentResponse.ts +++ b/src/api/types/ApidataDocument.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface DocumentResponse { +export interface ApidataDocument { content?: string; createdAt?: string; documentId?: string; diff --git a/src/api/types/DocumentCollectionResponse.ts b/src/api/types/ApidataDocumentCollection.ts similarity index 75% rename from src/api/types/DocumentCollectionResponse.ts rename to src/api/types/ApidataDocumentCollection.ts index da9b66d..02872bf 100644 --- a/src/api/types/DocumentCollectionResponse.ts +++ b/src/api/types/ApidataDocumentCollection.ts @@ -2,12 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface DocumentCollectionResponse { +export interface ApidataDocumentCollection { createdAt?: string; description?: string; - /** Number of documents in the collection */ documentCount?: number; - /** Number of documents with embeddings */ documentEmbeddedCount?: number; embeddingDimensions?: number; embeddingModelName?: string; diff --git a/src/api/types/DocumentSearchResultPage.ts b/src/api/types/ApidataDocumentSearchResponse.ts similarity index 69% rename from src/api/types/DocumentSearchResultPage.ts rename to src/api/types/ApidataDocumentSearchResponse.ts index 9a91bd3..6ca8211 100644 --- a/src/api/types/DocumentSearchResultPage.ts +++ b/src/api/types/ApidataDocumentSearchResponse.ts @@ -4,10 +4,10 @@ import * as Zep from "../index"; -export interface DocumentSearchResultPage { +export interface ApidataDocumentSearchResponse { currentPage?: number; queryVector?: number[]; resultCount?: number; - results?: Zep.DocumentSearchResult[]; + results?: Zep.ApidataDocumentWithScore[]; totalPages?: number; } diff --git a/src/api/types/DocumentSearchResult.ts b/src/api/types/ApidataDocumentWithScore.ts similarity index 87% rename from src/api/types/DocumentSearchResult.ts rename to src/api/types/ApidataDocumentWithScore.ts index 922a727..57d43ed 100644 --- a/src/api/types/DocumentSearchResult.ts +++ b/src/api/types/ApidataDocumentWithScore.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface DocumentSearchResult { +export interface ApidataDocumentWithScore { content?: string; createdAt?: string; documentId?: string; diff --git a/src/api/types/EndSessionResponse.ts b/src/api/types/EndSessionResponse.ts index 0d73785..ddc248a 100644 --- a/src/api/types/EndSessionResponse.ts +++ b/src/api/types/EndSessionResponse.ts @@ -5,6 +5,6 @@ import * as Zep from "../index"; export interface EndSessionResponse { - classification?: Zep.ClassifySessionResponse; + classification?: Zep.SessionClassification; session?: Zep.Session; } diff --git a/src/api/types/EntityEdge.ts b/src/api/types/EntityEdge.ts new file mode 100644 index 0000000..ab6c54c --- /dev/null +++ b/src/api/types/EntityEdge.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface EntityEdge { + /** Creation time of the edge */ + createdAt?: string; + /** List of episode ids that reference these entity edges */ + episodes?: string[]; + /** Datetime of when the node was invalidated */ + expiredAt?: string; + /** Fact representing the edge and nodes that it connects */ + fact?: string; + /** Datetime of when the fact stopped being true */ + invalidAt?: string; + /** Name of the edge, relation name */ + name?: string; + /** UUID of the source node */ + sourceNodeUuid?: string; + /** UUID of the target node */ + targetNodeUuid?: string; + /** UUID of the edge */ + uuid?: string; + /** Datetime of when the fact became true */ + validAt?: string; +} diff --git a/src/api/types/EntityNode.ts b/src/api/types/EntityNode.ts new file mode 100644 index 0000000..6f8da64 --- /dev/null +++ b/src/api/types/EntityNode.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface EntityNode { + /** Creation time of the node */ + createdAt?: string; + /** Labels associated with the node */ + labels?: string[]; + /** Name of the node */ + name?: string; + /** Regional summary of surrounding edges */ + summary?: string; + /** UUID of the node */ + uuid?: string; +} diff --git a/src/api/types/Episode.ts b/src/api/types/Episode.ts new file mode 100644 index 0000000..35be44b --- /dev/null +++ b/src/api/types/Episode.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Zep from "../index"; + +export interface Episode { + content?: string; + createdAt?: string; + name?: string; + source?: Zep.EpisodeType; + sourceDescription?: string; + uuid?: string; +} diff --git a/src/api/types/EpisodeResponse.ts b/src/api/types/EpisodeResponse.ts new file mode 100644 index 0000000..3aba502 --- /dev/null +++ b/src/api/types/EpisodeResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Zep from "../index"; + +export interface EpisodeResponse { + episodes?: Zep.Episode[]; +} diff --git a/src/api/types/EpisodeType.ts b/src/api/types/EpisodeType.ts new file mode 100644 index 0000000..9556c18 --- /dev/null +++ b/src/api/types/EpisodeType.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type EpisodeType = "message" | "text" | "JSON"; + +export const EpisodeType = { + Message: "message", + Text: "text", + Json: "JSON", +} as const; diff --git a/src/api/types/Fact.ts b/src/api/types/Fact.ts index 59a7ceb..2333d0e 100644 --- a/src/api/types/Fact.ts +++ b/src/api/types/Fact.ts @@ -5,6 +5,9 @@ export interface Fact { createdAt?: string; fact?: string; + name?: string; rating?: number; + sourceNodeName?: string; + targetNodeName?: string; uuid?: string; } diff --git a/src/api/types/GraphSearchResults.ts b/src/api/types/GraphSearchResults.ts new file mode 100644 index 0000000..709365a --- /dev/null +++ b/src/api/types/GraphSearchResults.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Zep from "../index"; + +export interface GraphSearchResults { + edges?: Zep.EntityEdge[]; + nodes?: Zep.EntityNode[]; +} diff --git a/src/api/types/GraphSearchScope.ts b/src/api/types/GraphSearchScope.ts new file mode 100644 index 0000000..b8fcc0d --- /dev/null +++ b/src/api/types/GraphSearchScope.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type GraphSearchScope = "edges" | "nodes"; + +export const GraphSearchScope = { + Edges: "edges", + Nodes: "nodes", +} as const; diff --git a/src/api/types/Group.ts b/src/api/types/Group.ts new file mode 100644 index 0000000..01a643b --- /dev/null +++ b/src/api/types/Group.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface Group { + createdAt?: string; + description?: string; + externalId?: string; + id?: number; + name?: string; + projectUuid?: string; + uuid?: string; +} diff --git a/src/api/types/Memory.ts b/src/api/types/Memory.ts index c46a78d..91fc05e 100644 --- a/src/api/types/Memory.ts +++ b/src/api/types/Memory.ts @@ -6,17 +6,16 @@ import * as Zep from "../index"; export interface Memory { /** - * Most recent list of facts derived from the session. Included only with perpetual memory type. + * Most recent list of facts derived from the session. (cloud only) * Deprecated: Facts will be deprecated in future releases and relevant_facts should be used instead. */ facts?: string[]; - /** A list of message objects, where each message contains a role and content. */ + /** A list of message objects, where each message contains a role and content. Only last_n messages will be returned */ messages?: Zep.Message[]; /** A dictionary containing metadata associated with the memory. */ metadata?: Record; + /** Most relevant facts to the recent messages in the session. */ relevantFacts?: Zep.Fact[]; - /** Summary list result from Summary Retriever Memory Type. */ - relevantSummaries?: Zep.Summary[]; - /** A Summary object. */ + /** The most recent summary before last nth message. (cloud only) */ summary?: Zep.Summary; } diff --git a/src/api/types/MemoryType.ts b/src/api/types/MemoryType.ts deleted file mode 100644 index 94a5859..0000000 --- a/src/api/types/MemoryType.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export type MemoryType = "perpetual" | "summary_retriever" | "message_window"; - -export const MemoryType = { - Perpetual: "perpetual", - SummaryRetriever: "summary_retriever", - MessageWindow: "message_window", -} as const; diff --git a/src/api/types/ModelsGraphDataType.ts b/src/api/types/ModelsGraphDataType.ts new file mode 100644 index 0000000..a7ca3ad --- /dev/null +++ b/src/api/types/ModelsGraphDataType.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ModelsGraphDataType = "text" | "json" | "message"; + +export const ModelsGraphDataType = { + Text: "text", + Json: "json", + Message: "message", +} as const; diff --git a/src/api/types/AddedFact.ts b/src/api/types/NewFact.ts similarity index 76% rename from src/api/types/AddedFact.ts rename to src/api/types/NewFact.ts index 8591a92..78af4d4 100644 --- a/src/api/types/AddedFact.ts +++ b/src/api/types/NewFact.ts @@ -2,6 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface AddedFact { +export interface NewFact { fact?: string; } diff --git a/src/api/types/Reranker.ts b/src/api/types/Reranker.ts new file mode 100644 index 0000000..65855f7 --- /dev/null +++ b/src/api/types/Reranker.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type Reranker = "rrf" | "mmr" | "node_distance" | "episode_mentions"; + +export const Reranker = { + Rrf: "rrf", + Mmr: "mmr", + NodeDistance: "node_distance", + EpisodeMentions: "episode_mentions", +} as const; diff --git a/src/api/types/Session.ts b/src/api/types/Session.ts index 24fc04e..ed52ab2 100644 --- a/src/api/types/Session.ts +++ b/src/api/types/Session.ts @@ -9,8 +9,7 @@ export interface Session { createdAt?: string; deletedAt?: string; endedAt?: string; - factRatingInstruction?: Zep.FactRatingInstruction; - factVersionUuid?: string; + factRatingInstruction?: Zep.SessionFactRatingInstruction; facts?: string[]; id?: number; metadata?: Record; diff --git a/src/api/types/ClassifySessionResponse.ts b/src/api/types/SessionClassification.ts similarity index 60% rename from src/api/types/ClassifySessionResponse.ts rename to src/api/types/SessionClassification.ts index b4983c0..30d5225 100644 --- a/src/api/types/ClassifySessionResponse.ts +++ b/src/api/types/SessionClassification.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface ClassifySessionResponse { +export interface SessionClassification { class?: string; - name?: string; + label?: string; } diff --git a/src/api/types/SessionFactRatingExamples.ts b/src/api/types/SessionFactRatingExamples.ts new file mode 100644 index 0000000..10130a4 --- /dev/null +++ b/src/api/types/SessionFactRatingExamples.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface SessionFactRatingExamples { + high?: string; + low?: string; + medium?: string; +} diff --git a/src/api/types/SessionFactRatingInstruction.ts b/src/api/types/SessionFactRatingInstruction.ts new file mode 100644 index 0000000..9567655 --- /dev/null +++ b/src/api/types/SessionFactRatingInstruction.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Zep from "../index"; + +export interface SessionFactRatingInstruction { + /** + * Examples is a list of examples that demonstrate how facts might be rated based on your instruction. You should provide + * an example of a highly rated example, a low rated example, and a medium (or in between example). For example, if you are rating + * based on relevance to a trip planning application, your examples might be: + * High: "Joe's dream vacation is Bali" + * Medium: "Joe has a fear of flying", + * Low: "Joe's favorite food is Japanese", + */ + examples?: Zep.SessionFactRatingExamples; + /** + * A string describing how to rate facts as they apply to your application. A trip planning application may + * use something like "relevancy to planning a trip, the user's preferences when traveling, + * or the user's travel history." + */ + instruction?: string; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 064e1fa..a78f02d 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,35 +1,46 @@ export * from "./ApiError"; -export * from "./AddedFact"; -export * from "./ClassifySessionRequest"; -export * from "./ClassifySessionResponse"; -export * from "./CreateDocumentRequest"; -export * from "./DocumentCollectionResponse"; -export * from "./DocumentResponse"; -export * from "./DocumentSearchResult"; -export * from "./DocumentSearchResultPage"; +export * from "./ApidataDocument"; +export * from "./ApidataDocumentCollection"; +export * from "./ApidataDocumentSearchResponse"; +export * from "./ApidataDocumentWithScore"; export * from "./EndSessionResponse"; export * from "./EndSessionsResponse"; export * from "./Fact"; -export * from "./FactRatingExamples"; -export * from "./FactRatingInstruction"; export * from "./FactResponse"; export * from "./FactsResponse"; +export * from "./Group"; export * from "./Memory"; export * from "./MemorySearchResult"; export * from "./Message"; export * from "./MessageListResponse"; +export * from "./NewFact"; export * from "./Question"; export * from "./RoleType"; -export * from "./SearchScope"; -export * from "./SearchType"; export * from "./Session"; +export * from "./SessionClassification"; +export * from "./SessionFactRatingExamples"; +export * from "./SessionFactRatingInstruction"; export * from "./SessionListResponse"; export * from "./SessionSearchResponse"; export * from "./SessionSearchResult"; export * from "./SuccessResponse"; export * from "./Summary"; export * from "./SummaryListResponse"; -export * from "./UpdateDocumentListRequest"; export * from "./User"; export * from "./UserListResponse"; -export * from "./MemoryType"; +export * from "./EntityEdge"; +export * from "./EntityNode"; +export * from "./Episode"; +export * from "./EpisodeResponse"; +export * from "./EpisodeType"; +export * from "./GraphSearchResults"; +export * from "./GraphSearchScope"; +export * from "./Reranker"; +export * from "./ClassifySessionRequest"; +export * from "./CreateDocumentRequest"; +export * from "./FactRatingExamples"; +export * from "./FactRatingInstruction"; +export * from "./ModelsGraphDataType"; +export * from "./SearchScope"; +export * from "./SearchType"; +export * from "./UpdateDocumentListRequest"; diff --git a/src/serialization/resources/document/client/addDocuments.ts b/src/serialization/resources/document/client/addDocuments.ts index b042ff6..de09c08 100644 --- a/src/serialization/resources/document/client/addDocuments.ts +++ b/src/serialization/resources/document/client/addDocuments.ts @@ -16,9 +16,9 @@ export declare namespace Request { type Raw = CreateDocumentRequest.Raw[]; } -export const Response: core.serialization.Schema = - core.serialization.list(core.serialization.string()); +export const Response: core.serialization.Schema = + core.serialization.list(core.serialization.list(core.serialization.string())); export declare namespace Response { - type Raw = string[]; + type Raw = string[][]; } diff --git a/src/serialization/resources/document/client/batchGetDocuments.ts b/src/serialization/resources/document/client/batchGetDocuments.ts index d43c4d0..ebd0769 100644 --- a/src/serialization/resources/document/client/batchGetDocuments.ts +++ b/src/serialization/resources/document/client/batchGetDocuments.ts @@ -5,13 +5,13 @@ import * as serializers from "../../../index"; import * as Zep from "../../../../api/index"; import * as core from "../../../../core"; -import { DocumentResponse } from "../../../types/DocumentResponse"; +import { ApidataDocument } from "../../../types/ApidataDocument"; export const Response: core.serialization.Schema< serializers.document.batchGetDocuments.Response.Raw, - Zep.DocumentResponse[] -> = core.serialization.list(DocumentResponse); + Zep.ApidataDocument[][] +> = core.serialization.list(core.serialization.list(ApidataDocument)); export declare namespace Response { - type Raw = DocumentResponse.Raw[]; + type Raw = ApidataDocument.Raw[][]; } diff --git a/src/serialization/resources/document/client/listCollections.ts b/src/serialization/resources/document/client/listCollections.ts index c598129..8add1b4 100644 --- a/src/serialization/resources/document/client/listCollections.ts +++ b/src/serialization/resources/document/client/listCollections.ts @@ -5,13 +5,13 @@ import * as serializers from "../../../index"; import * as Zep from "../../../../api/index"; import * as core from "../../../../core"; -import { DocumentCollectionResponse } from "../../../types/DocumentCollectionResponse"; +import { ApidataDocumentCollection } from "../../../types/ApidataDocumentCollection"; export const Response: core.serialization.Schema< serializers.document.listCollections.Response.Raw, - Zep.DocumentCollectionResponse[][] -> = core.serialization.list(core.serialization.list(DocumentCollectionResponse)); + Zep.ApidataDocumentCollection[][] +> = core.serialization.list(core.serialization.list(ApidataDocumentCollection)); export declare namespace Response { - type Raw = DocumentCollectionResponse.Raw[][]; + type Raw = ApidataDocumentCollection.Raw[][]; } diff --git a/src/serialization/resources/graph/client/index.ts b/src/serialization/resources/graph/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/resources/graph/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/graph/client/requests/AddDataRequest.ts b/src/serialization/resources/graph/client/requests/AddDataRequest.ts new file mode 100644 index 0000000..f3843a7 --- /dev/null +++ b/src/serialization/resources/graph/client/requests/AddDataRequest.ts @@ -0,0 +1,25 @@ +/** + * 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"; +import { ModelsGraphDataType } from "../../../../types/ModelsGraphDataType"; + +export const AddDataRequest: core.serialization.Schema = + core.serialization.object({ + data: core.serialization.string().optional(), + groupId: core.serialization.property("group_id", core.serialization.string().optional()), + type: ModelsGraphDataType.optional(), + userId: core.serialization.property("user_id", core.serialization.string().optional()), + }); + +export declare namespace AddDataRequest { + interface Raw { + data?: string | null; + group_id?: string | null; + type?: ModelsGraphDataType.Raw | null; + user_id?: string | null; + } +} diff --git a/src/serialization/resources/graph/client/requests/GraphSearchQuery.ts b/src/serialization/resources/graph/client/requests/GraphSearchQuery.ts new file mode 100644 index 0000000..ba3f12e --- /dev/null +++ b/src/serialization/resources/graph/client/requests/GraphSearchQuery.ts @@ -0,0 +1,36 @@ +/** + * 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"; +import { Reranker } from "../../../../types/Reranker"; +import { GraphSearchScope } from "../../../../types/GraphSearchScope"; + +export const GraphSearchQuery: core.serialization.Schema = + core.serialization.object({ + centerNodeUuid: core.serialization.property("center_node_uuid", core.serialization.string().optional()), + groupId: core.serialization.property("group_id", core.serialization.string().optional()), + limit: core.serialization.number().optional(), + minScore: core.serialization.property("min_score", core.serialization.number().optional()), + mmrLambda: core.serialization.property("mmr_lambda", core.serialization.number().optional()), + query: core.serialization.string().optional(), + reranker: Reranker.optional(), + scope: GraphSearchScope.optional(), + userId: core.serialization.property("user_id", core.serialization.string().optional()), + }); + +export declare namespace GraphSearchQuery { + interface Raw { + center_node_uuid?: string | null; + group_id?: string | null; + limit?: number | null; + min_score?: number | null; + mmr_lambda?: number | null; + query?: string | null; + reranker?: Reranker.Raw | null; + scope?: GraphSearchScope.Raw | null; + user_id?: string | null; + } +} diff --git a/src/serialization/resources/graph/client/requests/index.ts b/src/serialization/resources/graph/client/requests/index.ts new file mode 100644 index 0000000..17a8a3d --- /dev/null +++ b/src/serialization/resources/graph/client/requests/index.ts @@ -0,0 +1,2 @@ +export { AddDataRequest } from "./AddDataRequest"; +export { GraphSearchQuery } from "./GraphSearchQuery"; diff --git a/src/serialization/resources/graph/index.ts b/src/serialization/resources/graph/index.ts new file mode 100644 index 0000000..4ce0f39 --- /dev/null +++ b/src/serialization/resources/graph/index.ts @@ -0,0 +1,2 @@ +export * from "./resources"; +export * from "./client"; diff --git a/src/serialization/resources/graph/resources/edge/client/getByGroupId.ts b/src/serialization/resources/graph/resources/edge/client/getByGroupId.ts new file mode 100644 index 0000000..75421bb --- /dev/null +++ b/src/serialization/resources/graph/resources/edge/client/getByGroupId.ts @@ -0,0 +1,15 @@ +/** + * 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"; +import { EntityEdge } from "../../../../../types/EntityEdge"; + +export const Response: core.serialization.Schema = + core.serialization.list(EntityEdge); + +export declare namespace Response { + type Raw = EntityEdge.Raw[]; +} diff --git a/src/serialization/resources/graph/resources/edge/client/getByUserId.ts b/src/serialization/resources/graph/resources/edge/client/getByUserId.ts new file mode 100644 index 0000000..8ecdf28 --- /dev/null +++ b/src/serialization/resources/graph/resources/edge/client/getByUserId.ts @@ -0,0 +1,15 @@ +/** + * 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"; +import { EntityEdge } from "../../../../../types/EntityEdge"; + +export const Response: core.serialization.Schema = + core.serialization.list(EntityEdge); + +export declare namespace Response { + type Raw = EntityEdge.Raw[]; +} diff --git a/src/serialization/resources/graph/resources/edge/client/index.ts b/src/serialization/resources/graph/resources/edge/client/index.ts new file mode 100644 index 0000000..f09cad1 --- /dev/null +++ b/src/serialization/resources/graph/resources/edge/client/index.ts @@ -0,0 +1,2 @@ +export * as getByGroupId from "./getByGroupId"; +export * as getByUserId from "./getByUserId"; diff --git a/src/serialization/resources/graph/resources/edge/index.ts b/src/serialization/resources/graph/resources/edge/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/serialization/resources/graph/resources/edge/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/graph/resources/index.ts b/src/serialization/resources/graph/resources/index.ts new file mode 100644 index 0000000..4992ef4 --- /dev/null +++ b/src/serialization/resources/graph/resources/index.ts @@ -0,0 +1,2 @@ +export * as edge from "./edge"; +export * as node from "./node"; diff --git a/src/serialization/resources/graph/resources/node/client/getByGroupId.ts b/src/serialization/resources/graph/resources/node/client/getByGroupId.ts new file mode 100644 index 0000000..b06254b --- /dev/null +++ b/src/serialization/resources/graph/resources/node/client/getByGroupId.ts @@ -0,0 +1,15 @@ +/** + * 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"; +import { EntityNode } from "../../../../../types/EntityNode"; + +export const Response: core.serialization.Schema = + core.serialization.list(EntityNode); + +export declare namespace Response { + type Raw = EntityNode.Raw[]; +} diff --git a/src/serialization/resources/graph/resources/node/client/getByUserId.ts b/src/serialization/resources/graph/resources/node/client/getByUserId.ts new file mode 100644 index 0000000..e0415c7 --- /dev/null +++ b/src/serialization/resources/graph/resources/node/client/getByUserId.ts @@ -0,0 +1,15 @@ +/** + * 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"; +import { EntityNode } from "../../../../../types/EntityNode"; + +export const Response: core.serialization.Schema = + core.serialization.list(EntityNode); + +export declare namespace Response { + type Raw = EntityNode.Raw[]; +} diff --git a/src/serialization/resources/graph/resources/node/client/index.ts b/src/serialization/resources/graph/resources/node/client/index.ts new file mode 100644 index 0000000..f09cad1 --- /dev/null +++ b/src/serialization/resources/graph/resources/node/client/index.ts @@ -0,0 +1,2 @@ +export * as getByGroupId from "./getByGroupId"; +export * as getByUserId from "./getByUserId"; diff --git a/src/serialization/resources/graph/resources/node/index.ts b/src/serialization/resources/graph/resources/node/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/serialization/resources/graph/resources/node/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/group/client/index.ts b/src/serialization/resources/group/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/resources/group/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/group/client/requests/CreateGroupRequest.ts b/src/serialization/resources/group/client/requests/CreateGroupRequest.ts new file mode 100644 index 0000000..e9a9f79 --- /dev/null +++ b/src/serialization/resources/group/client/requests/CreateGroupRequest.ts @@ -0,0 +1,27 @@ +/** + * 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 CreateGroupRequest: core.serialization.Schema = + core.serialization.object({ + description: core.serialization.string().optional(), + groupId: core.serialization.property("group_id", core.serialization.string().optional()), + name: core.serialization.string().optional(), + userIds: core.serialization.property( + "user_ids", + core.serialization.list(core.serialization.string()).optional() + ), + }); + +export declare namespace CreateGroupRequest { + interface Raw { + description?: string | null; + group_id?: string | null; + name?: string | null; + user_ids?: string[] | null; + } +} diff --git a/src/serialization/resources/group/client/requests/UpdateGroupRequest.ts b/src/serialization/resources/group/client/requests/UpdateGroupRequest.ts new file mode 100644 index 0000000..6b209ad --- /dev/null +++ b/src/serialization/resources/group/client/requests/UpdateGroupRequest.ts @@ -0,0 +1,20 @@ +/** + * 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 UpdateGroupRequest: core.serialization.Schema = + core.serialization.object({ + description: core.serialization.string().optional(), + name: core.serialization.string().optional(), + }); + +export declare namespace UpdateGroupRequest { + interface Raw { + description?: string | null; + name?: string | null; + } +} diff --git a/src/serialization/resources/group/client/requests/index.ts b/src/serialization/resources/group/client/requests/index.ts new file mode 100644 index 0000000..e6bdf8e --- /dev/null +++ b/src/serialization/resources/group/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateGroupRequest } from "./CreateGroupRequest"; +export { UpdateGroupRequest } from "./UpdateGroupRequest"; diff --git a/src/serialization/resources/group/index.ts b/src/serialization/resources/group/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/serialization/resources/group/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index cc425b4..761b931 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -1,6 +1,10 @@ export * as document from "./document"; export * as memory from "./memory"; export * as user from "./user"; +export * as graph from "./graph"; export * from "./document/client/requests"; export * from "./memory/client/requests"; +export * from "./graph/client/requests"; +export * as group from "./group"; +export * from "./group/client/requests"; export * from "./user/client/requests"; diff --git a/src/serialization/resources/memory/client/requests/AddFactsRequest.ts b/src/serialization/resources/memory/client/requests/AddFactsRequest.ts index 94ba33b..91fc1a3 100644 --- a/src/serialization/resources/memory/client/requests/AddFactsRequest.ts +++ b/src/serialization/resources/memory/client/requests/AddFactsRequest.ts @@ -5,15 +5,15 @@ import * as serializers from "../../../../index"; import * as Zep from "../../../../../api/index"; import * as core from "../../../../../core"; -import { AddedFact } from "../../../../types/AddedFact"; +import { NewFact } from "../../../../types/NewFact"; export const AddFactsRequest: core.serialization.Schema = core.serialization.object({ - facts: core.serialization.list(AddedFact).optional(), + facts: core.serialization.list(NewFact).optional(), }); export declare namespace AddFactsRequest { interface Raw { - facts?: AddedFact.Raw[] | null; + facts?: NewFact.Raw[] | null; } } diff --git a/src/serialization/resources/memory/client/requests/AddMemoryRequest.ts b/src/serialization/resources/memory/client/requests/AddMemoryRequest.ts deleted file mode 100644 index 794dc12..0000000 --- a/src/serialization/resources/memory/client/requests/AddMemoryRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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"; -import { Message } from "../../../../types/Message"; - -export const AddMemoryRequest: core.serialization.Schema = - core.serialization.object({ - factInstruction: core.serialization.property("fact_instruction", core.serialization.string().optional()), - messages: core.serialization.list(Message), - summaryInstruction: core.serialization.property("summary_instruction", core.serialization.string().optional()), - }); - -export declare namespace AddMemoryRequest { - interface Raw { - fact_instruction?: string | null; - messages: Message.Raw[]; - summary_instruction?: string | null; - } -} diff --git a/src/serialization/resources/memory/client/requests/ApidataAddMemoryRequest.ts b/src/serialization/resources/memory/client/requests/ApidataAddMemoryRequest.ts new file mode 100644 index 0000000..6740312 --- /dev/null +++ b/src/serialization/resources/memory/client/requests/ApidataAddMemoryRequest.ts @@ -0,0 +1,25 @@ +/** + * 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"; +import { Message } from "../../../../types/Message"; + +export const ApidataAddMemoryRequest: core.serialization.Schema< + serializers.ApidataAddMemoryRequest.Raw, + Zep.ApidataAddMemoryRequest +> = core.serialization.object({ + factInstruction: core.serialization.property("fact_instruction", core.serialization.string().optional()), + messages: core.serialization.list(Message), + summaryInstruction: core.serialization.property("summary_instruction", core.serialization.string().optional()), +}); + +export declare namespace ApidataAddMemoryRequest { + interface Raw { + fact_instruction?: string | null; + messages: Message.Raw[]; + summary_instruction?: string | null; + } +} diff --git a/src/serialization/resources/memory/client/requests/index.ts b/src/serialization/resources/memory/client/requests/index.ts index 004608b..9618aec 100644 --- a/src/serialization/resources/memory/client/requests/index.ts +++ b/src/serialization/resources/memory/client/requests/index.ts @@ -5,6 +5,6 @@ export { UpdateSessionRequest } from "./UpdateSessionRequest"; export { EndSessionRequest } from "./EndSessionRequest"; export { ExtractDataRequest } from "./ExtractDataRequest"; export { AddFactsRequest } from "./AddFactsRequest"; -export { AddMemoryRequest } from "./AddMemoryRequest"; +export { ApidataAddMemoryRequest } from "./ApidataAddMemoryRequest"; export { ModelsMessageMetadataUpdate } from "./ModelsMessageMetadataUpdate"; export { MemorySearchPayload } from "./MemorySearchPayload"; diff --git a/src/serialization/resources/user/client/getSessions.ts b/src/serialization/resources/user/client/getSessions.ts index bcb5069..d006700 100644 --- a/src/serialization/resources/user/client/getSessions.ts +++ b/src/serialization/resources/user/client/getSessions.ts @@ -7,9 +7,9 @@ import * as Zep from "../../../../api/index"; import * as core from "../../../../core"; import { Session } from "../../../types/Session"; -export const Response: core.serialization.Schema = - core.serialization.list(Session); +export const Response: core.serialization.Schema = + core.serialization.list(core.serialization.list(Session)); export declare namespace Response { - type Raw = Session.Raw[]; + type Raw = Session.Raw[][]; } diff --git a/src/serialization/types/DocumentResponse.ts b/src/serialization/types/ApidataDocument.ts similarity index 88% rename from src/serialization/types/DocumentResponse.ts rename to src/serialization/types/ApidataDocument.ts index adcc058..866b582 100644 --- a/src/serialization/types/DocumentResponse.ts +++ b/src/serialization/types/ApidataDocument.ts @@ -6,7 +6,7 @@ import * as serializers from "../index"; import * as Zep from "../../api/index"; import * as core from "../../core"; -export const DocumentResponse: core.serialization.ObjectSchema = +export const ApidataDocument: core.serialization.ObjectSchema = core.serialization.object({ content: core.serialization.string().optional(), createdAt: core.serialization.property("created_at", core.serialization.string().optional()), @@ -18,7 +18,7 @@ export const DocumentResponse: core.serialization.ObjectSchema = core.serialization.object({ createdAt: core.serialization.property("created_at", core.serialization.string().optional()), description: core.serialization.string().optional(), @@ -28,7 +28,7 @@ export const DocumentCollectionResponse: core.serialization.ObjectSchema< uuid: core.serialization.string().optional(), }); -export declare namespace DocumentCollectionResponse { +export declare namespace ApidataDocumentCollection { interface Raw { created_at?: string | null; description?: string | null; diff --git a/src/serialization/types/DocumentSearchResultPage.ts b/src/serialization/types/ApidataDocumentSearchResponse.ts similarity index 66% rename from src/serialization/types/DocumentSearchResultPage.ts rename to src/serialization/types/ApidataDocumentSearchResponse.ts index f6561f9..f1222ed 100644 --- a/src/serialization/types/DocumentSearchResultPage.ts +++ b/src/serialization/types/ApidataDocumentSearchResponse.ts @@ -5,11 +5,11 @@ import * as serializers from "../index"; import * as Zep from "../../api/index"; import * as core from "../../core"; -import { DocumentSearchResult } from "./DocumentSearchResult"; +import { ApidataDocumentWithScore } from "./ApidataDocumentWithScore"; -export const DocumentSearchResultPage: core.serialization.ObjectSchema< - serializers.DocumentSearchResultPage.Raw, - Zep.DocumentSearchResultPage +export const ApidataDocumentSearchResponse: core.serialization.ObjectSchema< + serializers.ApidataDocumentSearchResponse.Raw, + Zep.ApidataDocumentSearchResponse > = core.serialization.object({ currentPage: core.serialization.property("current_page", core.serialization.number().optional()), queryVector: core.serialization.property( @@ -17,16 +17,16 @@ export const DocumentSearchResultPage: core.serialization.ObjectSchema< core.serialization.list(core.serialization.number()).optional() ), resultCount: core.serialization.property("result_count", core.serialization.number().optional()), - results: core.serialization.list(DocumentSearchResult).optional(), + results: core.serialization.list(ApidataDocumentWithScore).optional(), totalPages: core.serialization.property("total_pages", core.serialization.number().optional()), }); -export declare namespace DocumentSearchResultPage { +export declare namespace ApidataDocumentSearchResponse { interface Raw { current_page?: number | null; query_vector?: number[] | null; result_count?: number | null; - results?: DocumentSearchResult.Raw[] | null; + results?: ApidataDocumentWithScore.Raw[] | null; total_pages?: number | null; } } diff --git a/src/serialization/types/DocumentSearchResult.ts b/src/serialization/types/ApidataDocumentWithScore.ts similarity index 86% rename from src/serialization/types/DocumentSearchResult.ts rename to src/serialization/types/ApidataDocumentWithScore.ts index 3a724e7..023345e 100644 --- a/src/serialization/types/DocumentSearchResult.ts +++ b/src/serialization/types/ApidataDocumentWithScore.ts @@ -6,9 +6,9 @@ import * as serializers from "../index"; import * as Zep from "../../api/index"; import * as core from "../../core"; -export const DocumentSearchResult: core.serialization.ObjectSchema< - serializers.DocumentSearchResult.Raw, - Zep.DocumentSearchResult +export const ApidataDocumentWithScore: core.serialization.ObjectSchema< + serializers.ApidataDocumentWithScore.Raw, + Zep.ApidataDocumentWithScore > = core.serialization.object({ content: core.serialization.string().optional(), createdAt: core.serialization.property("created_at", core.serialization.string().optional()), @@ -21,7 +21,7 @@ export const DocumentSearchResult: core.serialization.ObjectSchema< uuid: core.serialization.string().optional(), }); -export declare namespace DocumentSearchResult { +export declare namespace ApidataDocumentWithScore { interface Raw { content?: string | null; created_at?: string | null; diff --git a/src/serialization/types/EndSessionResponse.ts b/src/serialization/types/EndSessionResponse.ts index 4878951..1a74626 100644 --- a/src/serialization/types/EndSessionResponse.ts +++ b/src/serialization/types/EndSessionResponse.ts @@ -5,20 +5,20 @@ import * as serializers from "../index"; import * as Zep from "../../api/index"; import * as core from "../../core"; -import { ClassifySessionResponse } from "./ClassifySessionResponse"; +import { SessionClassification } from "./SessionClassification"; import { Session } from "./Session"; export const EndSessionResponse: core.serialization.ObjectSchema< serializers.EndSessionResponse.Raw, Zep.EndSessionResponse > = core.serialization.object({ - classification: ClassifySessionResponse.optional(), + classification: SessionClassification.optional(), session: Session.optional(), }); export declare namespace EndSessionResponse { interface Raw { - classification?: ClassifySessionResponse.Raw | null; + classification?: SessionClassification.Raw | null; session?: Session.Raw | null; } } diff --git a/src/serialization/types/EntityEdge.ts b/src/serialization/types/EntityEdge.ts new file mode 100644 index 0000000..fab5cce --- /dev/null +++ b/src/serialization/types/EntityEdge.ts @@ -0,0 +1,36 @@ +/** + * 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 EntityEdge: core.serialization.ObjectSchema = + core.serialization.object({ + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + episodes: core.serialization.list(core.serialization.string()).optional(), + expiredAt: core.serialization.property("expired_at", core.serialization.string().optional()), + fact: core.serialization.string().optional(), + invalidAt: core.serialization.property("invalid_at", core.serialization.string().optional()), + name: core.serialization.string().optional(), + sourceNodeUuid: core.serialization.property("source_node_uuid", core.serialization.string().optional()), + targetNodeUuid: core.serialization.property("target_node_uuid", core.serialization.string().optional()), + uuid: core.serialization.string().optional(), + validAt: core.serialization.property("valid_at", core.serialization.string().optional()), + }); + +export declare namespace EntityEdge { + interface Raw { + created_at?: string | null; + episodes?: string[] | null; + expired_at?: string | null; + fact?: string | null; + invalid_at?: string | null; + name?: string | null; + source_node_uuid?: string | null; + target_node_uuid?: string | null; + uuid?: string | null; + valid_at?: string | null; + } +} diff --git a/src/serialization/types/EntityNode.ts b/src/serialization/types/EntityNode.ts new file mode 100644 index 0000000..0fdb2a6 --- /dev/null +++ b/src/serialization/types/EntityNode.ts @@ -0,0 +1,26 @@ +/** + * 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 EntityNode: core.serialization.ObjectSchema = + core.serialization.object({ + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + labels: core.serialization.list(core.serialization.string()).optional(), + name: core.serialization.string().optional(), + summary: core.serialization.string().optional(), + uuid: core.serialization.string().optional(), + }); + +export declare namespace EntityNode { + interface Raw { + created_at?: string | null; + labels?: string[] | null; + name?: string | null; + summary?: string | null; + uuid?: string | null; + } +} diff --git a/src/serialization/types/Episode.ts b/src/serialization/types/Episode.ts new file mode 100644 index 0000000..fdf3352 --- /dev/null +++ b/src/serialization/types/Episode.ts @@ -0,0 +1,30 @@ +/** + * 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"; +import { EpisodeType } from "./EpisodeType"; + +export const Episode: core.serialization.ObjectSchema = core.serialization.object( + { + content: core.serialization.string().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + name: core.serialization.string().optional(), + source: EpisodeType.optional(), + sourceDescription: core.serialization.property("source_description", core.serialization.string().optional()), + uuid: core.serialization.string().optional(), + } +); + +export declare namespace Episode { + interface Raw { + content?: string | null; + created_at?: string | null; + name?: string | null; + source?: EpisodeType.Raw | null; + source_description?: string | null; + uuid?: string | null; + } +} diff --git a/src/serialization/types/EpisodeResponse.ts b/src/serialization/types/EpisodeResponse.ts new file mode 100644 index 0000000..92df458 --- /dev/null +++ b/src/serialization/types/EpisodeResponse.ts @@ -0,0 +1,19 @@ +/** + * 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"; +import { Episode } from "./Episode"; + +export const EpisodeResponse: core.serialization.ObjectSchema = + core.serialization.object({ + episodes: core.serialization.list(Episode).optional(), + }); + +export declare namespace EpisodeResponse { + interface Raw { + episodes?: Episode.Raw[] | null; + } +} diff --git a/src/serialization/types/EpisodeType.ts b/src/serialization/types/EpisodeType.ts new file mode 100644 index 0000000..d9fea65 --- /dev/null +++ b/src/serialization/types/EpisodeType.ts @@ -0,0 +1,14 @@ +/** + * 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 EpisodeType: core.serialization.Schema = + core.serialization.enum_(["message", "text", "JSON"]); + +export declare namespace EpisodeType { + type Raw = "message" | "text" | "JSON"; +} diff --git a/src/serialization/types/Fact.ts b/src/serialization/types/Fact.ts index 0ed2abe..a4f69e8 100644 --- a/src/serialization/types/Fact.ts +++ b/src/serialization/types/Fact.ts @@ -9,7 +9,10 @@ import * as core from "../../core"; export const Fact: core.serialization.ObjectSchema = core.serialization.object({ createdAt: core.serialization.property("created_at", core.serialization.string().optional()), fact: core.serialization.string().optional(), + name: core.serialization.string().optional(), rating: core.serialization.number().optional(), + sourceNodeName: core.serialization.property("source_node_name", core.serialization.string().optional()), + targetNodeName: core.serialization.property("target_node_name", core.serialization.string().optional()), uuid: core.serialization.string().optional(), }); @@ -17,7 +20,10 @@ export declare namespace Fact { interface Raw { created_at?: string | null; fact?: string | null; + name?: string | null; rating?: number | null; + source_node_name?: string | null; + target_node_name?: string | null; uuid?: string | null; } } diff --git a/src/serialization/types/GraphSearchResults.ts b/src/serialization/types/GraphSearchResults.ts new file mode 100644 index 0000000..aaf3ced --- /dev/null +++ b/src/serialization/types/GraphSearchResults.ts @@ -0,0 +1,24 @@ +/** + * 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"; +import { EntityEdge } from "./EntityEdge"; +import { EntityNode } from "./EntityNode"; + +export const GraphSearchResults: core.serialization.ObjectSchema< + serializers.GraphSearchResults.Raw, + Zep.GraphSearchResults +> = core.serialization.object({ + edges: core.serialization.list(EntityEdge).optional(), + nodes: core.serialization.list(EntityNode).optional(), +}); + +export declare namespace GraphSearchResults { + interface Raw { + edges?: EntityEdge.Raw[] | null; + nodes?: EntityNode.Raw[] | null; + } +} diff --git a/src/serialization/types/GraphSearchScope.ts b/src/serialization/types/GraphSearchScope.ts new file mode 100644 index 0000000..72f435b --- /dev/null +++ b/src/serialization/types/GraphSearchScope.ts @@ -0,0 +1,14 @@ +/** + * 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 GraphSearchScope: core.serialization.Schema = + core.serialization.enum_(["edges", "nodes"]); + +export declare namespace GraphSearchScope { + type Raw = "edges" | "nodes"; +} diff --git a/src/serialization/types/Group.ts b/src/serialization/types/Group.ts new file mode 100644 index 0000000..c282ae0 --- /dev/null +++ b/src/serialization/types/Group.ts @@ -0,0 +1,29 @@ +/** + * 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 Group: core.serialization.ObjectSchema = core.serialization.object({ + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + description: core.serialization.string().optional(), + externalId: core.serialization.property("external_id", core.serialization.string().optional()), + id: core.serialization.number().optional(), + name: core.serialization.string().optional(), + projectUuid: core.serialization.property("project_uuid", core.serialization.string().optional()), + uuid: core.serialization.string().optional(), +}); + +export declare namespace Group { + interface Raw { + created_at?: string | null; + description?: string | null; + external_id?: string | null; + id?: number | null; + name?: string | null; + project_uuid?: string | null; + uuid?: string | null; + } +} diff --git a/src/serialization/types/Memory.ts b/src/serialization/types/Memory.ts index ec1dc29..707a700 100644 --- a/src/serialization/types/Memory.ts +++ b/src/serialization/types/Memory.ts @@ -14,7 +14,6 @@ export const Memory: core.serialization.ObjectSchema | null; relevant_facts?: Fact.Raw[] | null; - relevant_summaries?: Summary.Raw[] | null; summary?: Summary.Raw | null; } } diff --git a/src/serialization/types/MemoryType.ts b/src/serialization/types/MemoryType.ts deleted file mode 100644 index bf2f58e..0000000 --- a/src/serialization/types/MemoryType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 MemoryType: core.serialization.Schema = - core.serialization.enum_(["perpetual", "summary_retriever", "message_window"]); - -export declare namespace MemoryType { - type Raw = "perpetual" | "summary_retriever" | "message_window"; -} diff --git a/src/serialization/types/ModelsGraphDataType.ts b/src/serialization/types/ModelsGraphDataType.ts new file mode 100644 index 0000000..495907d --- /dev/null +++ b/src/serialization/types/ModelsGraphDataType.ts @@ -0,0 +1,16 @@ +/** + * 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 ModelsGraphDataType: core.serialization.Schema< + serializers.ModelsGraphDataType.Raw, + Zep.ModelsGraphDataType +> = core.serialization.enum_(["text", "json", "message"]); + +export declare namespace ModelsGraphDataType { + type Raw = "text" | "json" | "message"; +} diff --git a/src/serialization/types/AddedFact.ts b/src/serialization/types/NewFact.ts similarity index 63% rename from src/serialization/types/AddedFact.ts rename to src/serialization/types/NewFact.ts index a04e063..c2ab1ae 100644 --- a/src/serialization/types/AddedFact.ts +++ b/src/serialization/types/NewFact.ts @@ -6,12 +6,13 @@ import * as serializers from "../index"; import * as Zep from "../../api/index"; import * as core from "../../core"; -export const AddedFact: core.serialization.ObjectSchema = - core.serialization.object({ +export const NewFact: core.serialization.ObjectSchema = core.serialization.object( + { fact: core.serialization.string().optional(), - }); + } +); -export declare namespace AddedFact { +export declare namespace NewFact { interface Raw { fact?: string | null; } diff --git a/src/serialization/types/Reranker.ts b/src/serialization/types/Reranker.ts new file mode 100644 index 0000000..d2a905e --- /dev/null +++ b/src/serialization/types/Reranker.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 Reranker: core.serialization.Schema = core.serialization.enum_([ + "rrf", + "mmr", + "node_distance", + "episode_mentions", +]); + +export declare namespace Reranker { + type Raw = "rrf" | "mmr" | "node_distance" | "episode_mentions"; +} diff --git a/src/serialization/types/Session.ts b/src/serialization/types/Session.ts index cb201d4..7846876 100644 --- a/src/serialization/types/Session.ts +++ b/src/serialization/types/Session.ts @@ -5,7 +5,7 @@ import * as serializers from "../index"; import * as Zep from "../../api/index"; import * as core from "../../core"; -import { FactRatingInstruction } from "./FactRatingInstruction"; +import { SessionFactRatingInstruction } from "./SessionFactRatingInstruction"; export const Session: core.serialization.ObjectSchema = core.serialization.object( { @@ -13,8 +13,10 @@ export const Session: core.serialization.ObjectSchema | null; diff --git a/src/serialization/types/ClassifySessionResponse.ts b/src/serialization/types/SessionClassification.ts similarity index 54% rename from src/serialization/types/ClassifySessionResponse.ts rename to src/serialization/types/SessionClassification.ts index ab50b14..abc7435 100644 --- a/src/serialization/types/ClassifySessionResponse.ts +++ b/src/serialization/types/SessionClassification.ts @@ -6,17 +6,17 @@ import * as serializers from "../index"; import * as Zep from "../../api/index"; import * as core from "../../core"; -export const ClassifySessionResponse: core.serialization.ObjectSchema< - serializers.ClassifySessionResponse.Raw, - Zep.ClassifySessionResponse +export const SessionClassification: core.serialization.ObjectSchema< + serializers.SessionClassification.Raw, + Zep.SessionClassification > = core.serialization.object({ class: core.serialization.string().optional(), - name: core.serialization.string().optional(), + label: core.serialization.string().optional(), }); -export declare namespace ClassifySessionResponse { +export declare namespace SessionClassification { interface Raw { class?: string | null; - name?: string | null; + label?: string | null; } } diff --git a/src/serialization/types/SessionFactRatingExamples.ts b/src/serialization/types/SessionFactRatingExamples.ts new file mode 100644 index 0000000..c744eea --- /dev/null +++ b/src/serialization/types/SessionFactRatingExamples.ts @@ -0,0 +1,24 @@ +/** + * 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 SessionFactRatingExamples: core.serialization.ObjectSchema< + serializers.SessionFactRatingExamples.Raw, + Zep.SessionFactRatingExamples +> = core.serialization.object({ + high: core.serialization.string().optional(), + low: core.serialization.string().optional(), + medium: core.serialization.string().optional(), +}); + +export declare namespace SessionFactRatingExamples { + interface Raw { + high?: string | null; + low?: string | null; + medium?: string | null; + } +} diff --git a/src/serialization/types/SessionFactRatingInstruction.ts b/src/serialization/types/SessionFactRatingInstruction.ts new file mode 100644 index 0000000..e2b465c --- /dev/null +++ b/src/serialization/types/SessionFactRatingInstruction.ts @@ -0,0 +1,23 @@ +/** + * 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"; +import { SessionFactRatingExamples } from "./SessionFactRatingExamples"; + +export const SessionFactRatingInstruction: core.serialization.ObjectSchema< + serializers.SessionFactRatingInstruction.Raw, + Zep.SessionFactRatingInstruction +> = core.serialization.object({ + examples: SessionFactRatingExamples.optional(), + instruction: core.serialization.string().optional(), +}); + +export declare namespace SessionFactRatingInstruction { + interface Raw { + examples?: SessionFactRatingExamples.Raw | null; + instruction?: string | null; + } +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 064e1fa..a78f02d 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -1,35 +1,46 @@ export * from "./ApiError"; -export * from "./AddedFact"; -export * from "./ClassifySessionRequest"; -export * from "./ClassifySessionResponse"; -export * from "./CreateDocumentRequest"; -export * from "./DocumentCollectionResponse"; -export * from "./DocumentResponse"; -export * from "./DocumentSearchResult"; -export * from "./DocumentSearchResultPage"; +export * from "./ApidataDocument"; +export * from "./ApidataDocumentCollection"; +export * from "./ApidataDocumentSearchResponse"; +export * from "./ApidataDocumentWithScore"; export * from "./EndSessionResponse"; export * from "./EndSessionsResponse"; export * from "./Fact"; -export * from "./FactRatingExamples"; -export * from "./FactRatingInstruction"; export * from "./FactResponse"; export * from "./FactsResponse"; +export * from "./Group"; export * from "./Memory"; export * from "./MemorySearchResult"; export * from "./Message"; export * from "./MessageListResponse"; +export * from "./NewFact"; export * from "./Question"; export * from "./RoleType"; -export * from "./SearchScope"; -export * from "./SearchType"; export * from "./Session"; +export * from "./SessionClassification"; +export * from "./SessionFactRatingExamples"; +export * from "./SessionFactRatingInstruction"; export * from "./SessionListResponse"; export * from "./SessionSearchResponse"; export * from "./SessionSearchResult"; export * from "./SuccessResponse"; export * from "./Summary"; export * from "./SummaryListResponse"; -export * from "./UpdateDocumentListRequest"; export * from "./User"; export * from "./UserListResponse"; -export * from "./MemoryType"; +export * from "./EntityEdge"; +export * from "./EntityNode"; +export * from "./Episode"; +export * from "./EpisodeResponse"; +export * from "./EpisodeType"; +export * from "./GraphSearchResults"; +export * from "./GraphSearchScope"; +export * from "./Reranker"; +export * from "./ClassifySessionRequest"; +export * from "./CreateDocumentRequest"; +export * from "./FactRatingExamples"; +export * from "./FactRatingInstruction"; +export * from "./ModelsGraphDataType"; +export * from "./SearchScope"; +export * from "./SearchType"; +export * from "./UpdateDocumentListRequest";