@antfly/sdk 0.0.6 → 0.0.7

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/index.cjs CHANGED
@@ -610,7 +610,7 @@ var AntflyClient = class {
610
610
  break;
611
611
  case "reasoning":
612
612
  if (callbacks.onReasoning) {
613
- callbacks.onReasoning(data);
613
+ callbacks.onReasoning(JSON.parse(data));
614
614
  }
615
615
  break;
616
616
  case "hits_start":
@@ -633,7 +633,7 @@ var AntflyClient = class {
633
633
  break;
634
634
  case "answer":
635
635
  if (callbacks.onAnswer) {
636
- callbacks.onAnswer(data);
636
+ callbacks.onAnswer(JSON.parse(data));
637
637
  }
638
638
  break;
639
639
  case "confidence":
@@ -644,7 +644,7 @@ var AntflyClient = class {
644
644
  break;
645
645
  case "followup_question":
646
646
  if (callbacks.onFollowUpQuestion) {
647
- callbacks.onFollowUpQuestion(data);
647
+ callbacks.onFollowUpQuestion(JSON.parse(data));
648
648
  }
649
649
  break;
650
650
  case "done":
@@ -808,7 +808,7 @@ var AntflyClient = class {
808
808
  break;
809
809
  case "answer":
810
810
  if (callbacks.onAnswer) {
811
- callbacks.onAnswer(data);
811
+ callbacks.onAnswer(JSON.parse(data));
812
812
  }
813
813
  break;
814
814
  case "done":
package/dist/index.d.cts CHANGED
@@ -1366,6 +1366,17 @@ interface components$1 {
1366
1366
  * @example What are the best gaming laptops under $2000?
1367
1367
  */
1368
1368
  query: string;
1369
+ /**
1370
+ * @description Background knowledge that guides the agent's understanding of the domain.
1371
+ * Similar to CLAUDE.md, this provides context that applies to all steps
1372
+ * (classification, retrieval, and answer generation).
1373
+ *
1374
+ * Examples:
1375
+ * - "This data contains medical records. Use clinical terminology and be precise about diagnoses."
1376
+ * - "This is a software engineering knowledge base. Assume a technical audience."
1377
+ * - "This table stores legal documents. Reference laws and regulations accurately."
1378
+ */
1379
+ agent_knowledge?: string;
1369
1380
  /**
1370
1381
  * @description Default generator configuration used for all pipeline steps unless overridden in `steps`.
1371
1382
  * This is the simple configuration - just set this and everything works with sensible defaults.
@@ -4404,6 +4415,22 @@ interface components$1 {
4404
4415
  EmbedderConfig: (components$1["schemas"]["GoogleEmbedderConfig"] | components$1["schemas"]["VertexEmbedderConfig"] | components$1["schemas"]["OllamaEmbedderConfig"] | components$1["schemas"]["OpenAIEmbedderConfig"] | components$1["schemas"]["BedrockEmbedderConfig"] | components$1["schemas"]["CohereEmbedderConfig"]) & {
4405
4416
  provider: components$1["schemas"]["EmbedderProvider"];
4406
4417
  };
4418
+ /** @description Per-request configuration for chunking. All fields are optional - zero/omitted values use chunker defaults. */
4419
+ ChunkOptions: {
4420
+ /** @description Maximum number of chunks to generate per document. */
4421
+ max_chunks?: number;
4422
+ /** @description Number of tokens to overlap between consecutive chunks. Helps maintain context across chunk boundaries. Only used by fixed-size chunkers. */
4423
+ overlap_tokens?: number;
4424
+ /** @description Separator string for splitting (e.g., '\n\n' for paragraphs). Only used by fixed-size chunkers. */
4425
+ separator?: string;
4426
+ /**
4427
+ * Format: float
4428
+ * @description Minimum confidence threshold for separator detection (0.0-1.0). Only used by ONNX models.
4429
+ */
4430
+ threshold?: number;
4431
+ /** @description Target number of tokens per chunk. */
4432
+ target_tokens?: number;
4433
+ };
4407
4434
  /**
4408
4435
  * @description Configuration for the Termite chunking provider.
4409
4436
  *
@@ -4429,7 +4456,7 @@ interface components$1 {
4429
4456
  * "full_text": {}
4430
4457
  * }
4431
4458
  */
4432
- TermiteChunkerConfig: {
4459
+ TermiteChunkerConfig: components$1["schemas"]["ChunkOptions"] & {
4433
4460
  /**
4434
4461
  * Format: uri
4435
4462
  * @description The URL of the Termite API endpoint (e.g., 'http://localhost:8080'). Can also be set via ANTFLY_TERMITE_URL environment variable.
@@ -4442,32 +4469,6 @@ interface components$1 {
4442
4469
  * @example fixed
4443
4470
  */
4444
4471
  model: string;
4445
- /**
4446
- * @description Target number of tokens per chunk. Chunker will aim for chunks around this size.
4447
- * @default 500
4448
- */
4449
- target_tokens?: number;
4450
- /**
4451
- * @description Number of tokens to overlap between consecutive chunks. Helps maintain context across chunk boundaries.
4452
- * @default 50
4453
- */
4454
- overlap_tokens?: number;
4455
- /**
4456
- * @description Separator string for splitting (e.g., '\n\n' for paragraphs). Only used with fixed strategy.
4457
- * @default
4458
- */
4459
- separator?: string;
4460
- /**
4461
- * @description Maximum number of chunks to generate per document. Prevents excessive chunking of very large documents.
4462
- * @default 50
4463
- */
4464
- max_chunks?: number;
4465
- /**
4466
- * Format: float
4467
- * @description Minimum confidence threshold for separator detection. Only used with ONNX-based models.
4468
- * @default 0.5
4469
- */
4470
- threshold?: number;
4471
4472
  /**
4472
4473
  * @description Configuration for full-text indexing of chunks in Bleve.
4473
4474
  * When present (even if empty), chunks will be stored with :cft: suffix and indexed in Bleve's _chunks field.
@@ -4503,27 +4504,7 @@ interface components$1 {
4503
4504
  * "max_chunks": 50
4504
4505
  * }
4505
4506
  */
4506
- AntflyChunkerConfig: {
4507
- /**
4508
- * @description Target number of tokens per chunk. Chunker will aim for chunks around this size.
4509
- * @default 500
4510
- */
4511
- target_tokens?: number;
4512
- /**
4513
- * @description Number of tokens to overlap between consecutive chunks. Helps maintain context across chunk boundaries.
4514
- * @default 50
4515
- */
4516
- overlap_tokens?: number;
4517
- /**
4518
- * @description Separator string for splitting (e.g., '\n\n' for paragraphs).
4519
- * @default
4520
- */
4521
- separator?: string;
4522
- /**
4523
- * @description Maximum number of chunks to generate per document. Prevents excessive chunking of very large documents.
4524
- * @default 50
4525
- */
4526
- max_chunks?: number;
4507
+ AntflyChunkerConfig: components$1["schemas"]["ChunkOptions"] & {
4527
4508
  /**
4528
4509
  * @description Configuration for full-text indexing of chunks in Bleve.
4529
4510
  * When present (even if empty), chunks will be stored with :cft: suffix and indexed in Bleve's _chunks field.
package/dist/index.d.ts CHANGED
@@ -1366,6 +1366,17 @@ interface components$1 {
1366
1366
  * @example What are the best gaming laptops under $2000?
1367
1367
  */
1368
1368
  query: string;
1369
+ /**
1370
+ * @description Background knowledge that guides the agent's understanding of the domain.
1371
+ * Similar to CLAUDE.md, this provides context that applies to all steps
1372
+ * (classification, retrieval, and answer generation).
1373
+ *
1374
+ * Examples:
1375
+ * - "This data contains medical records. Use clinical terminology and be precise about diagnoses."
1376
+ * - "This is a software engineering knowledge base. Assume a technical audience."
1377
+ * - "This table stores legal documents. Reference laws and regulations accurately."
1378
+ */
1379
+ agent_knowledge?: string;
1369
1380
  /**
1370
1381
  * @description Default generator configuration used for all pipeline steps unless overridden in `steps`.
1371
1382
  * This is the simple configuration - just set this and everything works with sensible defaults.
@@ -4404,6 +4415,22 @@ interface components$1 {
4404
4415
  EmbedderConfig: (components$1["schemas"]["GoogleEmbedderConfig"] | components$1["schemas"]["VertexEmbedderConfig"] | components$1["schemas"]["OllamaEmbedderConfig"] | components$1["schemas"]["OpenAIEmbedderConfig"] | components$1["schemas"]["BedrockEmbedderConfig"] | components$1["schemas"]["CohereEmbedderConfig"]) & {
4405
4416
  provider: components$1["schemas"]["EmbedderProvider"];
4406
4417
  };
4418
+ /** @description Per-request configuration for chunking. All fields are optional - zero/omitted values use chunker defaults. */
4419
+ ChunkOptions: {
4420
+ /** @description Maximum number of chunks to generate per document. */
4421
+ max_chunks?: number;
4422
+ /** @description Number of tokens to overlap between consecutive chunks. Helps maintain context across chunk boundaries. Only used by fixed-size chunkers. */
4423
+ overlap_tokens?: number;
4424
+ /** @description Separator string for splitting (e.g., '\n\n' for paragraphs). Only used by fixed-size chunkers. */
4425
+ separator?: string;
4426
+ /**
4427
+ * Format: float
4428
+ * @description Minimum confidence threshold for separator detection (0.0-1.0). Only used by ONNX models.
4429
+ */
4430
+ threshold?: number;
4431
+ /** @description Target number of tokens per chunk. */
4432
+ target_tokens?: number;
4433
+ };
4407
4434
  /**
4408
4435
  * @description Configuration for the Termite chunking provider.
4409
4436
  *
@@ -4429,7 +4456,7 @@ interface components$1 {
4429
4456
  * "full_text": {}
4430
4457
  * }
4431
4458
  */
4432
- TermiteChunkerConfig: {
4459
+ TermiteChunkerConfig: components$1["schemas"]["ChunkOptions"] & {
4433
4460
  /**
4434
4461
  * Format: uri
4435
4462
  * @description The URL of the Termite API endpoint (e.g., 'http://localhost:8080'). Can also be set via ANTFLY_TERMITE_URL environment variable.
@@ -4442,32 +4469,6 @@ interface components$1 {
4442
4469
  * @example fixed
4443
4470
  */
4444
4471
  model: string;
4445
- /**
4446
- * @description Target number of tokens per chunk. Chunker will aim for chunks around this size.
4447
- * @default 500
4448
- */
4449
- target_tokens?: number;
4450
- /**
4451
- * @description Number of tokens to overlap between consecutive chunks. Helps maintain context across chunk boundaries.
4452
- * @default 50
4453
- */
4454
- overlap_tokens?: number;
4455
- /**
4456
- * @description Separator string for splitting (e.g., '\n\n' for paragraphs). Only used with fixed strategy.
4457
- * @default
4458
- */
4459
- separator?: string;
4460
- /**
4461
- * @description Maximum number of chunks to generate per document. Prevents excessive chunking of very large documents.
4462
- * @default 50
4463
- */
4464
- max_chunks?: number;
4465
- /**
4466
- * Format: float
4467
- * @description Minimum confidence threshold for separator detection. Only used with ONNX-based models.
4468
- * @default 0.5
4469
- */
4470
- threshold?: number;
4471
4472
  /**
4472
4473
  * @description Configuration for full-text indexing of chunks in Bleve.
4473
4474
  * When present (even if empty), chunks will be stored with :cft: suffix and indexed in Bleve's _chunks field.
@@ -4503,27 +4504,7 @@ interface components$1 {
4503
4504
  * "max_chunks": 50
4504
4505
  * }
4505
4506
  */
4506
- AntflyChunkerConfig: {
4507
- /**
4508
- * @description Target number of tokens per chunk. Chunker will aim for chunks around this size.
4509
- * @default 500
4510
- */
4511
- target_tokens?: number;
4512
- /**
4513
- * @description Number of tokens to overlap between consecutive chunks. Helps maintain context across chunk boundaries.
4514
- * @default 50
4515
- */
4516
- overlap_tokens?: number;
4517
- /**
4518
- * @description Separator string for splitting (e.g., '\n\n' for paragraphs).
4519
- * @default
4520
- */
4521
- separator?: string;
4522
- /**
4523
- * @description Maximum number of chunks to generate per document. Prevents excessive chunking of very large documents.
4524
- * @default 50
4525
- */
4526
- max_chunks?: number;
4507
+ AntflyChunkerConfig: components$1["schemas"]["ChunkOptions"] & {
4527
4508
  /**
4528
4509
  * @description Configuration for full-text indexing of chunks in Bleve.
4529
4510
  * When present (even if empty), chunks will be stored with :cft: suffix and indexed in Bleve's _chunks field.
package/dist/index.js CHANGED
@@ -555,7 +555,7 @@ var AntflyClient = class {
555
555
  break;
556
556
  case "reasoning":
557
557
  if (callbacks.onReasoning) {
558
- callbacks.onReasoning(data);
558
+ callbacks.onReasoning(JSON.parse(data));
559
559
  }
560
560
  break;
561
561
  case "hits_start":
@@ -578,7 +578,7 @@ var AntflyClient = class {
578
578
  break;
579
579
  case "answer":
580
580
  if (callbacks.onAnswer) {
581
- callbacks.onAnswer(data);
581
+ callbacks.onAnswer(JSON.parse(data));
582
582
  }
583
583
  break;
584
584
  case "confidence":
@@ -589,7 +589,7 @@ var AntflyClient = class {
589
589
  break;
590
590
  case "followup_question":
591
591
  if (callbacks.onFollowUpQuestion) {
592
- callbacks.onFollowUpQuestion(data);
592
+ callbacks.onFollowUpQuestion(JSON.parse(data));
593
593
  }
594
594
  break;
595
595
  case "done":
@@ -753,7 +753,7 @@ var AntflyClient = class {
753
753
  break;
754
754
  case "answer":
755
755
  if (callbacks.onAnswer) {
756
- callbacks.onAnswer(data);
756
+ callbacks.onAnswer(JSON.parse(data));
757
757
  }
758
758
  break;
759
759
  case "done":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antfly/sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "TypeScript SDK for Antfly API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",