macrocosmos 1.2.18 → 1.2.20

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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ npm install macrocosmos
12
12
 
13
13
  ### Apex Client
14
14
 
15
- The Apex client provides an interface for accessing the Apex API for chat completions and web search.
15
+ The Apex client provides an interface for accessing the Apex API for chat completions, web search and deep research.
16
16
 
17
17
  ```typescript
18
18
  import { ApexClient } from 'macrocosmos';
@@ -47,7 +47,7 @@ const submittedJob = await client.submitDeepResearcherJob({
47
47
  });
48
48
 
49
49
  // Get the results of a deep research job
50
- const polledJobResult = await client.getDeepResearcherJob(submittedJob.jobId);
50
+ const polledJobResult = await client.getDeepResearcherJob({jobId: submittedJob.jobId});
51
51
  ```
52
52
 
53
53
  ### Gravity Client
package/dist/README.md CHANGED
@@ -12,7 +12,7 @@ npm install macrocosmos
12
12
 
13
13
  ### Apex Client
14
14
 
15
- The Apex client provides an interface for accessing the Apex API for chat completions and web search.
15
+ The Apex client provides an interface for accessing the Apex API for chat completions, web search and deep research.
16
16
 
17
17
  ```typescript
18
18
  import { ApexClient } from 'macrocosmos';
@@ -47,7 +47,7 @@ const submittedJob = await client.submitDeepResearcherJob({
47
47
  });
48
48
 
49
49
  // Get the results of a deep research job
50
- const polledJobResult = await client.getDeepResearcherJob(submittedJob.jobId);
50
+ const polledJobResult = await client.getDeepResearcherJob({jobId: submittedJob.jobId});
51
51
  ```
52
52
 
53
53
  ### Gravity Client
@@ -65,11 +65,6 @@ describe("ApexClient", () => {
65
65
  expect(response.choices?.[0]?.message?.content?.toLowerCase()).toContain("paris");
66
66
  }, 30000); // Increase timeout to 30 seconds
67
67
  it("should retrieve stored chat completions", async () => {
68
- // Create ApexClient
69
- const client = new macrocosmos_1.ApexClient({
70
- apiKey: API_KEY,
71
- appName: "apex-client.test.ts",
72
- });
73
68
  // chat ID for testing
74
69
  const chatId = "test-chat-id";
75
70
  // Get stored chat completions
@@ -81,13 +76,44 @@ describe("ApexClient", () => {
81
76
  // chat id doesn't exist so check first element is an empty object
82
77
  expect(Object.keys(result.chatCompletions[0] || {}).length).toBe(0);
83
78
  }, 30000);
79
+ // it("should append a chat completion", async () => {
80
+ // // chat ID for testing
81
+ //
82
+ // const create_chat_result = await client.createChatAndCompletion({
83
+ // userPrompt: "This is a test chat, how are you?",
84
+ // chatType: "apex",
85
+ // completionType: "basic",
86
+ // title: "Test Chat",
87
+ // });
88
+ //
89
+ // // Verify the response structure
90
+ // console.log("Create chat and completion response:", create_chat_result);
91
+ // expect(create_chat_result).toBeDefined();
92
+ // // Get stored chat completions
93
+ // const result = await client.createCompletion({
94
+ // chatId: create_chat_result.parsedChat?.id ?? "",
95
+ // userPrompt: "This is a test completion, how are you?",
96
+ // completionType: "basic",
97
+ // });
98
+ //
99
+ // // Verify the response structure
100
+ // console.log("Create completion response:", result);
101
+ // expect(result).toBeDefined();
102
+ //
103
+ // // Check ParsedCompletion
104
+ // expect(result.parsedCompletion).toBeDefined();
105
+ // expect(result.parsedCompletion!.id).toBeDefined();
106
+ // expect(result.parsedCompletion!.chatId).toBe(
107
+ // create_chat_result.parsedChat!.id,
108
+ // );
109
+ // expect(result.parsedCompletion!.completionType).toBe("basic");
110
+ // expect(result.parsedCompletion!.userPromptText).toBe(
111
+ // "This is a test completion, how are you?",
112
+ // );
113
+ //
114
+ // }, 30000);
84
115
  // Deep Researcher Tests
85
116
  it("should create a deep research job", async () => {
86
- // Create ApexClient
87
- const client = new macrocosmos_1.ApexClient({
88
- apiKey: API_KEY,
89
- appName: "apex-client.test.ts",
90
- });
91
117
  // Create test parameters
92
118
  const params = {
93
119
  messages: deepResearchMessages,
@@ -108,11 +134,6 @@ describe("ApexClient", () => {
108
134
  console.log("Create Job Response:", response);
109
135
  }, 30000);
110
136
  it("should get deep researcher job results", async () => {
111
- // Create ApexClient
112
- const client = new macrocosmos_1.ApexClient({
113
- apiKey: API_KEY,
114
- appName: "apex-client.test.ts",
115
- });
116
137
  // First create a job. Use simple inputs as job creation is tested in the previous test.
117
138
  const createParams = {
118
139
  messages: deepResearchMessages,
@@ -120,7 +141,7 @@ describe("ApexClient", () => {
120
141
  const createResponse = await client.submitDeepResearcherJob(createParams);
121
142
  const jobId = createResponse.jobId;
122
143
  // Then get the results
123
- const response = await client.getDeepResearcherJob({ jobId });
144
+ const response = await client.getDeepResearcherJob({ jobId: jobId });
124
145
  // Verify response structure
125
146
  expect(response).toBeDefined();
126
147
  expect(response.jobId).toBe(jobId); // Job ID should match the one from the create response
@@ -132,4 +153,55 @@ describe("ApexClient", () => {
132
153
  // Log response for debugging
133
154
  console.log("Get Job Results Response:", response);
134
155
  }, 60000); // Longer timeout for this test as it involves multiple API calls
156
+ // TODO: Uncomment this when delete chat is available, so we can remove all test chats first
157
+ // it("should retrieve a user's completions based on the search term", async () => {
158
+ // const searchTerm = "France?";
159
+ // // Get stored chat completions
160
+ // const result = await client.searchChatIdsByPromptAndCompletionText({
161
+ // searchTerm: searchTerm,
162
+ // });
163
+ // // Verify the response structure
164
+ // console.log("Stored chats:", result);
165
+ // expect(result).toBeDefined();
166
+ // expect(Array.isArray(result.chatIds)).toBe(true);
167
+ // // chat id doesn't exist so check first element is an empty object
168
+ // expect(Object.keys(result.chatIds[0] || {}).length).toBe(0);
169
+ // }, 30000);
170
+ // it("should create a chat and completion for a user", async () => {
171
+ // const result = await client.createChatAndCompletion({
172
+ // userPrompt: "This is a test chat, how are you?",
173
+ // chatType: "apex",
174
+ // completionType: "basic",
175
+ // title: "Test Chat",
176
+ // });
177
+ // // Verify the response structure
178
+ // console.log("Create chat and completion response:", result);
179
+ // expect(result).toBeDefined();
180
+ // // Check ParsedChat
181
+ // expect(result.parsedChat).toBeDefined();
182
+ // expect(result.parsedChat!.id).toBeDefined();
183
+ // expect(result.parsedChat!.title).toBe("Test Chat");
184
+ // expect(result.parsedChat!.chatType).toBe("apex");
185
+ // expect(result.parsedChat!.createdAt).toBeDefined();
186
+ // // Check ParsedCompletion
187
+ // expect(result.parsedCompletion).toBeDefined();
188
+ // expect(result.parsedCompletion!.id).toBeDefined();
189
+ // expect(result.parsedCompletion!.chatId).toBe(result.parsedChat!.id);
190
+ // expect(result.parsedCompletion!.completionType).toBe("basic");
191
+ // expect(result.parsedCompletion!.userPromptText).toBe(
192
+ // "This is a test chat, how are you?",
193
+ // );
194
+ // expect(result.parsedCompletion!.completionText).toBeDefined();
195
+ // expect(result.parsedCompletion!.createdAt).toBeDefined();
196
+ // }, 30000);
197
+ // it("should retrieve a user's stored chats", async () => {
198
+ // // Get stored chat completions
199
+ // const result = await client.getChatSessions();
200
+ // // Verify the response structure
201
+ // console.log("Stored chats:", result);
202
+ // expect(result).toBeDefined();
203
+ // expect(Array.isArray(result.chatSessions)).toBe(true);
204
+ // // chat id doesn't exist so check first element is an empty object
205
+ // expect(Object.keys(result.chatSessions[0] || {}).length).toBe(0);
206
+ // }, 30000);
135
207
  });
@@ -50,7 +50,7 @@ describe("GravityClient", () => {
50
50
  it("should call the CreateGravityTask method on the gRPC client", async () => {
51
51
  const params = {
52
52
  gravityTasks: [{ platform: "x", topic: "#ai" }],
53
- name: "Test Task",
53
+ name: "Test Task from typescript SDK",
54
54
  };
55
55
  const result = await client.createGravityTask(params);
56
56
  expect(mockGrpcClient.createGravityTask).toHaveBeenCalledWith(params, expect.any(Function));
@@ -462,7 +462,7 @@ export interface GetStoredChatCompletionsResponse {
462
462
  chatCompletions: StoredChatCompletion[];
463
463
  }
464
464
  /** Directly model the attributes as a map */
465
- export interface UpdateChatAttributeRequest {
465
+ export interface UpdateChatAttributesRequest {
466
466
  /** chat_id: the unique id associated to a users chat message */
467
467
  chatId: string;
468
468
  /** attributes: the data attributes captured in the chat logging process */
@@ -470,14 +470,14 @@ export interface UpdateChatAttributeRequest {
470
470
  [key: string]: string;
471
471
  };
472
472
  }
473
- export interface UpdateChatAttributeRequest_AttributesEntry {
473
+ export interface UpdateChatAttributesRequest_AttributesEntry {
474
474
  key: string;
475
475
  value: string;
476
476
  }
477
- /** A UpdateChatAttribute response */
478
- export interface UpdateChatAttributeResponse {
479
- /** success: indicates if an attribute update was successful */
480
- success: boolean;
477
+ /** A UpdateChatAttributes response */
478
+ export interface UpdateChatAttributesResponse {
479
+ /** chat: the updated chat row from the chats table */
480
+ chat?: ChatSession | undefined;
481
481
  }
482
482
  /** A DeleteChats request */
483
483
  export interface DeleteChatsRequest {
@@ -489,6 +489,109 @@ export interface DeleteChatsResponse {
489
489
  /** success: indicates if the deletion was successful */
490
490
  success: boolean;
491
491
  }
492
+ /** A ParsedChat message serving as part of the CreateChatAndCompletion response */
493
+ export interface ParsedChat {
494
+ /** id: the chat_id */
495
+ id: string;
496
+ /** title: title of the chat */
497
+ title: string;
498
+ /** created_at: the time the chat was created */
499
+ createdAt?: Date | undefined;
500
+ /** chat_type: the service a single chat can be using (e.g.: "apex", "gravity") */
501
+ chatType: string;
502
+ }
503
+ /** A ParsedCompletion message serving as part of the CreateChatAndCompletion response */
504
+ export interface ParsedCompletion {
505
+ /** id: the completion_id */
506
+ id: string;
507
+ /** chat_id: the chat_id */
508
+ chatId: string;
509
+ /** created_at: the time the completion was created */
510
+ createdAt?: Date | undefined;
511
+ /** user_prompt_text: the user's chat prompt text */
512
+ userPromptText: string;
513
+ /** completion_text: the user's completion text */
514
+ completionText: string;
515
+ /** completion_type: type of completion */
516
+ completionType: string;
517
+ /** metadata: metadata json blob */
518
+ metadata?: {
519
+ [key: string]: any;
520
+ } | undefined;
521
+ }
522
+ /** A CreateChatAndCompletion request */
523
+ export interface CreateChatAndCompletionRequest {
524
+ /** user_prompt: the prompt the user issues */
525
+ userPrompt: string;
526
+ /** chat_type: the service a single chat can be using (e.g.: "apex", "gravity") */
527
+ chatType: string;
528
+ /** completion_type: specific to completions and might accompany specific kinds of metadata (e.g.: "basic", "combined") */
529
+ completionType: string;
530
+ /** title: the title of the new chat (optional) */
531
+ title?: string | undefined;
532
+ }
533
+ /** A CreateChatAndCompletion response */
534
+ export interface CreateChatAndCompletionResponse {
535
+ /** parsed_chat: the chat row that was successfully created */
536
+ parsedChat?: ParsedChat | undefined;
537
+ /** parsed_completion: the completion row that was successfully created */
538
+ parsedCompletion?: ParsedCompletion | undefined;
539
+ }
540
+ /** A CreateCompletion request */
541
+ export interface CreateCompletionRequest {
542
+ /** chat_id: the ID of the chat to create the completion for */
543
+ chatId: string;
544
+ /** user_prompt: the prompt the user issues */
545
+ userPrompt: string;
546
+ /** completion_type: the completion type e.g. basic, reasoning etc. */
547
+ completionType: string;
548
+ }
549
+ /** A CreateCompletion response */
550
+ export interface CreateCompletionResponse {
551
+ /** parsed_completion: the completion row that was successfully created */
552
+ parsedCompletion?: ParsedCompletion | undefined;
553
+ }
554
+ /** A DeleteCompletions request */
555
+ export interface DeleteCompletionsRequest {
556
+ /** completion_ids: the unique ids associated to user chat-completions that should be deleted */
557
+ completionIds: string[];
558
+ }
559
+ /** A DeleteCompletions response */
560
+ export interface DeleteCompletionsResponse {
561
+ /** success: indicates if the deletion was successful */
562
+ success: boolean;
563
+ }
564
+ /** A SearchChatIdsByPromptAndCompletionText request */
565
+ export interface SearchChatIdsByPromptAndCompletionTextRequest {
566
+ /** search_term: the user supplied search term */
567
+ searchTerm: string;
568
+ }
569
+ /** A SearchChatIdsByPromptAndCompletionText response */
570
+ export interface SearchChatIdsByPromptAndCompletionTextResponse {
571
+ /** chat_ids: a list of chat_ids which adhere to the search criteria */
572
+ chatIds: string[];
573
+ }
574
+ /** An UpdateCompletionAttributes request */
575
+ export interface UpdateCompletionAttributesRequest {
576
+ /** completion_id: the chat completion id */
577
+ completionId: string;
578
+ /** completion_text: the user's completion text (optional) */
579
+ completionText?: string | undefined;
580
+ /** metadata: metadata json blob (optional) */
581
+ metadata?: {
582
+ [key: string]: any;
583
+ } | undefined;
584
+ }
585
+ /** An UpdateCompletionAttributes response */
586
+ export interface UpdateCompletionAttributesResponse {
587
+ /** completion: the chat completion that has been updated */
588
+ completion?: StoredChatCompletion | undefined;
589
+ }
590
+ /** A GetCompletionsWithDeepResearcherEntry response (request is not required) */
591
+ export interface GetCompletionsWithDeepResearcherEntryResponse {
592
+ /** completions: a list of completion objects containing deep researcher metadata */
593
+ completions: ParsedCompletion[];
594
+ }
492
595
  export declare const ChatCompletionRequest: MessageFns<ChatCompletionRequest>;
493
596
  export declare const SamplingParameters: MessageFns<SamplingParameters>;
494
597
  export declare const ChatCompletionResponse: MessageFns<ChatCompletionResponse>;
@@ -524,11 +627,24 @@ export declare const GetChatSessionsResponse: MessageFns<GetChatSessionsResponse
524
627
  export declare const GetStoredChatCompletionsRequest: MessageFns<GetStoredChatCompletionsRequest>;
525
628
  export declare const StoredChatCompletion: MessageFns<StoredChatCompletion>;
526
629
  export declare const GetStoredChatCompletionsResponse: MessageFns<GetStoredChatCompletionsResponse>;
527
- export declare const UpdateChatAttributeRequest: MessageFns<UpdateChatAttributeRequest>;
528
- export declare const UpdateChatAttributeRequest_AttributesEntry: MessageFns<UpdateChatAttributeRequest_AttributesEntry>;
529
- export declare const UpdateChatAttributeResponse: MessageFns<UpdateChatAttributeResponse>;
630
+ export declare const UpdateChatAttributesRequest: MessageFns<UpdateChatAttributesRequest>;
631
+ export declare const UpdateChatAttributesRequest_AttributesEntry: MessageFns<UpdateChatAttributesRequest_AttributesEntry>;
632
+ export declare const UpdateChatAttributesResponse: MessageFns<UpdateChatAttributesResponse>;
530
633
  export declare const DeleteChatsRequest: MessageFns<DeleteChatsRequest>;
531
634
  export declare const DeleteChatsResponse: MessageFns<DeleteChatsResponse>;
635
+ export declare const ParsedChat: MessageFns<ParsedChat>;
636
+ export declare const ParsedCompletion: MessageFns<ParsedCompletion>;
637
+ export declare const CreateChatAndCompletionRequest: MessageFns<CreateChatAndCompletionRequest>;
638
+ export declare const CreateChatAndCompletionResponse: MessageFns<CreateChatAndCompletionResponse>;
639
+ export declare const CreateCompletionRequest: MessageFns<CreateCompletionRequest>;
640
+ export declare const CreateCompletionResponse: MessageFns<CreateCompletionResponse>;
641
+ export declare const DeleteCompletionsRequest: MessageFns<DeleteCompletionsRequest>;
642
+ export declare const DeleteCompletionsResponse: MessageFns<DeleteCompletionsResponse>;
643
+ export declare const SearchChatIdsByPromptAndCompletionTextRequest: MessageFns<SearchChatIdsByPromptAndCompletionTextRequest>;
644
+ export declare const SearchChatIdsByPromptAndCompletionTextResponse: MessageFns<SearchChatIdsByPromptAndCompletionTextResponse>;
645
+ export declare const UpdateCompletionAttributesRequest: MessageFns<UpdateCompletionAttributesRequest>;
646
+ export declare const UpdateCompletionAttributesResponse: MessageFns<UpdateCompletionAttributesResponse>;
647
+ export declare const GetCompletionsWithDeepResearcherEntryResponse: MessageFns<GetCompletionsWithDeepResearcherEntryResponse>;
532
648
  export type ApexServiceService = typeof ApexServiceService;
533
649
  export declare const ApexServiceService: {
534
650
  /** ChatCompletion generates a completion for a given request. */
@@ -601,15 +717,15 @@ export declare const ApexServiceService: {
601
717
  readonly responseSerialize: (value: GetStoredChatCompletionsResponse) => Buffer<ArrayBuffer>;
602
718
  readonly responseDeserialize: (value: Buffer) => GetStoredChatCompletionsResponse;
603
719
  };
604
- /** UpdateChatAttribute updates attribute after asking LLM for one */
605
- readonly updateChatAttribute: {
606
- readonly path: "/apex.v1.ApexService/UpdateChatAttribute";
720
+ /** UpdateChatAttributes updates specified attributes of a chat */
721
+ readonly updateChatAttributes: {
722
+ readonly path: "/apex.v1.ApexService/UpdateChatAttributes";
607
723
  readonly requestStream: false;
608
724
  readonly responseStream: false;
609
- readonly requestSerialize: (value: UpdateChatAttributeRequest) => Buffer<ArrayBuffer>;
610
- readonly requestDeserialize: (value: Buffer) => UpdateChatAttributeRequest;
611
- readonly responseSerialize: (value: UpdateChatAttributeResponse) => Buffer<ArrayBuffer>;
612
- readonly responseDeserialize: (value: Buffer) => UpdateChatAttributeResponse;
725
+ readonly requestSerialize: (value: UpdateChatAttributesRequest) => Buffer<ArrayBuffer>;
726
+ readonly requestDeserialize: (value: Buffer) => UpdateChatAttributesRequest;
727
+ readonly responseSerialize: (value: UpdateChatAttributesResponse) => Buffer<ArrayBuffer>;
728
+ readonly responseDeserialize: (value: Buffer) => UpdateChatAttributesResponse;
613
729
  };
614
730
  /** DeleteChats removes chats based on the specified chat_ids */
615
731
  readonly deleteChats: {
@@ -621,6 +737,66 @@ export declare const ApexServiceService: {
621
737
  readonly responseSerialize: (value: DeleteChatsResponse) => Buffer<ArrayBuffer>;
622
738
  readonly responseDeserialize: (value: Buffer) => DeleteChatsResponse;
623
739
  };
740
+ /** CreateChatAndCompletion makes a new chat when completion present, otherwise sets as new chat */
741
+ readonly createChatAndCompletion: {
742
+ readonly path: "/apex.v1.ApexService/CreateChatAndCompletion";
743
+ readonly requestStream: false;
744
+ readonly responseStream: false;
745
+ readonly requestSerialize: (value: CreateChatAndCompletionRequest) => Buffer<ArrayBuffer>;
746
+ readonly requestDeserialize: (value: Buffer) => CreateChatAndCompletionRequest;
747
+ readonly responseSerialize: (value: CreateChatAndCompletionResponse) => Buffer<ArrayBuffer>;
748
+ readonly responseDeserialize: (value: Buffer) => CreateChatAndCompletionResponse;
749
+ };
750
+ /** CreateCompletion creates a new completion for an existing chat */
751
+ readonly createCompletion: {
752
+ readonly path: "/apex.v1.ApexService/CreateCompletion";
753
+ readonly requestStream: false;
754
+ readonly responseStream: false;
755
+ readonly requestSerialize: (value: CreateCompletionRequest) => Buffer<ArrayBuffer>;
756
+ readonly requestDeserialize: (value: Buffer) => CreateCompletionRequest;
757
+ readonly responseSerialize: (value: CreateCompletionResponse) => Buffer<ArrayBuffer>;
758
+ readonly responseDeserialize: (value: Buffer) => CreateCompletionResponse;
759
+ };
760
+ /** DeleteCompletions removes completions based on the specified completion_ids */
761
+ readonly deleteCompletions: {
762
+ readonly path: "/apex.v1.ApexService/DeleteCompletions";
763
+ readonly requestStream: false;
764
+ readonly responseStream: false;
765
+ readonly requestSerialize: (value: DeleteCompletionsRequest) => Buffer<ArrayBuffer>;
766
+ readonly requestDeserialize: (value: Buffer) => DeleteCompletionsRequest;
767
+ readonly responseSerialize: (value: DeleteCompletionsResponse) => Buffer<ArrayBuffer>;
768
+ readonly responseDeserialize: (value: Buffer) => DeleteCompletionsResponse;
769
+ };
770
+ /** SearchChatIdsByPromptAndCompletionText searches for completions where the parent chat has the user's ID and either user_prompt_text OR completion_text matches the search_term */
771
+ readonly searchChatIdsByPromptAndCompletionText: {
772
+ readonly path: "/apex.v1.ApexService/SearchChatIdsByPromptAndCompletionText";
773
+ readonly requestStream: false;
774
+ readonly responseStream: false;
775
+ readonly requestSerialize: (value: SearchChatIdsByPromptAndCompletionTextRequest) => Buffer<ArrayBuffer>;
776
+ readonly requestDeserialize: (value: Buffer) => SearchChatIdsByPromptAndCompletionTextRequest;
777
+ readonly responseSerialize: (value: SearchChatIdsByPromptAndCompletionTextResponse) => Buffer<ArrayBuffer>;
778
+ readonly responseDeserialize: (value: Buffer) => SearchChatIdsByPromptAndCompletionTextResponse;
779
+ };
780
+ /** UpdateCompletionAttributes updates attribute for a given chat completion */
781
+ readonly updateCompletionAttributes: {
782
+ readonly path: "/apex.v1.ApexService/UpdateCompletionAttributes";
783
+ readonly requestStream: false;
784
+ readonly responseStream: false;
785
+ readonly requestSerialize: (value: UpdateCompletionAttributesRequest) => Buffer<ArrayBuffer>;
786
+ readonly requestDeserialize: (value: Buffer) => UpdateCompletionAttributesRequest;
787
+ readonly responseSerialize: (value: UpdateCompletionAttributesResponse) => Buffer<ArrayBuffer>;
788
+ readonly responseDeserialize: (value: Buffer) => UpdateCompletionAttributesResponse;
789
+ };
790
+ /** GetCompletionsWithDeepResearcherEntry returns a list of completions that contain metadata on deep researcher */
791
+ readonly getCompletionsWithDeepResearcherEntry: {
792
+ readonly path: "/apex.v1.ApexService/GetCompletionsWithDeepResearcherEntry";
793
+ readonly requestStream: false;
794
+ readonly responseStream: false;
795
+ readonly requestSerialize: (value: Empty) => Buffer<ArrayBuffer>;
796
+ readonly requestDeserialize: (value: Buffer) => Empty;
797
+ readonly responseSerialize: (value: GetCompletionsWithDeepResearcherEntryResponse) => Buffer<ArrayBuffer>;
798
+ readonly responseDeserialize: (value: Buffer) => GetCompletionsWithDeepResearcherEntryResponse;
799
+ };
624
800
  };
625
801
  export interface ApexServiceServer extends UntypedServiceImplementation {
626
802
  /** ChatCompletion generates a completion for a given request. */
@@ -637,10 +813,22 @@ export interface ApexServiceServer extends UntypedServiceImplementation {
637
813
  getChatSessions: handleUnaryCall<Empty, GetChatSessionsResponse>;
638
814
  /** GetStoredChatCompletions retrieves a chat's completions */
639
815
  getStoredChatCompletions: handleUnaryCall<GetStoredChatCompletionsRequest, GetStoredChatCompletionsResponse>;
640
- /** UpdateChatAttribute updates attribute after asking LLM for one */
641
- updateChatAttribute: handleUnaryCall<UpdateChatAttributeRequest, UpdateChatAttributeResponse>;
816
+ /** UpdateChatAttributes updates specified attributes of a chat */
817
+ updateChatAttributes: handleUnaryCall<UpdateChatAttributesRequest, UpdateChatAttributesResponse>;
642
818
  /** DeleteChats removes chats based on the specified chat_ids */
643
819
  deleteChats: handleUnaryCall<DeleteChatsRequest, DeleteChatsResponse>;
820
+ /** CreateChatAndCompletion makes a new chat when completion present, otherwise sets as new chat */
821
+ createChatAndCompletion: handleUnaryCall<CreateChatAndCompletionRequest, CreateChatAndCompletionResponse>;
822
+ /** CreateCompletion creates a new completion for an existing chat */
823
+ createCompletion: handleUnaryCall<CreateCompletionRequest, CreateCompletionResponse>;
824
+ /** DeleteCompletions removes completions based on the specified completion_ids */
825
+ deleteCompletions: handleUnaryCall<DeleteCompletionsRequest, DeleteCompletionsResponse>;
826
+ /** SearchChatIdsByPromptAndCompletionText searches for completions where the parent chat has the user's ID and either user_prompt_text OR completion_text matches the search_term */
827
+ searchChatIdsByPromptAndCompletionText: handleUnaryCall<SearchChatIdsByPromptAndCompletionTextRequest, SearchChatIdsByPromptAndCompletionTextResponse>;
828
+ /** UpdateCompletionAttributes updates attribute for a given chat completion */
829
+ updateCompletionAttributes: handleUnaryCall<UpdateCompletionAttributesRequest, UpdateCompletionAttributesResponse>;
830
+ /** GetCompletionsWithDeepResearcherEntry returns a list of completions that contain metadata on deep researcher */
831
+ getCompletionsWithDeepResearcherEntry: handleUnaryCall<Empty, GetCompletionsWithDeepResearcherEntryResponse>;
644
832
  }
645
833
  export interface ApexServiceClient extends Client {
646
834
  /** ChatCompletion generates a completion for a given request. */
@@ -670,14 +858,38 @@ export interface ApexServiceClient extends Client {
670
858
  getStoredChatCompletions(request: GetStoredChatCompletionsRequest, callback: (error: ServiceError | null, response: GetStoredChatCompletionsResponse) => void): ClientUnaryCall;
671
859
  getStoredChatCompletions(request: GetStoredChatCompletionsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetStoredChatCompletionsResponse) => void): ClientUnaryCall;
672
860
  getStoredChatCompletions(request: GetStoredChatCompletionsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetStoredChatCompletionsResponse) => void): ClientUnaryCall;
673
- /** UpdateChatAttribute updates attribute after asking LLM for one */
674
- updateChatAttribute(request: UpdateChatAttributeRequest, callback: (error: ServiceError | null, response: UpdateChatAttributeResponse) => void): ClientUnaryCall;
675
- updateChatAttribute(request: UpdateChatAttributeRequest, metadata: Metadata, callback: (error: ServiceError | null, response: UpdateChatAttributeResponse) => void): ClientUnaryCall;
676
- updateChatAttribute(request: UpdateChatAttributeRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: UpdateChatAttributeResponse) => void): ClientUnaryCall;
861
+ /** UpdateChatAttributes updates specified attributes of a chat */
862
+ updateChatAttributes(request: UpdateChatAttributesRequest, callback: (error: ServiceError | null, response: UpdateChatAttributesResponse) => void): ClientUnaryCall;
863
+ updateChatAttributes(request: UpdateChatAttributesRequest, metadata: Metadata, callback: (error: ServiceError | null, response: UpdateChatAttributesResponse) => void): ClientUnaryCall;
864
+ updateChatAttributes(request: UpdateChatAttributesRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: UpdateChatAttributesResponse) => void): ClientUnaryCall;
677
865
  /** DeleteChats removes chats based on the specified chat_ids */
678
866
  deleteChats(request: DeleteChatsRequest, callback: (error: ServiceError | null, response: DeleteChatsResponse) => void): ClientUnaryCall;
679
867
  deleteChats(request: DeleteChatsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: DeleteChatsResponse) => void): ClientUnaryCall;
680
868
  deleteChats(request: DeleteChatsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: DeleteChatsResponse) => void): ClientUnaryCall;
869
+ /** CreateChatAndCompletion makes a new chat when completion present, otherwise sets as new chat */
870
+ createChatAndCompletion(request: CreateChatAndCompletionRequest, callback: (error: ServiceError | null, response: CreateChatAndCompletionResponse) => void): ClientUnaryCall;
871
+ createChatAndCompletion(request: CreateChatAndCompletionRequest, metadata: Metadata, callback: (error: ServiceError | null, response: CreateChatAndCompletionResponse) => void): ClientUnaryCall;
872
+ createChatAndCompletion(request: CreateChatAndCompletionRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: CreateChatAndCompletionResponse) => void): ClientUnaryCall;
873
+ /** CreateCompletion creates a new completion for an existing chat */
874
+ createCompletion(request: CreateCompletionRequest, callback: (error: ServiceError | null, response: CreateCompletionResponse) => void): ClientUnaryCall;
875
+ createCompletion(request: CreateCompletionRequest, metadata: Metadata, callback: (error: ServiceError | null, response: CreateCompletionResponse) => void): ClientUnaryCall;
876
+ createCompletion(request: CreateCompletionRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: CreateCompletionResponse) => void): ClientUnaryCall;
877
+ /** DeleteCompletions removes completions based on the specified completion_ids */
878
+ deleteCompletions(request: DeleteCompletionsRequest, callback: (error: ServiceError | null, response: DeleteCompletionsResponse) => void): ClientUnaryCall;
879
+ deleteCompletions(request: DeleteCompletionsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: DeleteCompletionsResponse) => void): ClientUnaryCall;
880
+ deleteCompletions(request: DeleteCompletionsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: DeleteCompletionsResponse) => void): ClientUnaryCall;
881
+ /** SearchChatIdsByPromptAndCompletionText searches for completions where the parent chat has the user's ID and either user_prompt_text OR completion_text matches the search_term */
882
+ searchChatIdsByPromptAndCompletionText(request: SearchChatIdsByPromptAndCompletionTextRequest, callback: (error: ServiceError | null, response: SearchChatIdsByPromptAndCompletionTextResponse) => void): ClientUnaryCall;
883
+ searchChatIdsByPromptAndCompletionText(request: SearchChatIdsByPromptAndCompletionTextRequest, metadata: Metadata, callback: (error: ServiceError | null, response: SearchChatIdsByPromptAndCompletionTextResponse) => void): ClientUnaryCall;
884
+ searchChatIdsByPromptAndCompletionText(request: SearchChatIdsByPromptAndCompletionTextRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: SearchChatIdsByPromptAndCompletionTextResponse) => void): ClientUnaryCall;
885
+ /** UpdateCompletionAttributes updates attribute for a given chat completion */
886
+ updateCompletionAttributes(request: UpdateCompletionAttributesRequest, callback: (error: ServiceError | null, response: UpdateCompletionAttributesResponse) => void): ClientUnaryCall;
887
+ updateCompletionAttributes(request: UpdateCompletionAttributesRequest, metadata: Metadata, callback: (error: ServiceError | null, response: UpdateCompletionAttributesResponse) => void): ClientUnaryCall;
888
+ updateCompletionAttributes(request: UpdateCompletionAttributesRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: UpdateCompletionAttributesResponse) => void): ClientUnaryCall;
889
+ /** GetCompletionsWithDeepResearcherEntry returns a list of completions that contain metadata on deep researcher */
890
+ getCompletionsWithDeepResearcherEntry(request: Empty, callback: (error: ServiceError | null, response: GetCompletionsWithDeepResearcherEntryResponse) => void): ClientUnaryCall;
891
+ getCompletionsWithDeepResearcherEntry(request: Empty, metadata: Metadata, callback: (error: ServiceError | null, response: GetCompletionsWithDeepResearcherEntryResponse) => void): ClientUnaryCall;
892
+ getCompletionsWithDeepResearcherEntry(request: Empty, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetCompletionsWithDeepResearcherEntryResponse) => void): ClientUnaryCall;
681
893
  }
682
894
  export declare const ApexServiceClient: {
683
895
  new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): ApexServiceClient;