graphlit-client 1.0.20250620002 → 1.0.20250621001

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/dist/client.d.ts CHANGED
@@ -174,11 +174,11 @@ declare class Graphlit {
174
174
  reviseContent(prompt: string, content: Types.EntityReferenceInput, id?: string, specification?: Types.EntityReferenceInput, correlationId?: string): Promise<Types.ReviseContentMutation>;
175
175
  prompt(prompt?: string, mimeType?: string, data?: string, specification?: Types.EntityReferenceInput, messages?: Types.ConversationMessageInput[], correlationId?: string): Promise<Types.PromptMutation>;
176
176
  retrieveSources(prompt: string, filter?: Types.ContentFilter, augmentedFilter?: Types.ContentFilter, retrievalStrategy?: Types.RetrievalStrategyInput, rerankingStrategy?: Types.RerankingStrategyInput, correlationId?: string): Promise<Types.RetrieveSourcesMutation>;
177
- formatConversation(prompt: string, id?: string, specification?: Types.EntityReferenceInput, tools?: Types.ToolDefinitionInput[], includeDetails?: boolean, correlationId?: string): Promise<Types.FormatConversationMutation>;
178
- completeConversation(completion: string, id: string, correlationId?: string): Promise<Types.CompleteConversationMutation>;
177
+ formatConversation(prompt: string, id?: string, specification?: Types.EntityReferenceInput, tools?: Types.ToolDefinitionInput[], systemPrompt?: string, includeDetails?: boolean, correlationId?: string): Promise<Types.FormatConversationMutation>;
178
+ completeConversation(completion: string, id: string, completionTime?: Types.Scalars["TimeSpan"]["input"], ttft?: Types.Scalars["TimeSpan"]["input"], throughput?: Types.Scalars["Float"]["input"], correlationId?: string): Promise<Types.CompleteConversationMutation>;
179
179
  askGraphlit(prompt: string, type?: Types.SdkTypes, id?: string, specification?: Types.EntityReferenceInput, correlationId?: string): Promise<Types.AskGraphlitMutation>;
180
180
  branchConversation(id: string): Promise<Types.BranchConversationMutation>;
181
- promptConversation(prompt: string, id?: string, specification?: Types.EntityReferenceInput, mimeType?: string, data?: string, tools?: Types.ToolDefinitionInput[], requireTool?: boolean, includeDetails?: boolean, correlationId?: string): Promise<Types.PromptConversationMutation>;
181
+ promptConversation(prompt: string, id?: string, specification?: Types.EntityReferenceInput, mimeType?: string, data?: string, tools?: Types.ToolDefinitionInput[], requireTool?: boolean, systemPrompt?: string, includeDetails?: boolean, correlationId?: string): Promise<Types.PromptConversationMutation>;
182
182
  continueConversation(id: string, responses: Types.ConversationToolResponseInput[], correlationId?: string): Promise<Types.ContinueConversationMutation>;
183
183
  publishConversation(id: string, connector: Types.ContentPublishingConnectorInput, name?: string, workflow?: Types.EntityReferenceInput, isSynchronous?: boolean, correlationId?: string): Promise<Types.PublishConversationMutation>;
184
184
  suggestConversation(id: string, count?: number, correlationId?: string): Promise<Types.SuggestConversationMutation>;
package/dist/client.js CHANGED
@@ -791,20 +791,24 @@ class Graphlit {
791
791
  correlationId: correlationId,
792
792
  });
793
793
  }
794
- async formatConversation(prompt, id, specification, tools, includeDetails, correlationId) {
794
+ async formatConversation(prompt, id, specification, tools, systemPrompt, includeDetails, correlationId) {
795
795
  return this.mutateAndCheckError(Documents.FormatConversation, {
796
796
  prompt: prompt,
797
797
  id: id,
798
798
  specification: specification,
799
799
  tools: tools,
800
+ systemPrompt: systemPrompt,
800
801
  includeDetails: includeDetails,
801
802
  correlationId: correlationId,
802
803
  });
803
804
  }
804
- async completeConversation(completion, id, correlationId) {
805
+ async completeConversation(completion, id, completionTime, ttft, throughput, correlationId) {
805
806
  return this.mutateAndCheckError(Documents.CompleteConversation, {
806
807
  completion: completion,
807
808
  id: id,
809
+ completionTime: completionTime,
810
+ ttft: ttft,
811
+ throughput: throughput,
808
812
  correlationId: correlationId,
809
813
  });
810
814
  }
@@ -822,7 +826,7 @@ class Graphlit {
822
826
  id: id,
823
827
  });
824
828
  }
825
- async promptConversation(prompt, id, specification, mimeType, data, tools, requireTool, includeDetails, correlationId) {
829
+ async promptConversation(prompt, id, specification, mimeType, data, tools, requireTool, systemPrompt, includeDetails, correlationId) {
826
830
  return this.mutateAndCheckError(Documents.PromptConversation, {
827
831
  prompt: prompt,
828
832
  id: id,
@@ -831,6 +835,7 @@ class Graphlit {
831
835
  data: data,
832
836
  tools: tools,
833
837
  requireTool: requireTool,
838
+ systemPrompt: systemPrompt,
834
839
  includeDetails: includeDetails,
835
840
  correlationId: correlationId,
836
841
  });
@@ -1702,7 +1707,7 @@ class Graphlit {
1702
1707
  }
1703
1708
  // 2. Initial prompt
1704
1709
  const promptResponse = await this.promptConversation(prompt, actualConversationId, specification, mimeType, data, tools, false, // requireTool
1705
- true, // includeDetails - needed for context window tracking
1710
+ undefined, true, // includeDetails - needed for context window tracking
1706
1711
  correlationId);
1707
1712
  let currentMessage = promptResponse.promptConversation?.message;
1708
1713
  if (!currentMessage) {
@@ -1961,7 +1966,7 @@ class Graphlit {
1961
1966
  conversationId,
1962
1967
  });
1963
1968
  // Format conversation once at the beginning
1964
- const formatResponse = await this.formatConversation(prompt, conversationId, { id: specification.id }, tools, true, correlationId);
1969
+ const formatResponse = await this.formatConversation(prompt, conversationId, { id: specification.id }, tools, undefined, true, correlationId);
1965
1970
  const formattedMessage = formatResponse.formatConversation?.message;
1966
1971
  const conversationHistory = formatResponse.formatConversation?.details?.messages;
1967
1972
  if (!formattedMessage?.message) {
@@ -2399,7 +2404,11 @@ class Graphlit {
2399
2404
  let finalTokens;
2400
2405
  const trimmedMessage = fullMessage?.trim();
2401
2406
  if (trimmedMessage) {
2402
- const completeResponse = await this.completeConversation(trimmedMessage, conversationId, correlationId);
2407
+ // Calculate metrics for completeConversation
2408
+ const completionTime = uiAdapter.getCompletionTime(); // Total time in milliseconds
2409
+ const ttft = uiAdapter.getTTFT(); // Time to first token in milliseconds
2410
+ const throughput = uiAdapter.getThroughput(); // Tokens per second
2411
+ const completeResponse = await this.completeConversation(trimmedMessage, conversationId, completionTime, ttft, throughput, correlationId);
2403
2412
  // Extract token count from the response
2404
2413
  finalTokens =
2405
2414
  completeResponse.completeConversation?.message?.tokens ?? undefined;
@@ -2532,7 +2541,7 @@ class Graphlit {
2532
2541
  if (process.env.DEBUG_GRAPHLIT_SDK_STREAMING) {
2533
2542
  console.log(`🔄 [Fallback] Starting non-streaming fallback | ConvID: ${conversationId} | Spec: ${specification.name} (${specification.serviceType}) | Prompt: "${prompt.substring(0, 50)}${prompt.length > 50 ? "..." : ""}"`);
2534
2543
  }
2535
- const response = await this.promptConversation(prompt, conversationId, { id: specification.id }, mimeType, data, tools, false, false, correlationId);
2544
+ const response = await this.promptConversation(prompt, conversationId, { id: specification.id }, mimeType, data, tools, false, undefined, false, correlationId);
2536
2545
  const message = response.promptConversation?.message;
2537
2546
  if (process.env.DEBUG_GRAPHLIT_SDK_STREAMING) {
2538
2547
  console.log(`✅ [Fallback] promptConversation completed | Length: ${message?.message?.length || 0} chars | Preview: "${message?.message?.substring(0, 50) || "NO MESSAGE"}${(message?.message?.length || 0) > 50 ? "..." : ""}"`);
@@ -502,7 +502,6 @@ export const GetCollection = gql `
502
502
  id
503
503
  name
504
504
  creationDate
505
- relevance
506
505
  owner {
507
506
  id
508
507
  }
@@ -528,10 +527,6 @@ export const QueryCollections = gql `
528
527
  }
529
528
  state
530
529
  type
531
- contents {
532
- id
533
- name
534
- }
535
530
  }
536
531
  }
537
532
  }
@@ -720,6 +715,7 @@ export const DescribeEncodedImage = gql `
720
715
  }
721
716
  tokens
722
717
  throughput
718
+ ttft
723
719
  completionTime
724
720
  timestamp
725
721
  modelService
@@ -855,6 +851,7 @@ export const DescribeImage = gql `
855
851
  }
856
852
  tokens
857
853
  throughput
854
+ ttft
858
855
  completionTime
859
856
  timestamp
860
857
  modelService
@@ -2310,34 +2307,6 @@ export const QueryContents = gql `
2310
2307
  uri
2311
2308
  linkType
2312
2309
  }
2313
- observations {
2314
- id
2315
- type
2316
- observable {
2317
- id
2318
- name
2319
- }
2320
- related {
2321
- id
2322
- name
2323
- }
2324
- relatedType
2325
- relation
2326
- occurrences {
2327
- type
2328
- confidence
2329
- startTime
2330
- endTime
2331
- pageIndex
2332
- boundingBox {
2333
- left
2334
- top
2335
- width
2336
- height
2337
- }
2338
- }
2339
- state
2340
- }
2341
2310
  workflow {
2342
2311
  id
2343
2312
  name
@@ -2699,6 +2668,7 @@ export const AskGraphlit = gql `
2699
2668
  }
2700
2669
  tokens
2701
2670
  throughput
2671
+ ttft
2702
2672
  completionTime
2703
2673
  timestamp
2704
2674
  modelService
@@ -2743,10 +2713,13 @@ export const CloseConversation = gql `
2743
2713
  }
2744
2714
  `;
2745
2715
  export const CompleteConversation = gql `
2746
- mutation CompleteConversation($completion: String!, $id: ID!, $correlationId: String) {
2716
+ mutation CompleteConversation($completion: String!, $id: ID!, $completionTime: TimeSpan, $ttft: TimeSpan, $throughput: Float, $correlationId: String) {
2747
2717
  completeConversation(
2748
2718
  completion: $completion
2749
2719
  id: $id
2720
+ completionTime: $completionTime
2721
+ ttft: $ttft
2722
+ throughput: $throughput
2750
2723
  correlationId: $correlationId
2751
2724
  ) {
2752
2725
  conversation {
@@ -2869,6 +2842,7 @@ export const CompleteConversation = gql `
2869
2842
  }
2870
2843
  tokens
2871
2844
  throughput
2845
+ ttft
2872
2846
  completionTime
2873
2847
  timestamp
2874
2848
  modelService
@@ -3047,6 +3021,7 @@ export const CompleteConversation = gql `
3047
3021
  }
3048
3022
  tokens
3049
3023
  throughput
3024
+ ttft
3050
3025
  completionTime
3051
3026
  timestamp
3052
3027
  modelService
@@ -3187,6 +3162,7 @@ export const ContinueConversation = gql `
3187
3162
  }
3188
3163
  tokens
3189
3164
  throughput
3165
+ ttft
3190
3166
  completionTime
3191
3167
  timestamp
3192
3168
  modelService
@@ -3365,6 +3341,7 @@ export const ContinueConversation = gql `
3365
3341
  }
3366
3342
  tokens
3367
3343
  throughput
3344
+ ttft
3368
3345
  completionTime
3369
3346
  timestamp
3370
3347
  modelService
@@ -3424,12 +3401,13 @@ export const DeleteConversations = gql `
3424
3401
  }
3425
3402
  `;
3426
3403
  export const FormatConversation = gql `
3427
- mutation FormatConversation($prompt: String!, $id: ID, $specification: EntityReferenceInput, $tools: [ToolDefinitionInput!], $includeDetails: Boolean, $correlationId: String) {
3404
+ mutation FormatConversation($prompt: String!, $id: ID, $specification: EntityReferenceInput, $tools: [ToolDefinitionInput!], $systemPrompt: String, $includeDetails: Boolean, $correlationId: String) {
3428
3405
  formatConversation(
3429
3406
  prompt: $prompt
3430
3407
  id: $id
3431
3408
  specification: $specification
3432
3409
  tools: $tools
3410
+ systemPrompt: $systemPrompt
3433
3411
  includeDetails: $includeDetails
3434
3412
  correlationId: $correlationId
3435
3413
  ) {
@@ -3553,6 +3531,7 @@ export const FormatConversation = gql `
3553
3531
  }
3554
3532
  tokens
3555
3533
  throughput
3534
+ ttft
3556
3535
  completionTime
3557
3536
  timestamp
3558
3537
  modelService
@@ -3731,6 +3710,7 @@ export const FormatConversation = gql `
3731
3710
  }
3732
3711
  tokens
3733
3712
  throughput
3713
+ ttft
3734
3714
  completionTime
3735
3715
  timestamp
3736
3716
  modelService
@@ -3874,6 +3854,7 @@ export const GetConversation = gql `
3874
3854
  }
3875
3855
  tokens
3876
3856
  throughput
3857
+ ttft
3877
3858
  completionTime
3878
3859
  timestamp
3879
3860
  modelService
@@ -4190,6 +4171,7 @@ export const Prompt = gql `
4190
4171
  }
4191
4172
  tokens
4192
4173
  throughput
4174
+ ttft
4193
4175
  completionTime
4194
4176
  timestamp
4195
4177
  modelService
@@ -4204,7 +4186,7 @@ export const Prompt = gql `
4204
4186
  }
4205
4187
  `;
4206
4188
  export const PromptConversation = gql `
4207
- mutation PromptConversation($prompt: String!, $mimeType: String, $data: String, $id: ID, $specification: EntityReferenceInput, $tools: [ToolDefinitionInput!], $requireTool: Boolean, $includeDetails: Boolean, $correlationId: String) {
4189
+ mutation PromptConversation($prompt: String!, $mimeType: String, $data: String, $id: ID, $specification: EntityReferenceInput, $systemPrompt: String, $tools: [ToolDefinitionInput!], $requireTool: Boolean, $includeDetails: Boolean, $correlationId: String) {
4208
4190
  promptConversation(
4209
4191
  prompt: $prompt
4210
4192
  id: $id
@@ -4212,6 +4194,7 @@ export const PromptConversation = gql `
4212
4194
  data: $data
4213
4195
  specification: $specification
4214
4196
  tools: $tools
4197
+ systemPrompt: $systemPrompt
4215
4198
  requireTool: $requireTool
4216
4199
  includeDetails: $includeDetails
4217
4200
  correlationId: $correlationId
@@ -4336,6 +4319,7 @@ export const PromptConversation = gql `
4336
4319
  }
4337
4320
  tokens
4338
4321
  throughput
4322
+ ttft
4339
4323
  completionTime
4340
4324
  timestamp
4341
4325
  modelService
@@ -4514,6 +4498,7 @@ export const PromptConversation = gql `
4514
4498
  }
4515
4499
  tokens
4516
4500
  throughput
4501
+ ttft
4517
4502
  completionTime
4518
4503
  timestamp
4519
4504
  modelService
@@ -4782,6 +4767,7 @@ export const QueryConversations = gql `
4782
4767
  }
4783
4768
  tokens
4784
4769
  throughput
4770
+ ttft
4785
4771
  completionTime
4786
4772
  timestamp
4787
4773
  modelService
@@ -5124,6 +5110,7 @@ export const ReviseContent = gql `
5124
5110
  }
5125
5111
  tokens
5126
5112
  throughput
5113
+ ttft
5127
5114
  completionTime
5128
5115
  timestamp
5129
5116
  modelService
@@ -5267,6 +5254,7 @@ export const ReviseEncodedImage = gql `
5267
5254
  }
5268
5255
  tokens
5269
5256
  throughput
5257
+ ttft
5270
5258
  completionTime
5271
5259
  timestamp
5272
5260
  modelService
@@ -5409,6 +5397,7 @@ export const ReviseImage = gql `
5409
5397
  }
5410
5398
  tokens
5411
5399
  throughput
5400
+ ttft
5412
5401
  completionTime
5413
5402
  timestamp
5414
5403
  modelService
@@ -5551,6 +5540,7 @@ export const ReviseText = gql `
5551
5540
  }
5552
5541
  tokens
5553
5542
  throughput
5543
+ ttft
5554
5544
  completionTime
5555
5545
  timestamp
5556
5546
  modelService
@@ -6297,14 +6287,20 @@ export const QueryMicrosoftTeamsTeams = gql `
6297
6287
  export const QueryNotionDatabases = gql `
6298
6288
  query QueryNotionDatabases($properties: NotionDatabasesInput!) {
6299
6289
  notionDatabases(properties: $properties) {
6300
- results
6290
+ results {
6291
+ name
6292
+ identifier
6293
+ }
6301
6294
  }
6302
6295
  }
6303
6296
  `;
6304
6297
  export const QueryNotionPages = gql `
6305
6298
  query QueryNotionPages($properties: NotionPagesInput!, $identifier: String!) {
6306
6299
  notionPages(properties: $properties, identifier: $identifier) {
6307
- results
6300
+ results {
6301
+ name
6302
+ identifier
6303
+ }
6308
6304
  }
6309
6305
  }
6310
6306
  `;
@@ -8587,6 +8583,7 @@ export const PromptSpecifications = gql `
8587
8583
  }
8588
8584
  tokens
8589
8585
  throughput
8586
+ ttft
8590
8587
  completionTime
8591
8588
  timestamp
8592
8589
  modelService
@@ -8618,6 +8615,7 @@ export const QueryModels = gql `
8618
8615
  useCases
8619
8616
  }
8620
8617
  metadata {
8618
+ reasoning
8621
8619
  multilingual
8622
8620
  multimodal
8623
8621
  knowledgeCutoff
@@ -2402,11 +2402,15 @@ export type ConversationMessage = {
2402
2402
  toolCallResponse?: Maybe<Scalars['String']['output']>;
2403
2403
  /** The tools called during the prompting of the conversation. You will need to call continueConversation with the tool responses to continue the conversation. */
2404
2404
  toolCalls?: Maybe<Array<Maybe<ConversationToolCall>>>;
2405
+ /** The time to first token (TTFT) for the model to complete the prompt, only provided with assistant role. */
2406
+ ttft?: Maybe<Scalars['TimeSpan']['output']>;
2405
2407
  };
2406
2408
  /** Represents a conversation message. */
2407
2409
  export type ConversationMessageInput = {
2408
2410
  /** The conversation message author. */
2409
2411
  author?: InputMaybe<Scalars['String']['input']>;
2412
+ /** The elapsed time for the model to complete the prompt. */
2413
+ completionTime?: InputMaybe<Scalars['TimeSpan']['input']>;
2410
2414
  /** The Base64-encoded image which will be supplied to the LLM with the conversation message, optional. */
2411
2415
  data?: InputMaybe<Scalars['String']['input']>;
2412
2416
  /** The conversation message. */
@@ -2415,6 +2419,14 @@ export type ConversationMessageInput = {
2415
2419
  mimeType?: InputMaybe<Scalars['String']['input']>;
2416
2420
  /** The conversation message role. */
2417
2421
  role: ConversationRoleTypes;
2422
+ /** The LLM completion throughput in tokens/second, only provided with assistant role. */
2423
+ throughput?: InputMaybe<Scalars['Float']['input']>;
2424
+ /** The conversation message timestamp. */
2425
+ timestamp?: InputMaybe<Scalars['DateTime']['input']>;
2426
+ /** The conversation message token usage, not including RAG context tokens. */
2427
+ tokens?: InputMaybe<Scalars['Int']['input']>;
2428
+ /** The time to first token (TTFT) for the model to complete the prompt. */
2429
+ ttft?: InputMaybe<Scalars['TimeSpan']['input']>;
2418
2430
  };
2419
2431
  /** Represents conversation query results. */
2420
2432
  export type ConversationResults = {
@@ -7625,6 +7637,8 @@ export type ModelMetadata = {
7625
7637
  multimodal?: Maybe<Scalars['Boolean']['output']>;
7626
7638
  /** The prompt cost per-million tokens. */
7627
7639
  promptCostPerMillion?: Maybe<Scalars['Float']['output']>;
7640
+ /** Whether the model supports reasoning. */
7641
+ reasoning?: Maybe<Scalars['Boolean']['output']>;
7628
7642
  /** The reranking cost per-million tokens. */
7629
7643
  rerankingCostPerMillion?: Maybe<Scalars['Float']['output']>;
7630
7644
  };
@@ -8127,8 +8141,11 @@ export type MutationCloseConversationArgs = {
8127
8141
  };
8128
8142
  export type MutationCompleteConversationArgs = {
8129
8143
  completion: Scalars['String']['input'];
8144
+ completionTime?: InputMaybe<Scalars['TimeSpan']['input']>;
8130
8145
  correlationId?: InputMaybe<Scalars['String']['input']>;
8131
8146
  id: Scalars['ID']['input'];
8147
+ throughput?: InputMaybe<Scalars['Float']['input']>;
8148
+ ttft?: InputMaybe<Scalars['TimeSpan']['input']>;
8132
8149
  };
8133
8150
  export type MutationContinueConversationArgs = {
8134
8151
  correlationId?: InputMaybe<Scalars['String']['input']>;
@@ -8611,6 +8628,7 @@ export type MutationFormatConversationArgs = {
8611
8628
  includeDetails?: InputMaybe<Scalars['Boolean']['input']>;
8612
8629
  prompt: Scalars['String']['input'];
8613
8630
  specification?: InputMaybe<EntityReferenceInput>;
8631
+ systemPrompt?: InputMaybe<Scalars['String']['input']>;
8614
8632
  tools?: InputMaybe<Array<ToolDefinitionInput>>;
8615
8633
  };
8616
8634
  export type MutationIngestBatchArgs = {
@@ -8722,6 +8740,7 @@ export type MutationPromptConversationArgs = {
8722
8740
  prompt: Scalars['String']['input'];
8723
8741
  requireTool?: InputMaybe<Scalars['Boolean']['input']>;
8724
8742
  specification?: InputMaybe<EntityReferenceInput>;
8743
+ systemPrompt?: InputMaybe<Scalars['String']['input']>;
8725
8744
  tools?: InputMaybe<Array<ToolDefinitionInput>>;
8726
8745
  };
8727
8746
  export type MutationPromptSpecificationsArgs = {
@@ -8968,6 +8987,20 @@ export type NamedEntityReferenceInput = {
8968
8987
  /** The name of the entity. */
8969
8988
  name?: InputMaybe<Scalars['String']['input']>;
8970
8989
  };
8990
+ /** Represents a Notion database. */
8991
+ export type NotionDatabaseResult = {
8992
+ __typename?: 'NotionDatabaseResult';
8993
+ /** The Notion database identifier. */
8994
+ identifier?: Maybe<Scalars['String']['output']>;
8995
+ /** The Notion database name. */
8996
+ name?: Maybe<Scalars['ID']['output']>;
8997
+ };
8998
+ /** Represents Notion libraries. */
8999
+ export type NotionDatabaseResults = {
9000
+ __typename?: 'NotionDatabaseResults';
9001
+ /** The Notion databases. */
9002
+ results?: Maybe<Array<Maybe<NotionDatabaseResult>>>;
9003
+ };
8971
9004
  /** Represents Notion databases properties. */
8972
9005
  export type NotionDatabasesInput = {
8973
9006
  /** Notion integration token. */
@@ -9013,6 +9046,20 @@ export type NotionFeedPropertiesUpdateInput = {
9013
9046
  /** Notion object type, i.e. page or database. */
9014
9047
  type?: InputMaybe<NotionTypes>;
9015
9048
  };
9049
+ /** Represents a Notion page. */
9050
+ export type NotionPageResult = {
9051
+ __typename?: 'NotionPageResult';
9052
+ /** The Notion page identifier. */
9053
+ identifier?: Maybe<Scalars['String']['output']>;
9054
+ /** The Notion page name. */
9055
+ name?: Maybe<Scalars['ID']['output']>;
9056
+ };
9057
+ /** Represents Notion libraries. */
9058
+ export type NotionPageResults = {
9059
+ __typename?: 'NotionPageResults';
9060
+ /** The Notion pages. */
9061
+ results?: Maybe<Array<Maybe<NotionPageResult>>>;
9062
+ };
9016
9063
  /** Represents Notion pages properties. */
9017
9064
  export type NotionPagesInput = {
9018
9065
  /** Notion integration token. */
@@ -11143,9 +11190,9 @@ export type Query = {
11143
11190
  /** Retrieves available LLMs, embedding models and reranker models. */
11144
11191
  models?: Maybe<ModelCardResults>;
11145
11192
  /** Retrieves available Notion databases. */
11146
- notionDatabases?: Maybe<StringResults>;
11193
+ notionDatabases?: Maybe<NotionDatabaseResults>;
11147
11194
  /** Retrieves available Notion pages within Notion database, non-recursive. */
11148
- notionPages?: Maybe<StringResults>;
11195
+ notionPages?: Maybe<NotionPageResults>;
11149
11196
  /** Lookup a observation given its ID. */
11150
11197
  observation?: Maybe<Observation>;
11151
11198
  /** Retrieves available OneDrive folders. */
@@ -14565,7 +14612,6 @@ export type GetCollectionQuery = {
14565
14612
  id: string;
14566
14613
  name: string;
14567
14614
  creationDate: any;
14568
- relevance?: number | null;
14569
14615
  state: EntityState;
14570
14616
  type?: CollectionTypes | null;
14571
14617
  owner: {
@@ -14599,11 +14645,6 @@ export type QueryCollectionsQuery = {
14599
14645
  __typename?: 'Owner';
14600
14646
  id: string;
14601
14647
  };
14602
- contents?: Array<{
14603
- __typename?: 'Content';
14604
- id: string;
14605
- name: string;
14606
- } | null> | null;
14607
14648
  }> | null;
14608
14649
  } | null;
14609
14650
  };
@@ -14702,6 +14743,7 @@ export type DescribeEncodedImageMutation = {
14702
14743
  message?: string | null;
14703
14744
  tokens?: number | null;
14704
14745
  throughput?: number | null;
14746
+ ttft?: any | null;
14705
14747
  completionTime?: any | null;
14706
14748
  timestamp?: any | null;
14707
14749
  modelService?: ModelServiceTypes | null;
@@ -14845,6 +14887,7 @@ export type DescribeImageMutation = {
14845
14887
  message?: string | null;
14846
14888
  tokens?: number | null;
14847
14889
  throughput?: number | null;
14890
+ ttft?: any | null;
14848
14891
  completionTime?: any | null;
14849
14892
  timestamp?: any | null;
14850
14893
  modelService?: ModelServiceTypes | null;
@@ -16589,39 +16632,6 @@ export type QueryContentsQuery = {
16589
16632
  uri?: any | null;
16590
16633
  linkType?: LinkTypes | null;
16591
16634
  }> | null;
16592
- observations?: Array<{
16593
- __typename?: 'Observation';
16594
- id: string;
16595
- type: ObservableTypes;
16596
- relatedType?: ObservableTypes | null;
16597
- relation?: string | null;
16598
- state: EntityState;
16599
- observable: {
16600
- __typename?: 'NamedEntityReference';
16601
- id: string;
16602
- name?: string | null;
16603
- };
16604
- related?: {
16605
- __typename?: 'NamedEntityReference';
16606
- id: string;
16607
- name?: string | null;
16608
- } | null;
16609
- occurrences?: Array<{
16610
- __typename?: 'ObservationOccurrence';
16611
- type?: OccurrenceTypes | null;
16612
- confidence?: number | null;
16613
- startTime?: any | null;
16614
- endTime?: any | null;
16615
- pageIndex?: number | null;
16616
- boundingBox?: {
16617
- __typename?: 'BoundingBox';
16618
- left?: number | null;
16619
- top?: number | null;
16620
- width?: number | null;
16621
- height?: number | null;
16622
- } | null;
16623
- } | null> | null;
16624
- } | null> | null;
16625
16635
  workflow?: {
16626
16636
  __typename?: 'Workflow';
16627
16637
  id: string;
@@ -16922,6 +16932,7 @@ export type AskGraphlitMutation = {
16922
16932
  message?: string | null;
16923
16933
  tokens?: number | null;
16924
16934
  throughput?: number | null;
16935
+ ttft?: any | null;
16925
16936
  completionTime?: any | null;
16926
16937
  timestamp?: any | null;
16927
16938
  modelService?: ModelServiceTypes | null;
@@ -17093,6 +17104,9 @@ export type CloseConversationMutation = {
17093
17104
  export type CompleteConversationMutationVariables = Exact<{
17094
17105
  completion: Scalars['String']['input'];
17095
17106
  id: Scalars['ID']['input'];
17107
+ completionTime?: InputMaybe<Scalars['TimeSpan']['input']>;
17108
+ ttft?: InputMaybe<Scalars['TimeSpan']['input']>;
17109
+ throughput?: InputMaybe<Scalars['Float']['input']>;
17096
17110
  correlationId?: InputMaybe<Scalars['String']['input']>;
17097
17111
  }>;
17098
17112
  export type CompleteConversationMutation = {
@@ -17111,6 +17125,7 @@ export type CompleteConversationMutation = {
17111
17125
  message?: string | null;
17112
17126
  tokens?: number | null;
17113
17127
  throughput?: number | null;
17128
+ ttft?: any | null;
17114
17129
  completionTime?: any | null;
17115
17130
  timestamp?: any | null;
17116
17131
  modelService?: ModelServiceTypes | null;
@@ -17304,6 +17319,7 @@ export type CompleteConversationMutation = {
17304
17319
  message?: string | null;
17305
17320
  tokens?: number | null;
17306
17321
  throughput?: number | null;
17322
+ ttft?: any | null;
17307
17323
  completionTime?: any | null;
17308
17324
  timestamp?: any | null;
17309
17325
  modelService?: ModelServiceTypes | null;
@@ -17455,6 +17471,7 @@ export type ContinueConversationMutation = {
17455
17471
  message?: string | null;
17456
17472
  tokens?: number | null;
17457
17473
  throughput?: number | null;
17474
+ ttft?: any | null;
17458
17475
  completionTime?: any | null;
17459
17476
  timestamp?: any | null;
17460
17477
  modelService?: ModelServiceTypes | null;
@@ -17648,6 +17665,7 @@ export type ContinueConversationMutation = {
17648
17665
  message?: string | null;
17649
17666
  tokens?: number | null;
17650
17667
  throughput?: number | null;
17668
+ ttft?: any | null;
17651
17669
  completionTime?: any | null;
17652
17670
  timestamp?: any | null;
17653
17671
  modelService?: ModelServiceTypes | null;
@@ -17844,6 +17862,7 @@ export type FormatConversationMutationVariables = Exact<{
17844
17862
  id?: InputMaybe<Scalars['ID']['input']>;
17845
17863
  specification?: InputMaybe<EntityReferenceInput>;
17846
17864
  tools?: InputMaybe<Array<ToolDefinitionInput> | ToolDefinitionInput>;
17865
+ systemPrompt?: InputMaybe<Scalars['String']['input']>;
17847
17866
  includeDetails?: InputMaybe<Scalars['Boolean']['input']>;
17848
17867
  correlationId?: InputMaybe<Scalars['String']['input']>;
17849
17868
  }>;
@@ -17863,6 +17882,7 @@ export type FormatConversationMutation = {
17863
17882
  message?: string | null;
17864
17883
  tokens?: number | null;
17865
17884
  throughput?: number | null;
17885
+ ttft?: any | null;
17866
17886
  completionTime?: any | null;
17867
17887
  timestamp?: any | null;
17868
17888
  modelService?: ModelServiceTypes | null;
@@ -18056,6 +18076,7 @@ export type FormatConversationMutation = {
18056
18076
  message?: string | null;
18057
18077
  tokens?: number | null;
18058
18078
  throughput?: number | null;
18079
+ ttft?: any | null;
18059
18080
  completionTime?: any | null;
18060
18081
  timestamp?: any | null;
18061
18082
  modelService?: ModelServiceTypes | null;
@@ -18212,6 +18233,7 @@ export type GetConversationQuery = {
18212
18233
  message?: string | null;
18213
18234
  tokens?: number | null;
18214
18235
  throughput?: number | null;
18236
+ ttft?: any | null;
18215
18237
  completionTime?: any | null;
18216
18238
  timestamp?: any | null;
18217
18239
  modelService?: ModelServiceTypes | null;
@@ -18591,6 +18613,7 @@ export type PromptMutation = {
18591
18613
  message?: string | null;
18592
18614
  tokens?: number | null;
18593
18615
  throughput?: number | null;
18616
+ ttft?: any | null;
18594
18617
  completionTime?: any | null;
18595
18618
  timestamp?: any | null;
18596
18619
  modelService?: ModelServiceTypes | null;
@@ -18726,6 +18749,7 @@ export type PromptConversationMutationVariables = Exact<{
18726
18749
  data?: InputMaybe<Scalars['String']['input']>;
18727
18750
  id?: InputMaybe<Scalars['ID']['input']>;
18728
18751
  specification?: InputMaybe<EntityReferenceInput>;
18752
+ systemPrompt?: InputMaybe<Scalars['String']['input']>;
18729
18753
  tools?: InputMaybe<Array<ToolDefinitionInput> | ToolDefinitionInput>;
18730
18754
  requireTool?: InputMaybe<Scalars['Boolean']['input']>;
18731
18755
  includeDetails?: InputMaybe<Scalars['Boolean']['input']>;
@@ -18747,6 +18771,7 @@ export type PromptConversationMutation = {
18747
18771
  message?: string | null;
18748
18772
  tokens?: number | null;
18749
18773
  throughput?: number | null;
18774
+ ttft?: any | null;
18750
18775
  completionTime?: any | null;
18751
18776
  timestamp?: any | null;
18752
18777
  modelService?: ModelServiceTypes | null;
@@ -18940,6 +18965,7 @@ export type PromptConversationMutation = {
18940
18965
  message?: string | null;
18941
18966
  tokens?: number | null;
18942
18967
  throughput?: number | null;
18968
+ ttft?: any | null;
18943
18969
  completionTime?: any | null;
18944
18970
  timestamp?: any | null;
18945
18971
  modelService?: ModelServiceTypes | null;
@@ -19230,6 +19256,7 @@ export type QueryConversationsQuery = {
19230
19256
  message?: string | null;
19231
19257
  tokens?: number | null;
19232
19258
  throughput?: number | null;
19259
+ ttft?: any | null;
19233
19260
  completionTime?: any | null;
19234
19261
  timestamp?: any | null;
19235
19262
  modelService?: ModelServiceTypes | null;
@@ -19638,6 +19665,7 @@ export type ReviseContentMutation = {
19638
19665
  message?: string | null;
19639
19666
  tokens?: number | null;
19640
19667
  throughput?: number | null;
19668
+ ttft?: any | null;
19641
19669
  completionTime?: any | null;
19642
19670
  timestamp?: any | null;
19643
19671
  modelService?: ModelServiceTypes | null;
@@ -19791,6 +19819,7 @@ export type ReviseEncodedImageMutation = {
19791
19819
  message?: string | null;
19792
19820
  tokens?: number | null;
19793
19821
  throughput?: number | null;
19822
+ ttft?: any | null;
19794
19823
  completionTime?: any | null;
19795
19824
  timestamp?: any | null;
19796
19825
  modelService?: ModelServiceTypes | null;
@@ -19943,6 +19972,7 @@ export type ReviseImageMutation = {
19943
19972
  message?: string | null;
19944
19973
  tokens?: number | null;
19945
19974
  throughput?: number | null;
19975
+ ttft?: any | null;
19946
19976
  completionTime?: any | null;
19947
19977
  timestamp?: any | null;
19948
19978
  modelService?: ModelServiceTypes | null;
@@ -20095,6 +20125,7 @@ export type ReviseTextMutation = {
20095
20125
  message?: string | null;
20096
20126
  tokens?: number | null;
20097
20127
  throughput?: number | null;
20128
+ ttft?: any | null;
20098
20129
  completionTime?: any | null;
20099
20130
  timestamp?: any | null;
20100
20131
  modelService?: ModelServiceTypes | null;
@@ -21118,8 +21149,12 @@ export type QueryNotionDatabasesQueryVariables = Exact<{
21118
21149
  export type QueryNotionDatabasesQuery = {
21119
21150
  __typename?: 'Query';
21120
21151
  notionDatabases?: {
21121
- __typename?: 'StringResults';
21122
- results?: Array<string> | null;
21152
+ __typename?: 'NotionDatabaseResults';
21153
+ results?: Array<{
21154
+ __typename?: 'NotionDatabaseResult';
21155
+ name?: string | null;
21156
+ identifier?: string | null;
21157
+ } | null> | null;
21123
21158
  } | null;
21124
21159
  };
21125
21160
  export type QueryNotionPagesQueryVariables = Exact<{
@@ -21129,8 +21164,12 @@ export type QueryNotionPagesQueryVariables = Exact<{
21129
21164
  export type QueryNotionPagesQuery = {
21130
21165
  __typename?: 'Query';
21131
21166
  notionPages?: {
21132
- __typename?: 'StringResults';
21133
- results?: Array<string> | null;
21167
+ __typename?: 'NotionPageResults';
21168
+ results?: Array<{
21169
+ __typename?: 'NotionPageResult';
21170
+ name?: string | null;
21171
+ identifier?: string | null;
21172
+ } | null> | null;
21134
21173
  } | null;
21135
21174
  };
21136
21175
  export type QueryOneDriveFoldersQueryVariables = Exact<{
@@ -23908,6 +23947,7 @@ export type PromptSpecificationsMutation = {
23908
23947
  message?: string | null;
23909
23948
  tokens?: number | null;
23910
23949
  throughput?: number | null;
23950
+ ttft?: any | null;
23911
23951
  completionTime?: any | null;
23912
23952
  timestamp?: any | null;
23913
23953
  modelService?: ModelServiceTypes | null;
@@ -24062,6 +24102,7 @@ export type QueryModelsQuery = {
24062
24102
  } | null;
24063
24103
  metadata?: {
24064
24104
  __typename?: 'ModelMetadata';
24105
+ reasoning?: boolean | null;
24065
24106
  multilingual?: boolean | null;
24066
24107
  multimodal?: boolean | null;
24067
24108
  knowledgeCutoff?: any | null;
@@ -25,6 +25,7 @@ export declare class UIEventAdapter {
25
25
  private smoothingDelay;
26
26
  private chunkQueue;
27
27
  private contextWindowUsage?;
28
+ private finalMetrics?;
28
29
  constructor(onEvent: (event: AgentStreamEvent) => void, conversationId: string, options?: {
29
30
  smoothingEnabled?: boolean;
30
31
  chunkingStrategy?: ChunkingStrategy;
@@ -55,4 +56,16 @@ export declare class UIEventAdapter {
55
56
  * Clean up any pending timers
56
57
  */
57
58
  dispose(): void;
59
+ /**
60
+ * Get the total completion time in milliseconds
61
+ */
62
+ getCompletionTime(): number | undefined;
63
+ /**
64
+ * Get the time to first token in milliseconds
65
+ */
66
+ getTTFT(): number | undefined;
67
+ /**
68
+ * Get the throughput in tokens per second
69
+ */
70
+ getThroughput(): number | undefined;
58
71
  }
@@ -24,6 +24,7 @@ export class UIEventAdapter {
24
24
  smoothingDelay = 30;
25
25
  chunkQueue = []; // Queue of chunks waiting to be emitted
26
26
  contextWindowUsage;
27
+ finalMetrics;
27
28
  constructor(onEvent, conversationId, options = {}) {
28
29
  this.onEvent = onEvent;
29
30
  this.conversationId = conversationId;
@@ -327,6 +328,8 @@ export class UIEventAdapter {
327
328
  finalMetrics.streamingThroughput = Math.round((this.currentMessage.length / streamingTime) * 1000);
328
329
  }
329
330
  }
331
+ // Store final metrics for later retrieval
332
+ this.finalMetrics = finalMetrics;
330
333
  // Include context window usage if available
331
334
  const event = {
332
335
  type: "conversation_completed",
@@ -499,4 +502,22 @@ export class UIEventAdapter {
499
502
  }
500
503
  this.activeToolCalls.clear();
501
504
  }
505
+ /**
506
+ * Get the total completion time in milliseconds
507
+ */
508
+ getCompletionTime() {
509
+ return this.finalMetrics?.totalTime;
510
+ }
511
+ /**
512
+ * Get the time to first token in milliseconds
513
+ */
514
+ getTTFT() {
515
+ return this.finalMetrics?.ttft;
516
+ }
517
+ /**
518
+ * Get the throughput in tokens per second
519
+ */
520
+ getThroughput() {
521
+ return this.finalMetrics?.streamingThroughput;
522
+ }
502
523
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20250620002",
3
+ "version": "1.0.20250621001",
4
4
  "description": "Graphlit API Client for TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/client.js",