@probeo/anymodel 0.4.0 → 0.5.1

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.d.cts CHANGED
@@ -77,6 +77,7 @@ interface ChatCompletionRequest {
77
77
  tools?: Tool[];
78
78
  tool_choice?: ToolChoice;
79
79
  user?: string;
80
+ service_tier?: 'auto' | 'flex';
80
81
  models?: string[];
81
82
  route?: 'fallback';
82
83
  transforms?: string[];
@@ -455,6 +456,7 @@ declare class BatchManager {
455
456
  private syncNativeBatchStatus;
456
457
  /**
457
458
  * Process batch requests concurrently (fallback path).
459
+ * Streams requests from disk to avoid holding them all in memory.
458
460
  */
459
461
  private processConcurrentBatch;
460
462
  }
@@ -574,6 +576,10 @@ declare class BatchStore {
574
576
  * List all batch IDs.
575
577
  */
576
578
  listBatches(): Promise<string[]>;
579
+ /**
580
+ * Stream requests from JSONL one line at a time (memory-efficient).
581
+ */
582
+ streamRequests(id: string): AsyncGenerator<unknown>;
577
583
  /**
578
584
  * Check if a batch exists.
579
585
  */
@@ -629,4 +635,21 @@ declare function createOpenAIBatchAdapter(apiKey: string): BatchAdapter;
629
635
 
630
636
  declare function createAnthropicBatchAdapter(apiKey: string): BatchAdapter;
631
637
 
632
- export { AnyModel, type AnyModelConfig, AnyModelError, type AnyModelErrorMetadata, type BatchAdapter, type BatchCreateRequest, BatchManager, type BatchMode, type BatchObject, type BatchPollOptions, type BatchRequestItem, type BatchResultItem, type BatchResults, type BatchStatus, BatchStore, type BatchUsageSummary, type ChatCompletion, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionRequest, type ChunkChoice, type ChunkDelta, type ContentPart, type CustomProviderConfig, type FinishReason, type GenerationStats, GenerationStatsStore, type Message, type ModelArchitecture, type ModelInfo, type ModelPricing, type ModelTopProvider, type NativeBatchStatus, type ProviderAdapter, type ProviderConfig, type ProviderPreferences, type ResponseFormat, type Role, type ServerOptions, type Tool, type ToolCall, type ToolChoice, type Usage, appendFileQueued, configureFsIO, createAnthropicBatchAdapter, createAnyModelServer, createOpenAIBatchAdapter, ensureDir, getFsQueueStatus, joinPath, readFileQueued, resolveConfig, startServer, waitForFsQueuesIdle, writeFileFlushedQueued, writeFileQueued };
638
+ declare function createGoogleBatchAdapter(apiKey: string): BatchAdapter;
639
+
640
+ /**
641
+ * Rough token estimation and model-limit lookups for automatic max_tokens calculation.
642
+ */
643
+ /** Estimate the number of tokens in a string (~4 chars per token). */
644
+ declare function estimateTokenCount(text: string): number;
645
+ /**
646
+ * Determine the best max_tokens value for a request.
647
+ *
648
+ * - If the caller already supplied a value, return it unchanged.
649
+ * - Otherwise estimate input tokens, apply a 5 % safety margin, then
650
+ * return min(maxCompletionTokens, contextLength - estimatedInput).
651
+ * - The result is clamped to at least 1.
652
+ */
653
+ declare function resolveMaxTokens(model: string, messages: unknown[], userMaxTokens?: number): number;
654
+
655
+ export { AnyModel, type AnyModelConfig, AnyModelError, type AnyModelErrorMetadata, type BatchAdapter, type BatchCreateRequest, BatchManager, type BatchMode, type BatchObject, type BatchPollOptions, type BatchRequestItem, type BatchResultItem, type BatchResults, type BatchStatus, BatchStore, type BatchUsageSummary, type ChatCompletion, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionRequest, type ChunkChoice, type ChunkDelta, type ContentPart, type CustomProviderConfig, type FinishReason, type GenerationStats, GenerationStatsStore, type Message, type ModelArchitecture, type ModelInfo, type ModelPricing, type ModelTopProvider, type NativeBatchStatus, type ProviderAdapter, type ProviderConfig, type ProviderPreferences, type ResponseFormat, type Role, type ServerOptions, type Tool, type ToolCall, type ToolChoice, type Usage, appendFileQueued, configureFsIO, createAnthropicBatchAdapter, createAnyModelServer, createGoogleBatchAdapter, createOpenAIBatchAdapter, ensureDir, estimateTokenCount, getFsQueueStatus, joinPath, readFileQueued, resolveConfig, resolveMaxTokens, startServer, waitForFsQueuesIdle, writeFileFlushedQueued, writeFileQueued };
package/dist/index.d.ts CHANGED
@@ -77,6 +77,7 @@ interface ChatCompletionRequest {
77
77
  tools?: Tool[];
78
78
  tool_choice?: ToolChoice;
79
79
  user?: string;
80
+ service_tier?: 'auto' | 'flex';
80
81
  models?: string[];
81
82
  route?: 'fallback';
82
83
  transforms?: string[];
@@ -455,6 +456,7 @@ declare class BatchManager {
455
456
  private syncNativeBatchStatus;
456
457
  /**
457
458
  * Process batch requests concurrently (fallback path).
459
+ * Streams requests from disk to avoid holding them all in memory.
458
460
  */
459
461
  private processConcurrentBatch;
460
462
  }
@@ -574,6 +576,10 @@ declare class BatchStore {
574
576
  * List all batch IDs.
575
577
  */
576
578
  listBatches(): Promise<string[]>;
579
+ /**
580
+ * Stream requests from JSONL one line at a time (memory-efficient).
581
+ */
582
+ streamRequests(id: string): AsyncGenerator<unknown>;
577
583
  /**
578
584
  * Check if a batch exists.
579
585
  */
@@ -629,4 +635,21 @@ declare function createOpenAIBatchAdapter(apiKey: string): BatchAdapter;
629
635
 
630
636
  declare function createAnthropicBatchAdapter(apiKey: string): BatchAdapter;
631
637
 
632
- export { AnyModel, type AnyModelConfig, AnyModelError, type AnyModelErrorMetadata, type BatchAdapter, type BatchCreateRequest, BatchManager, type BatchMode, type BatchObject, type BatchPollOptions, type BatchRequestItem, type BatchResultItem, type BatchResults, type BatchStatus, BatchStore, type BatchUsageSummary, type ChatCompletion, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionRequest, type ChunkChoice, type ChunkDelta, type ContentPart, type CustomProviderConfig, type FinishReason, type GenerationStats, GenerationStatsStore, type Message, type ModelArchitecture, type ModelInfo, type ModelPricing, type ModelTopProvider, type NativeBatchStatus, type ProviderAdapter, type ProviderConfig, type ProviderPreferences, type ResponseFormat, type Role, type ServerOptions, type Tool, type ToolCall, type ToolChoice, type Usage, appendFileQueued, configureFsIO, createAnthropicBatchAdapter, createAnyModelServer, createOpenAIBatchAdapter, ensureDir, getFsQueueStatus, joinPath, readFileQueued, resolveConfig, startServer, waitForFsQueuesIdle, writeFileFlushedQueued, writeFileQueued };
638
+ declare function createGoogleBatchAdapter(apiKey: string): BatchAdapter;
639
+
640
+ /**
641
+ * Rough token estimation and model-limit lookups for automatic max_tokens calculation.
642
+ */
643
+ /** Estimate the number of tokens in a string (~4 chars per token). */
644
+ declare function estimateTokenCount(text: string): number;
645
+ /**
646
+ * Determine the best max_tokens value for a request.
647
+ *
648
+ * - If the caller already supplied a value, return it unchanged.
649
+ * - Otherwise estimate input tokens, apply a 5 % safety margin, then
650
+ * return min(maxCompletionTokens, contextLength - estimatedInput).
651
+ * - The result is clamped to at least 1.
652
+ */
653
+ declare function resolveMaxTokens(model: string, messages: unknown[], userMaxTokens?: number): number;
654
+
655
+ export { AnyModel, type AnyModelConfig, AnyModelError, type AnyModelErrorMetadata, type BatchAdapter, type BatchCreateRequest, BatchManager, type BatchMode, type BatchObject, type BatchPollOptions, type BatchRequestItem, type BatchResultItem, type BatchResults, type BatchStatus, BatchStore, type BatchUsageSummary, type ChatCompletion, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionRequest, type ChunkChoice, type ChunkDelta, type ContentPart, type CustomProviderConfig, type FinishReason, type GenerationStats, GenerationStatsStore, type Message, type ModelArchitecture, type ModelInfo, type ModelPricing, type ModelTopProvider, type NativeBatchStatus, type ProviderAdapter, type ProviderConfig, type ProviderPreferences, type ResponseFormat, type Role, type ServerOptions, type Tool, type ToolCall, type ToolChoice, type Usage, appendFileQueued, configureFsIO, createAnthropicBatchAdapter, createAnyModelServer, createGoogleBatchAdapter, createOpenAIBatchAdapter, ensureDir, estimateTokenCount, getFsQueueStatus, joinPath, readFileQueued, resolveConfig, resolveMaxTokens, startServer, waitForFsQueuesIdle, writeFileFlushedQueued, writeFileQueued };