@fencyai/js 0.1.83 → 0.1.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/lib/api/createChatCompletion.d.ts +1 -18
  2. package/lib/api/createStream.d.ts +0 -8
  3. package/lib/api/createStream.js +0 -8
  4. package/lib/api/listMemoryTypes.d.ts +6 -0
  5. package/lib/api/{searchFiles.js → listMemoryTypes.js} +5 -13
  6. package/lib/index.d.ts +3 -18
  7. package/lib/index.js +3 -24
  8. package/lib/loadFency.d.ts +1 -1
  9. package/lib/openapi/index.d.ts +4 -14
  10. package/lib/openapi/models/ListMemoryTypesResponse.d.ts +6 -0
  11. package/lib/openapi/models/{ChatCompletionDto.d.ts → PubChatCompletionDto.d.ts} +1 -1
  12. package/lib/openapi/models/{CreateChatCompletionRequest.d.ts → PubCreateChatCompletionRequest.d.ts} +1 -1
  13. package/lib/openapi/models/PubMemoryTypeDto.d.ts +5 -0
  14. package/lib/openapi/services/PubService.d.ts +9 -35
  15. package/lib/openapi/services/PubService.js +6 -49
  16. package/lib/types/CreateChatCompletionResponse.d.ts +9 -0
  17. package/lib/types/FencyInstance.d.ts +4 -0
  18. package/lib/types/FencyOptions.d.ts +6 -0
  19. package/lib/types/ListMemoryTypesResponse.d.ts +10 -0
  20. package/lib/types/index.d.ts +5 -13
  21. package/package.json +2 -2
  22. package/lib/api/createFile.d.ts +0 -16
  23. package/lib/api/createFile.js +0 -67
  24. package/lib/api/createWebsite.d.ts +0 -16
  25. package/lib/api/createWebsite.js +0 -46
  26. package/lib/api/listFiles.d.ts +0 -16
  27. package/lib/api/listFiles.js +0 -47
  28. package/lib/api/searchFiles.d.ts +0 -16
  29. package/lib/openapi/models/CreateFileFromPostRequestParams.d.ts +0 -5
  30. package/lib/openapi/models/CreateFileFromUrlParams.d.ts +0 -3
  31. package/lib/openapi/models/CreateWebsiteRequest.d.ts +0 -6
  32. package/lib/openapi/models/FileMatchingChunk.d.ts +0 -5
  33. package/lib/openapi/models/FileSearchItem.d.ts +0 -9
  34. package/lib/openapi/models/FileSearchResponse.d.ts +0 -4
  35. package/lib/openapi/models/ListFilesResponse.d.ts +0 -6
  36. package/lib/openapi/models/ListFilesResponse.js +0 -1
  37. package/lib/openapi/models/PubCreateFileRequest.d.ts +0 -8
  38. package/lib/openapi/models/PubCreateFileRequest.js +0 -1
  39. package/lib/openapi/models/PubFileDto.d.ts +0 -9
  40. package/lib/openapi/models/PubFileDto.js +0 -1
  41. package/lib/openapi/models/PubFileListDto.d.ts +0 -11
  42. package/lib/openapi/models/PubFileListDto.js +0 -1
  43. package/lib/openapi/models/PubWebsiteDto.d.ts +0 -5
  44. package/lib/openapi/models/PubWebsiteDto.js +0 -1
  45. package/lib/openapi/models/S3PostRequestDto.d.ts +0 -10
  46. package/lib/openapi/models/S3PostRequestDto.js +0 -1
  47. package/lib/types/CreateFileRequest.d.ts +0 -8
  48. package/lib/types/CreateFileRequest.js +0 -1
  49. package/lib/types/CreateFileResponse.d.ts +0 -9
  50. package/lib/types/CreateFileResponse.js +0 -1
  51. package/lib/types/CreateWebsiteRequest.d.ts +0 -6
  52. package/lib/types/CreateWebsiteRequest.js +0 -1
  53. package/lib/types/CreateWebsiteResponse.d.ts +0 -9
  54. package/lib/types/CreateWebsiteResponse.js +0 -1
  55. package/lib/types/FencyFile.d.ts +0 -11
  56. package/lib/types/FencyFile.js +0 -1
  57. package/lib/types/FencyListFileItem.d.ts +0 -11
  58. package/lib/types/FencyListFileItem.js +0 -1
  59. package/lib/types/FileSearchItem.d.ts +0 -8
  60. package/lib/types/FileSearchItem.js +0 -1
  61. package/lib/types/ListFilesRequest.d.ts +0 -6
  62. package/lib/types/ListFilesRequest.js +0 -1
  63. package/lib/types/ListFilesResponse.d.ts +0 -11
  64. package/lib/types/ListFilesResponse.js +0 -1
  65. package/lib/types/SearchFilesRequest.d.ts +0 -4
  66. package/lib/types/SearchFilesRequest.js +0 -1
  67. package/lib/types/SearchFilesResponse.d.ts +0 -9
  68. package/lib/types/SearchFilesResponse.js +0 -1
  69. package/lib/types/Website.d.ts +0 -7
  70. package/lib/types/Website.js +0 -1
  71. package/lib/types.d.ts +0 -17
  72. package/lib/types.js +0 -1
  73. /package/lib/openapi/models/{ChatCompletionDto.js → ListMemoryTypesResponse.js} +0 -0
  74. /package/lib/openapi/models/{CreateChatCompletionRequest.js → PubChatCompletionDto.js} +0 -0
  75. /package/lib/openapi/models/{CreateFileFromPostRequestParams.js → PubCreateChatCompletionRequest.js} +0 -0
  76. /package/lib/openapi/models/{CreateFileFromUrlParams.js → PubMemoryTypeDto.js} +0 -0
  77. /package/lib/{openapi/models/CreateWebsiteRequest.js → types/CreateChatCompletionResponse.js} +0 -0
  78. /package/lib/{openapi/models/FileMatchingChunk.js → types/FencyInstance.js} +0 -0
  79. /package/lib/{openapi/models/FileSearchItem.js → types/FencyOptions.js} +0 -0
  80. /package/lib/{openapi/models/FileSearchResponse.js → types/ListMemoryTypesResponse.js} +0 -0
@@ -1,22 +1,5 @@
1
- import { ApiError } from '../types/ApiError';
2
- import { ChatCompletion } from '../types/ChatCompletion';
1
+ import { CreateChatCompletionResponse } from '..';
3
2
  import { CreateChatCompletionRequest } from '../types/CreateChatCompletionRequest';
4
- /**
5
- * Creates a chat completion by making a POST request to the Fency API.
6
- *
7
- * @param pk - The publishable key (used as Bearer token)
8
- * @param streamId - The stream ID to associate with the chat completion
9
- * @param options - Optional configuration (apiUrl, request overrides)
10
- * @returns A promise that resolves to a ChatCompletionResponse
11
- * @throws Error if the request fails or the response is invalid
12
- */
13
- export type CreateChatCompletionResponse = {
14
- type: 'success';
15
- completion: ChatCompletion;
16
- } | {
17
- type: 'error';
18
- error: ApiError;
19
- };
20
3
  export declare function createChatCompletion(params: {
21
4
  pk: string;
22
5
  request: CreateChatCompletionRequest;
@@ -1,13 +1,5 @@
1
1
  import { CreateStreamRequest } from '../types/CreateStreamRequest';
2
2
  import { CreateStreamResponse } from '../types/CreateStreamResponse';
3
- /**
4
- * Creates a new stream by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token and default name)
7
- * @param options - Optional configuration (apiUrl, name)
8
- * @returns A promise that resolves to a Stream
9
- * @throws Error if the request fails or the response is invalid
10
- */
11
3
  export declare function createStream(params: {
12
4
  pk: string;
13
5
  request: CreateStreamRequest;
@@ -1,13 +1,5 @@
1
1
  import { OpenAPI, PubService, StreamType } from '../openapi';
2
2
  import { getPackageVersion } from '../utils/version';
3
- /**
4
- * Creates a new stream by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token and default name)
7
- * @param options - Optional configuration (apiUrl, name)
8
- * @returns A promise that resolves to a Stream
9
- * @throws Error if the request fails or the response is invalid
10
- */
11
3
  export async function createStream(params) {
12
4
  try {
13
5
  OpenAPI.BASE = params.baseUrl;
@@ -0,0 +1,6 @@
1
+ import { ListMemoryTypesResponse } from '../types';
2
+ export declare function listMemoryTypes(params: {
3
+ pk: string;
4
+ clientSecret: string;
5
+ baseUrl: string;
6
+ }): Promise<ListMemoryTypesResponse>;
@@ -1,27 +1,19 @@
1
1
  import { OpenAPI, PubService } from '../openapi';
2
2
  import { getPackageVersion } from '../utils/version';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export async function searchFiles(params) {
3
+ export async function listMemoryTypes(params) {
13
4
  try {
14
5
  OpenAPI.BASE = params.baseUrl;
15
6
  OpenAPI.HEADERS = {
16
7
  'Content-Type': 'application/json',
17
8
  Authorization: `Bearer ${params.pk}`,
18
9
  'X-Fency-Sdk-Version': getPackageVersion(),
19
- 'X-Fency-Client-Secret': params.request.clientSecret,
10
+ 'X-Fency-Client-Secret': params.clientSecret,
20
11
  };
21
- const response = await PubService.searchFiles(params.request.text);
12
+ const response = await PubService.listMemoryTypes();
22
13
  return {
23
14
  type: 'success',
24
- results: response.results,
15
+ items: response.items,
16
+ pagination: response.pagination,
25
17
  };
26
18
  }
27
19
  catch (error) {
package/lib/index.d.ts CHANGED
@@ -1,22 +1,7 @@
1
- import { createChatCompletion } from './api/createChatCompletion';
2
- import { createStream } from './api/createStream';
3
- import { loadFency } from './loadFency';
1
+ export { loadFency } from './loadFency';
4
2
  export type { FencyInstance, FencyOptions } from './types';
5
3
  export * from './types/index';
4
+ export type { ChatCompletionStreamCompletedEventDto, FileTextContentReadyEventDto, FileUploadCompletedEventDto, NewChatCompletionStreamChunkEventDto, StreamNotFoundEventDto, StreamTimeoutEventDto, WebsiteHtmlContentReadyEventDto, WebsiteTextContentReadyEventDto, } from './openapi';
6
5
  export { createChatCompletion } from './api/createChatCompletion';
7
- export type { CreateChatCompletionResponse } from './api/createChatCompletion';
8
- export { searchFiles } from './api/searchFiles';
9
- export type { FileSearchItem, FileSearchResponse } from './openapi';
10
- export { createFile } from './api/createFile';
11
- export type { S3PostRequestDto } from './openapi';
12
6
  export { createStream } from './api/createStream';
13
- export type { ChatCompletionStreamCompletedEventDto, FileTextContentReadyEventDto, FileUploadCompletedEventDto, NewChatCompletionStreamChunkEventDto, StreamNotFoundEventDto, StreamTimeoutEventDto, WebsiteHtmlContentReadyEventDto, WebsiteTextContentReadyEventDto, } from './openapi';
14
- export { listFiles } from './api/listFiles';
15
- export { createWebsite } from './api/createWebsite';
16
- export { loadFency } from './loadFency';
17
- declare const _default: {
18
- loadFency: typeof loadFency;
19
- createChatCompletion: typeof createChatCompletion;
20
- createStream: typeof createStream;
21
- };
22
- export default _default;
7
+ export { listMemoryTypes } from './api/listMemoryTypes';
package/lib/index.js CHANGED
@@ -1,27 +1,6 @@
1
- // Core Fency library - equivalent to @stripe/stripe-js
2
- // This is the base library that provides the loadFency method
3
- // Import main functions
4
- import { createChatCompletion } from './api/createChatCompletion';
5
- import { createStream } from './api/createStream';
6
- import { loadFency } from './loadFency';
1
+ export { loadFency } from './loadFency';
7
2
  export * from './types/index';
8
- // create chat completion
3
+ // api
9
4
  export { createChatCompletion } from './api/createChatCompletion';
10
- // search files
11
- export { searchFiles } from './api/searchFiles';
12
- // uploads
13
- export { createFile } from './api/createFile';
14
- // create chat completion stre am
15
5
  export { createStream } from './api/createStream';
16
- // list files
17
- export { listFiles } from './api/listFiles';
18
- // create website
19
- export { createWebsite } from './api/createWebsite';
20
- // load fency
21
- export { loadFency } from './loadFency';
22
- // Default export for convenience
23
- export default {
24
- loadFency,
25
- createChatCompletion,
26
- createStream,
27
- };
6
+ export { listMemoryTypes } from './api/listMemoryTypes';
@@ -1,4 +1,4 @@
1
- import { FencyInstance, FencyOptions } from './types.js';
1
+ import { FencyInstance, FencyOptions } from './types';
2
2
  /**
3
3
  * Loads the Fency library with the given publishable key.
4
4
  * This method should be called outside of a component's render to avoid
@@ -3,34 +3,24 @@ export { CancelablePromise, CancelError } from './core/CancelablePromise';
3
3
  export { OpenAPI } from './core/OpenAPI';
4
4
  export type { OpenAPIConfig } from './core/OpenAPI';
5
5
  export { ApiDtoType } from './models/ApiDtoType';
6
- export type { ChatCompletionDto } from './models/ChatCompletionDto';
7
6
  export type { ChatCompletionStreamCompletedEventDto } from './models/ChatCompletionStreamCompletedEventDto';
8
- export type { CreateChatCompletionRequest } from './models/CreateChatCompletionRequest';
9
7
  export type { CreateChatCompletionStreamRequest } from './models/CreateChatCompletionStreamRequest';
10
8
  export type { CreateClaudeChatCompletionDto } from './models/CreateClaudeChatCompletionDto';
11
9
  export type { CreateClaudeChatCompletionMessageDto } from './models/CreateClaudeChatCompletionMessageDto';
12
- export type { CreateFileFromPostRequestParams } from './models/CreateFileFromPostRequestParams';
13
- export type { CreateFileFromUrlParams } from './models/CreateFileFromUrlParams';
14
10
  export type { CreateGeminiChatCompletionDto } from './models/CreateGeminiChatCompletionDto';
15
11
  export type { CreateGeminiChatCompletionMessageDto } from './models/CreateGeminiChatCompletionMessageDto';
16
12
  export type { CreateOpenAiChatCompletionDto } from './models/CreateOpenAiChatCompletionDto';
17
13
  export type { CreateOpenAiChatCompletionMessageDto } from './models/CreateOpenAiChatCompletionMessageDto';
18
14
  export type { CreateStreamRequest } from './models/CreateStreamRequest';
19
- export type { CreateWebsiteRequest } from './models/CreateWebsiteRequest';
20
- export type { FileMatchingChunk } from './models/FileMatchingChunk';
21
15
  export type { FileSearchIndexReadyEventDto } from './models/FileSearchIndexReadyEventDto';
22
- export type { FileSearchItem } from './models/FileSearchItem';
23
- export type { FileSearchResponse } from './models/FileSearchResponse';
24
16
  export type { FileTextContentReadyEventDto } from './models/FileTextContentReadyEventDto';
25
17
  export type { FileUploadCompletedEventDto } from './models/FileUploadCompletedEventDto';
26
- export type { ListFilesResponse } from './models/ListFilesResponse';
18
+ export type { ListMemoryTypesResponse } from './models/ListMemoryTypesResponse';
27
19
  export type { NewChatCompletionStreamChunkEventDto } from './models/NewChatCompletionStreamChunkEventDto';
28
20
  export type { PaginationDto } from './models/PaginationDto';
29
- export type { PubCreateFileRequest } from './models/PubCreateFileRequest';
30
- export type { PubFileDto } from './models/PubFileDto';
31
- export type { PubFileListDto } from './models/PubFileListDto';
32
- export type { PubWebsiteDto } from './models/PubWebsiteDto';
33
- export type { S3PostRequestDto } from './models/S3PostRequestDto';
21
+ export type { PubChatCompletionDto } from './models/PubChatCompletionDto';
22
+ export type { PubCreateChatCompletionRequest } from './models/PubCreateChatCompletionRequest';
23
+ export type { PubMemoryTypeDto } from './models/PubMemoryTypeDto';
34
24
  export type { StreamDto } from './models/StreamDto';
35
25
  export { StreamEventType } from './models/StreamEventType';
36
26
  export type { StreamNotFoundEventDto } from './models/StreamNotFoundEventDto';
@@ -0,0 +1,6 @@
1
+ import type { PaginationDto } from './PaginationDto';
2
+ import type { PubMemoryTypeDto } from './PubMemoryTypeDto';
3
+ export type ListMemoryTypesResponse = {
4
+ items: Array<PubMemoryTypeDto>;
5
+ pagination: PaginationDto;
6
+ };
@@ -1,5 +1,5 @@
1
1
  import type { ApiDtoType } from './ApiDtoType';
2
- export type ChatCompletionDto = {
2
+ export type PubChatCompletionDto = {
3
3
  id: string;
4
4
  createdAt: string;
5
5
  type: ApiDtoType;
@@ -1,7 +1,7 @@
1
1
  import type { CreateClaudeChatCompletionDto } from './CreateClaudeChatCompletionDto';
2
2
  import type { CreateGeminiChatCompletionDto } from './CreateGeminiChatCompletionDto';
3
3
  import type { CreateOpenAiChatCompletionDto } from './CreateOpenAiChatCompletionDto';
4
- export type CreateChatCompletionRequest = {
4
+ export type PubCreateChatCompletionRequest = {
5
5
  streamId?: string | null;
6
6
  sessionClientSecret?: string | null;
7
7
  openai?: CreateOpenAiChatCompletionDto;
@@ -0,0 +1,5 @@
1
+ export type PubMemoryTypeDto = {
2
+ id: string;
3
+ createdAt: string;
4
+ name: string;
5
+ };
@@ -1,17 +1,12 @@
1
- import type { ChatCompletionDto } from '../models/ChatCompletionDto';
2
1
  import type { ChatCompletionStreamCompletedEventDto } from '../models/ChatCompletionStreamCompletedEventDto';
3
- import type { CreateChatCompletionRequest } from '../models/CreateChatCompletionRequest';
4
2
  import type { CreateStreamRequest } from '../models/CreateStreamRequest';
5
- import type { CreateWebsiteRequest } from '../models/CreateWebsiteRequest';
6
3
  import type { FileSearchIndexReadyEventDto } from '../models/FileSearchIndexReadyEventDto';
7
- import type { FileSearchResponse } from '../models/FileSearchResponse';
8
4
  import type { FileTextContentReadyEventDto } from '../models/FileTextContentReadyEventDto';
9
5
  import type { FileUploadCompletedEventDto } from '../models/FileUploadCompletedEventDto';
10
- import type { ListFilesResponse } from '../models/ListFilesResponse';
6
+ import type { ListMemoryTypesResponse } from '../models/ListMemoryTypesResponse';
11
7
  import type { NewChatCompletionStreamChunkEventDto } from '../models/NewChatCompletionStreamChunkEventDto';
12
- import type { PubCreateFileRequest } from '../models/PubCreateFileRequest';
13
- import type { PubFileDto } from '../models/PubFileDto';
14
- import type { PubWebsiteDto } from '../models/PubWebsiteDto';
8
+ import type { PubChatCompletionDto } from '../models/PubChatCompletionDto';
9
+ import type { PubCreateChatCompletionRequest } from '../models/PubCreateChatCompletionRequest';
15
10
  import type { StreamDto } from '../models/StreamDto';
16
11
  import type { StreamNotFoundEventDto } from '../models/StreamNotFoundEventDto';
17
12
  import type { StreamTimeoutEventDto } from '../models/StreamTimeoutEventDto';
@@ -20,35 +15,21 @@ import type { WebsiteTextContentReadyEventDto } from '../models/WebsiteTextConte
20
15
  import type { CancelablePromise } from '../core/CancelablePromise';
21
16
  export declare class PubService {
22
17
  /**
23
- * Create Chat Completion
18
+ * Create ChatCompletion
24
19
  * @param requestBody
25
- * @returns any OK
20
+ * @returns PubChatCompletionDto OK
26
21
  * @throws ApiError
27
22
  */
28
- static createChatCompletion(requestBody: CreateChatCompletionRequest): CancelablePromise<ChatCompletionDto>;
23
+ static createChatCompletion(requestBody: PubCreateChatCompletionRequest): CancelablePromise<PubChatCompletionDto>;
29
24
  /**
30
- * List files
25
+ * List Memory Types
31
26
  * @param nextPageToken
32
27
  * @param previousPageToken
33
28
  * @param limit
34
- * @returns ListFilesResponse OK
35
- * @throws ApiError
36
- */
37
- static listFiles(nextPageToken?: string, previousPageToken?: string, limit?: number): CancelablePromise<ListFilesResponse>;
38
- /**
39
- * Create File
40
- * @param requestBody
41
- * @returns PubFileDto Created
42
- * @throws ApiError
43
- */
44
- static createFile(requestBody: PubCreateFileRequest): CancelablePromise<PubFileDto>;
45
- /**
46
- * Search files
47
- * @param text
48
- * @returns FileSearchResponse OK
29
+ * @returns ListMemoryTypesResponse OK
49
30
  * @throws ApiError
50
31
  */
51
- static searchFiles(text: string): CancelablePromise<FileSearchResponse>;
32
+ static listMemoryTypes(nextPageToken?: string, previousPageToken?: string, limit?: number): CancelablePromise<ListMemoryTypesResponse>;
52
33
  /**
53
34
  * Create Chat Completion Stream
54
35
  * @param requestBody
@@ -62,11 +43,4 @@ export declare class PubService {
62
43
  * @throws ApiError
63
44
  */
64
45
  static getPubTypes(): CancelablePromise<(StreamTimeoutEventDto | StreamNotFoundEventDto | NewChatCompletionStreamChunkEventDto | ChatCompletionStreamCompletedEventDto | FileUploadCompletedEventDto | FileTextContentReadyEventDto | WebsiteHtmlContentReadyEventDto | WebsiteTextContentReadyEventDto | FileSearchIndexReadyEventDto)>;
65
- /**
66
- * Create Website
67
- * @param requestBody
68
- * @returns PubWebsiteDto Created
69
- * @throws ApiError
70
- */
71
- static createWebsite(requestBody: CreateWebsiteRequest): CancelablePromise<PubWebsiteDto>;
72
46
  }
@@ -2,9 +2,9 @@ import { OpenAPI } from '../core/OpenAPI';
2
2
  import { request as __request } from '../core/request';
3
3
  export class PubService {
4
4
  /**
5
- * Create Chat Completion
5
+ * Create ChatCompletion
6
6
  * @param requestBody
7
- * @returns any OK
7
+ * @returns PubChatCompletionDto OK
8
8
  * @throws ApiError
9
9
  */
10
10
  static createChatCompletion(requestBody) {
@@ -16,17 +16,17 @@ export class PubService {
16
16
  });
17
17
  }
18
18
  /**
19
- * List files
19
+ * List Memory Types
20
20
  * @param nextPageToken
21
21
  * @param previousPageToken
22
22
  * @param limit
23
- * @returns ListFilesResponse OK
23
+ * @returns ListMemoryTypesResponse OK
24
24
  * @throws ApiError
25
25
  */
26
- static listFiles(nextPageToken, previousPageToken, limit) {
26
+ static listMemoryTypes(nextPageToken, previousPageToken, limit) {
27
27
  return __request(OpenAPI, {
28
28
  method: 'GET',
29
- url: '/v1/pub/files',
29
+ url: '/v1/pub/memory-types',
30
30
  query: {
31
31
  'nextPageToken': nextPageToken,
32
32
  'previousPageToken': previousPageToken,
@@ -34,35 +34,6 @@ export class PubService {
34
34
  },
35
35
  });
36
36
  }
37
- /**
38
- * Create File
39
- * @param requestBody
40
- * @returns PubFileDto Created
41
- * @throws ApiError
42
- */
43
- static createFile(requestBody) {
44
- return __request(OpenAPI, {
45
- method: 'POST',
46
- url: '/v1/pub/files',
47
- body: requestBody,
48
- mediaType: 'application/json',
49
- });
50
- }
51
- /**
52
- * Search files
53
- * @param text
54
- * @returns FileSearchResponse OK
55
- * @throws ApiError
56
- */
57
- static searchFiles(text) {
58
- return __request(OpenAPI, {
59
- method: 'GET',
60
- url: '/v1/pub/files/search',
61
- query: {
62
- 'text': text,
63
- },
64
- });
65
- }
66
37
  /**
67
38
  * Create Chat Completion Stream
68
39
  * @param requestBody
@@ -88,18 +59,4 @@ export class PubService {
88
59
  url: '/v1/pub/types',
89
60
  });
90
61
  }
91
- /**
92
- * Create Website
93
- * @param requestBody
94
- * @returns PubWebsiteDto Created
95
- * @throws ApiError
96
- */
97
- static createWebsite(requestBody) {
98
- return __request(OpenAPI, {
99
- method: 'POST',
100
- url: '/v1/pub/websites',
101
- body: requestBody,
102
- mediaType: 'application/json',
103
- });
104
- }
105
62
  }
@@ -0,0 +1,9 @@
1
+ import { ApiError } from './ApiError';
2
+ import { ChatCompletion } from './ChatCompletion';
3
+ export type CreateChatCompletionResponse = {
4
+ type: 'success';
5
+ completion: ChatCompletion;
6
+ } | {
7
+ type: 'error';
8
+ error: ApiError;
9
+ };
@@ -0,0 +1,4 @@
1
+ export interface FencyInstance {
2
+ publishableKey: string;
3
+ baseUrl: string;
4
+ }
@@ -0,0 +1,6 @@
1
+ export interface FencyOptions {
2
+ /** Your Fency publishable key */
3
+ publishableKey: string;
4
+ /** Optional configuration for the Fency instance */
5
+ baseUrl?: string;
6
+ }
@@ -0,0 +1,10 @@
1
+ import { PaginationDto, PubMemoryTypeDto } from '../openapi';
2
+ import { ApiError } from './ApiError';
3
+ export type ListMemoryTypesResponse = {
4
+ type: 'success';
5
+ items: PubMemoryTypeDto[];
6
+ pagination: PaginationDto;
7
+ } | {
8
+ type: 'error';
9
+ error: ApiError;
10
+ };
@@ -1,29 +1,21 @@
1
1
  export type { AnthropicModel } from './AnthropicModel';
2
2
  export type { ApiError } from './ApiError';
3
- export type { ChatCompletion } from './ChatCompletion';
4
3
  export { isChatCompletion } from './ChatCompletion';
4
+ export type { ChatCompletion } from './ChatCompletion';
5
5
  export type { ChatCompletionMessage } from './ChatCompletionMessage';
6
6
  export type { ClaudeChatCompletionMessage } from './ClaudeChatCompletionMessage';
7
7
  export type { CreateChatCompletionRequest } from './CreateChatCompletionRequest';
8
8
  export type { CreateClaudeChatCompletionRequestParams } from './CreateClaudeChatCompletionRequestParams';
9
- export type { CreateFileRequest } from './CreateFileRequest';
10
- export type { CreateFileResponse } from './CreateFileResponse';
11
9
  export type { CreateGeminiChatCompletionRequestParams } from './CreateGeminiChatCompletionRequestParams';
12
10
  export type { CreateOpenAiChatCompletionRequestParams } from './CreateOpenAiChatCompletionRequestParams';
13
11
  export type { CreateStreamRequest } from './CreateStreamRequest';
14
12
  export type { CreateStreamResponse } from './CreateStreamResponse';
15
- export type { CreateWebsiteRequest } from './CreateWebsiteRequest';
16
- export type { CreateWebsiteResponse } from './CreateWebsiteResponse';
17
- export type { FencyFile } from './FencyFile';
18
- export type { FencyListFileItem } from './FencyListFileItem';
19
- export type { FileSearchItem } from './FileSearchItem';
20
13
  export type { GeminiChatCompletionMessage } from './GeminiChatCompletionMessage';
21
14
  export type { GeminiModel } from './GeminiModel';
22
- export type { ListFilesRequest } from './ListFilesRequest';
23
- export type { ListFilesResponse } from './ListFilesResponse';
24
15
  export type { OpenAiModel } from './OpenAiModel';
25
16
  export type { S3PostRequest } from './S3PostRequest';
26
- export type { SearchFilesRequest } from './SearchFilesRequest';
27
- export type { SearchFilesResponse } from './SearchFilesResponse';
28
17
  export type { Stream } from './Stream';
29
- export type { Website } from './Website';
18
+ export type { ListMemoryTypesResponse } from './ListMemoryTypesResponse';
19
+ export type { CreateChatCompletionResponse } from './CreateChatCompletionResponse';
20
+ export type { FencyInstance } from './FencyInstance';
21
+ export type { FencyOptions } from './FencyOptions';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fencyai/js",
3
- "version": "0.1.83",
3
+ "version": "0.1.84",
4
4
  "description": "> TODO: description",
5
5
  "author": "staklau <steinaageklaussen@gmail.com>",
6
6
  "homepage": "",
@@ -42,5 +42,5 @@
42
42
  "ts-jest": "^29.1.1",
43
43
  "typescript": "^5.3.3"
44
44
  },
45
- "gitHead": "1d219106b354fb15ad73f96a5f50244a7dcde26a"
45
+ "gitHead": "2097d91c002c61a2dcfcaafbe0407458dbb88739"
46
46
  }
@@ -1,16 +0,0 @@
1
- import { CreateFileRequest } from '../types/CreateFileRequest';
2
- import { CreateFileResponse } from '../types/CreateFileResponse';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export declare function createFile(params: {
13
- pk: string;
14
- request: CreateFileRequest;
15
- baseUrl: string;
16
- }): Promise<CreateFileResponse>;
@@ -1,67 +0,0 @@
1
- import { OpenAPI, PubService } from '../openapi';
2
- import { getPackageVersion } from '../utils/version';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export async function createFile(params) {
13
- try {
14
- OpenAPI.BASE = params.baseUrl;
15
- OpenAPI.HEADERS = {
16
- 'Content-Type': 'application/json',
17
- Authorization: `Bearer ${params.pk}`,
18
- 'X-Fency-Sdk-Version': getPackageVersion(),
19
- ...(params.request.clientSecret
20
- ? { 'X-Fency-Client-Secret': params.request.clientSecret }
21
- : {}),
22
- };
23
- const response = await PubService.createFile({
24
- streamId: params.request.streamId,
25
- createFromPostRequestParams: {
26
- fileName: params.request.fileName,
27
- mimeType: params.request.fileType,
28
- fileSize: params.request.fileSize,
29
- },
30
- extractTextContent: params.request.extractTextContent,
31
- });
32
- if (!response.s3PostRequest) {
33
- throw new Error('S3 post request not found');
34
- }
35
- return {
36
- type: 'success',
37
- file: {
38
- id: response.id,
39
- createdAt: response.createdAt,
40
- size: response.size ?? null,
41
- type: response.type ?? null,
42
- name: response.name ?? null,
43
- content: null,
44
- text: null,
45
- s3PostRequest: {
46
- xAmzDate: response.s3PostRequest.amzDate,
47
- xAmzSignature: response.s3PostRequest.amzSignature,
48
- xAmzAlgorithm: response.s3PostRequest.amzAlgorithm,
49
- xAmzCredential: response.s3PostRequest.amzCredential,
50
- policy: response.s3PostRequest.policy,
51
- key: response.s3PostRequest.key,
52
- uploadUrl: response.s3PostRequest.uploadUrl,
53
- sessionToken: response.s3PostRequest.sessionToken,
54
- },
55
- },
56
- };
57
- }
58
- catch (error) {
59
- return {
60
- type: 'error',
61
- error: {
62
- code: 'UnknownError',
63
- message: `Unknown error!\n${error ? `Error: ${error}\n` : ''}`.trim(),
64
- },
65
- };
66
- }
67
- }
@@ -1,16 +0,0 @@
1
- import { CreateWebsiteRequest } from '../types/CreateWebsiteRequest';
2
- import { CreateWebsiteResponse } from '../types/CreateWebsiteResponse';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export declare function createWebsite(params: {
13
- pk: string;
14
- request: CreateWebsiteRequest;
15
- baseUrl: string;
16
- }): Promise<CreateWebsiteResponse>;
@@ -1,46 +0,0 @@
1
- import { OpenAPI, PubService } from '../openapi';
2
- import { getPackageVersion } from '../utils/version';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export async function createWebsite(params) {
13
- try {
14
- OpenAPI.BASE = params.baseUrl;
15
- OpenAPI.HEADERS = {
16
- 'Content-Type': 'application/json',
17
- Authorization: `Bearer ${params.pk}`,
18
- 'X-Fency-Sdk-Version': getPackageVersion(),
19
- };
20
- const response = await PubService.createWebsite({
21
- url: params.request.url,
22
- streamId: params.request.streamId,
23
- extractHtmlContent: params.request.extractHtmlContent,
24
- extractTextContent: params.request.extractTextContent,
25
- });
26
- return {
27
- type: 'success',
28
- website: {
29
- id: response.id,
30
- createdAt: response.createdAt,
31
- url: response.url,
32
- content: null,
33
- text: null,
34
- },
35
- };
36
- }
37
- catch (error) {
38
- return {
39
- type: 'error',
40
- error: {
41
- code: 'UnknownError',
42
- message: `Unknown error!\n${error ? `Error: ${error}\n` : ''}`.trim(),
43
- },
44
- };
45
- }
46
- }
@@ -1,16 +0,0 @@
1
- import { ListFilesRequest } from '../types/ListFilesRequest';
2
- import { ListFilesResponse } from '../types/ListFilesResponse';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export declare function listFiles(params: {
13
- pk: string;
14
- request: ListFilesRequest;
15
- baseUrl: string;
16
- }): Promise<ListFilesResponse>;
@@ -1,47 +0,0 @@
1
- import { OpenAPI, PubService } from '../openapi';
2
- import { getPackageVersion } from '../utils/version';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export async function listFiles(params) {
13
- try {
14
- OpenAPI.BASE = params.baseUrl;
15
- OpenAPI.HEADERS = {
16
- 'Content-Type': 'application/json',
17
- Authorization: `Bearer ${params.pk}`,
18
- 'X-Fency-Sdk-Version': getPackageVersion(),
19
- 'X-Fency-Client-Secret': params.request.clientSecret,
20
- };
21
- const response = await PubService.listFiles(params.request.pagination?.nextPageToken ?? undefined, params.request.pagination?.previousPageToken ?? undefined, params.request.limit);
22
- return {
23
- type: 'success',
24
- items: response.items.map((item) => ({
25
- id: item.id,
26
- createdAt: item.createdAt,
27
- size: item.size ?? null,
28
- type: item.type ?? null,
29
- name: item.name ?? null,
30
- tags: item.tags,
31
- contentReady: item.contentReady,
32
- textReady: item.textReady,
33
- searchIndexReady: item.searchIndexReady,
34
- })),
35
- pagination: response.pagination,
36
- };
37
- }
38
- catch (error) {
39
- return {
40
- type: 'error',
41
- error: {
42
- code: 'UNKNOWN_ERROR',
43
- message: `Unknown error!\n${error ? `Error: ${error}\n` : ''}`.trim(),
44
- },
45
- };
46
- }
47
- }
@@ -1,16 +0,0 @@
1
- import { SearchFilesRequest } from '../types/SearchFilesRequest';
2
- import { SearchFilesResponse } from '../types/SearchFilesResponse';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export declare function searchFiles(params: {
13
- pk: string;
14
- request: SearchFilesRequest;
15
- baseUrl: string;
16
- }): Promise<SearchFilesResponse>;
@@ -1,5 +0,0 @@
1
- export type CreateFileFromPostRequestParams = {
2
- fileName: string;
3
- mimeType: string;
4
- fileSize: number;
5
- };
@@ -1,3 +0,0 @@
1
- export type CreateFileFromUrlParams = {
2
- url: string;
3
- };
@@ -1,6 +0,0 @@
1
- export type CreateWebsiteRequest = {
2
- url: string;
3
- streamId: string;
4
- extractHtmlContent: boolean;
5
- extractTextContent: boolean;
6
- };
@@ -1,5 +0,0 @@
1
- export type FileMatchingChunk = {
2
- pageNumbers: Array<number>;
3
- score: number;
4
- text: string;
5
- };
@@ -1,9 +0,0 @@
1
- import type { FileMatchingChunk } from './FileMatchingChunk';
2
- export type FileSearchItem = {
3
- fileId: string;
4
- fileName?: string | null;
5
- fileType?: string | null;
6
- fileSize?: number | null;
7
- matchingChunks: Array<FileMatchingChunk>;
8
- highestChunkScore: number;
9
- };
@@ -1,4 +0,0 @@
1
- import type { FileSearchItem } from './FileSearchItem';
2
- export type FileSearchResponse = {
3
- results: Array<FileSearchItem>;
4
- };
@@ -1,6 +0,0 @@
1
- import type { PaginationDto } from './PaginationDto';
2
- import type { PubFileListDto } from './PubFileListDto';
3
- export type ListFilesResponse = {
4
- items: Array<PubFileListDto>;
5
- pagination: PaginationDto;
6
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import type { CreateFileFromPostRequestParams } from './CreateFileFromPostRequestParams';
2
- import type { CreateFileFromUrlParams } from './CreateFileFromUrlParams';
3
- export type PubCreateFileRequest = {
4
- streamId: string;
5
- createFromPostRequestParams?: CreateFileFromPostRequestParams;
6
- createFromUrlParams?: CreateFileFromUrlParams;
7
- extractTextContent: boolean;
8
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import type { S3PostRequestDto } from './S3PostRequestDto';
2
- export type PubFileDto = {
3
- id: string;
4
- createdAt: string;
5
- size?: number | null;
6
- type?: string | null;
7
- name?: string | null;
8
- s3PostRequest?: S3PostRequestDto;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- export type PubFileListDto = {
2
- id: string;
3
- createdAt: string;
4
- size?: number | null;
5
- type?: string | null;
6
- name?: string | null;
7
- tags: Array<string>;
8
- contentReady: boolean;
9
- textReady: boolean;
10
- searchIndexReady: boolean;
11
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export type PubWebsiteDto = {
2
- id: string;
3
- createdAt: string;
4
- url: string;
5
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- export type S3PostRequestDto = {
2
- amzDate: string;
3
- amzSignature: string;
4
- amzAlgorithm: string;
5
- amzCredential: string;
6
- policy: string;
7
- key: string;
8
- uploadUrl: string;
9
- sessionToken: string;
10
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export interface CreateFileRequest {
2
- streamId: string;
3
- fileName: string;
4
- fileType: string;
5
- fileSize: number;
6
- extractTextContent: boolean;
7
- clientSecret?: string;
8
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import { ApiError } from './ApiError';
2
- import { FencyFile } from './FencyFile';
3
- export type CreateFileResponse = {
4
- type: 'success';
5
- file: FencyFile;
6
- } | {
7
- type: 'error';
8
- error: ApiError;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export interface CreateWebsiteRequest {
2
- url: string;
3
- streamId: string;
4
- extractHtmlContent: boolean;
5
- extractTextContent: boolean;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import { ApiError } from './ApiError';
2
- import { Website } from './Website';
3
- export type CreateWebsiteResponse = {
4
- type: 'success';
5
- website: Website;
6
- } | {
7
- type: 'error';
8
- error: ApiError;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import { S3PostRequest } from "./S3PostRequest";
2
- export interface FencyFile {
3
- id: string;
4
- createdAt: string;
5
- size: number | null;
6
- type: string | null;
7
- name: string | null;
8
- content: string | null;
9
- text: string | null;
10
- s3PostRequest: S3PostRequest;
11
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- export interface FencyListFileItem {
2
- id: string;
3
- createdAt: string;
4
- size: number | null;
5
- type: string | null;
6
- name: string | null;
7
- tags: string[];
8
- contentReady: boolean;
9
- textReady: boolean;
10
- searchIndexReady: boolean;
11
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export interface FileSearchItem {
2
- id: string;
3
- createdAt: string;
4
- fileName: string;
5
- mimeType: string;
6
- fileSize: number;
7
- text: string | null;
8
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { PaginationDto } from "../openapi";
2
- export interface ListFilesRequest {
3
- pagination?: PaginationDto;
4
- limit: number;
5
- clientSecret: string;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import { PaginationDto } from '../openapi';
2
- import { ApiError } from './ApiError';
3
- import { FencyListFileItem } from './FencyListFileItem';
4
- export type ListFilesResponse = {
5
- type: 'success';
6
- items: FencyListFileItem[];
7
- pagination: PaginationDto;
8
- } | {
9
- type: 'error';
10
- error: ApiError;
11
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- export interface SearchFilesRequest {
2
- text: string;
3
- clientSecret: string;
4
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import { FileSearchItem } from '../openapi';
2
- import { ApiError } from './ApiError';
3
- export type SearchFilesResponse = {
4
- type: 'success';
5
- results: FileSearchItem[];
6
- } | {
7
- type: 'error';
8
- error: ApiError;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- export type Website = {
2
- id: string;
3
- createdAt: string;
4
- url: string;
5
- content: string | null;
6
- text: string | null;
7
- };
@@ -1 +0,0 @@
1
- export {};
package/lib/types.d.ts DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * Configuration options for Fency
3
- */
4
- export interface FencyOptions {
5
- /** Your Fency publishable key */
6
- publishableKey: string;
7
- /** Optional configuration for the Fency instance */
8
- baseUrl?: string;
9
- }
10
- /**
11
- * Fency instance interface
12
- */
13
- export interface FencyInstance {
14
- /** The publishable key used to initialize this instance */
15
- publishableKey: string;
16
- baseUrl: string;
17
- }
package/lib/types.js DELETED
@@ -1 +0,0 @@
1
- export {};