@providerprotocol/ai 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +188 -6
  2. package/dist/anthropic/index.d.ts +1 -1
  3. package/dist/anthropic/index.js +115 -39
  4. package/dist/anthropic/index.js.map +1 -1
  5. package/dist/{chunk-Y3GBJNA2.js → chunk-55X3W2MN.js} +4 -3
  6. package/dist/chunk-55X3W2MN.js.map +1 -0
  7. package/dist/chunk-73IIE3QT.js +120 -0
  8. package/dist/chunk-73IIE3QT.js.map +1 -0
  9. package/dist/{chunk-M4BMM5IB.js → chunk-MF5ETY5O.js} +13 -4
  10. package/dist/chunk-MF5ETY5O.js.map +1 -0
  11. package/dist/{chunk-SKY2JLA7.js → chunk-MKDLXV4O.js} +1 -1
  12. package/dist/chunk-MKDLXV4O.js.map +1 -0
  13. package/dist/{chunk-Z7RBRCRN.js → chunk-NWS5IKNR.js} +37 -11
  14. package/dist/chunk-NWS5IKNR.js.map +1 -0
  15. package/dist/{chunk-EDENPF3E.js → chunk-QNJO7DSD.js} +152 -53
  16. package/dist/chunk-QNJO7DSD.js.map +1 -0
  17. package/dist/{chunk-Z4ILICF5.js → chunk-SBCATNHA.js} +43 -14
  18. package/dist/chunk-SBCATNHA.js.map +1 -0
  19. package/dist/chunk-Z6DKC37J.js +50 -0
  20. package/dist/chunk-Z6DKC37J.js.map +1 -0
  21. package/dist/google/index.d.ts +22 -7
  22. package/dist/google/index.js +286 -85
  23. package/dist/google/index.js.map +1 -1
  24. package/dist/http/index.d.ts +3 -3
  25. package/dist/http/index.js +4 -4
  26. package/dist/index.d.ts +10 -6
  27. package/dist/index.js +331 -204
  28. package/dist/index.js.map +1 -1
  29. package/dist/ollama/index.d.ts +5 -2
  30. package/dist/ollama/index.js +87 -28
  31. package/dist/ollama/index.js.map +1 -1
  32. package/dist/openai/index.d.ts +1 -1
  33. package/dist/openai/index.js +226 -81
  34. package/dist/openai/index.js.map +1 -1
  35. package/dist/openrouter/index.d.ts +1 -1
  36. package/dist/openrouter/index.js +199 -64
  37. package/dist/openrouter/index.js.map +1 -1
  38. package/dist/{provider-DGQHYE6I.d.ts → provider-DR1yins0.d.ts} +159 -53
  39. package/dist/proxy/index.d.ts +2 -2
  40. package/dist/proxy/index.js +178 -17
  41. package/dist/proxy/index.js.map +1 -1
  42. package/dist/{retry-Pcs3hnbu.d.ts → retry-DJiqAslw.d.ts} +11 -2
  43. package/dist/{stream-Di9acos2.d.ts → stream-BuTrqt_j.d.ts} +103 -41
  44. package/dist/xai/index.d.ts +1 -1
  45. package/dist/xai/index.js +189 -75
  46. package/dist/xai/index.js.map +1 -1
  47. package/package.json +1 -1
  48. package/dist/chunk-EDENPF3E.js.map +0 -1
  49. package/dist/chunk-M4BMM5IB.js.map +0 -1
  50. package/dist/chunk-SKY2JLA7.js.map +0 -1
  51. package/dist/chunk-Y3GBJNA2.js.map +0 -1
  52. package/dist/chunk-Z4ILICF5.js.map +0 -1
  53. package/dist/chunk-Z7RBRCRN.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { g as Provider } from '../provider-DGQHYE6I.js';
1
+ import { a as ProviderConfig, g as Provider } from '../provider-DR1yins0.js';
2
2
 
3
3
  /**
4
4
  * Provider-specific parameters for Google Gemini API requests.
@@ -671,6 +671,10 @@ declare const tools: {
671
671
  interface CacheCreateOptions {
672
672
  /** API key for authentication */
673
673
  apiKey: string;
674
+ /** Provider configuration (timeout, retry strategy, custom fetch) */
675
+ config?: ProviderConfig;
676
+ /** Abort signal for cancellation */
677
+ signal?: AbortSignal;
674
678
  /** Model to associate with this cache (e.g., "gemini-3-flash-preview") */
675
679
  model: string;
676
680
  /** Optional display name for the cache (max 128 chars) */
@@ -692,6 +696,10 @@ interface CacheCreateOptions {
692
696
  interface CacheListOptions {
693
697
  /** API key for authentication */
694
698
  apiKey: string;
699
+ /** Provider configuration (timeout, retry strategy, custom fetch) */
700
+ config?: ProviderConfig;
701
+ /** Abort signal for cancellation */
702
+ signal?: AbortSignal;
695
703
  /** Maximum number of caches to return per page */
696
704
  pageSize?: number;
697
705
  /** Token for fetching the next page of results */
@@ -736,6 +744,8 @@ declare function create(options: CacheCreateOptions): Promise<GoogleCacheRespons
736
744
  *
737
745
  * @param name - The cache name (format: "cachedContents/{id}")
738
746
  * @param apiKey - API key for authentication
747
+ * @param config - Provider configuration (timeout, retry strategy, custom fetch)
748
+ * @param signal - Abort signal for cancellation
739
749
  * @returns The cache entry details
740
750
  *
741
751
  * @example
@@ -744,7 +754,7 @@ declare function create(options: CacheCreateOptions): Promise<GoogleCacheRespons
744
754
  * console.log(`Cache expires at: ${cache.expireTime}`);
745
755
  * ```
746
756
  */
747
- declare function get(name: string, apiKey: string): Promise<GoogleCacheResponse>;
757
+ declare function get(name: string, apiKey: string, config?: ProviderConfig, signal?: AbortSignal): Promise<GoogleCacheResponse>;
748
758
  /**
749
759
  * Lists all cached content entries.
750
760
  *
@@ -771,8 +781,10 @@ declare function list(options: CacheListOptions): Promise<GoogleCacheListRespons
771
781
  * (contents, systemInstruction, tools) are immutable after creation.
772
782
  *
773
783
  * @param name - The cache name (format: "cachedContents/{id}")
774
- * @param update - The update to apply (ttl or expireTime)
784
+ * @param update - The update to apply (exactly one of ttl or expireTime)
775
785
  * @param apiKey - API key for authentication
786
+ * @param config - Provider configuration (timeout, retry strategy, custom fetch)
787
+ * @param signal - Abort signal for cancellation
776
788
  * @returns The updated cache entry
777
789
  *
778
790
  * @example
@@ -785,19 +797,21 @@ declare function list(options: CacheListOptions): Promise<GoogleCacheListRespons
785
797
  * );
786
798
  * ```
787
799
  */
788
- declare function update(name: string, updateRequest: GoogleCacheUpdateRequest, apiKey: string): Promise<GoogleCacheResponse>;
800
+ declare function update(name: string, updateRequest: GoogleCacheUpdateRequest, apiKey: string, config?: ProviderConfig, signal?: AbortSignal): Promise<GoogleCacheResponse>;
789
801
  /**
790
802
  * Deletes a cached content entry.
791
803
  *
792
804
  * @param name - The cache name (format: "cachedContents/{id}")
793
805
  * @param apiKey - API key for authentication
806
+ * @param config - Provider configuration (timeout, retry strategy, custom fetch)
807
+ * @param signal - Abort signal for cancellation
794
808
  *
795
809
  * @example
796
810
  * ```typescript
797
811
  * await google.cache.delete('cachedContents/abc123', apiKey);
798
812
  * ```
799
813
  */
800
- declare function deleteCache(name: string, apiKey: string): Promise<void>;
814
+ declare function deleteCache(name: string, apiKey: string, config?: ProviderConfig, signal?: AbortSignal): Promise<void>;
801
815
  /**
802
816
  * Cache utilities namespace.
803
817
  *
@@ -879,6 +893,7 @@ interface GoogleEmbedParams {
879
893
  * ```typescript
880
894
  * import { google } from './providers/google';
881
895
  * import { llm } from './core/llm';
896
+ * import { StreamEventType } from './types/stream';
882
897
  *
883
898
  * const gemini = llm({
884
899
  * model: google('gemini-1.5-pro'),
@@ -890,7 +905,7 @@ interface GoogleEmbedParams {
890
905
  *
891
906
  * const stream = gemini.stream('Tell me a story');
892
907
  * for await (const event of stream) {
893
- * if (event.type === 'text_delta') {
908
+ * if (event.type === StreamEventType.TextDelta) {
894
909
  * process.stdout.write(event.delta.text ?? '');
895
910
  * }
896
911
  * }
@@ -930,7 +945,7 @@ declare const google: Provider<unknown> & {
930
945
  get: typeof get;
931
946
  list: typeof list;
932
947
  update: typeof update;
933
- delete: (name: string, apiKey: string) => Promise<void>;
948
+ delete: (name: string, apiKey: string, config?: ProviderConfig, signal?: AbortSignal) => Promise<void>;
934
949
  };
935
950
  };
936
951