@adaline/openai 0.7.0 → 0.9.0

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.mts CHANGED
@@ -2220,7 +2220,7 @@ declare const OpenAIChatRequestMessage: z.ZodUnion<[z.ZodObject<{
2220
2220
  type OpenAIChatRequestMessageType = z.infer<typeof OpenAIChatRequestMessage>;
2221
2221
  declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2222
2222
  model: z.ZodOptional<z.ZodString>;
2223
- messages: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
2223
+ messages: z.ZodArray<z.ZodUnion<[z.ZodObject<{
2224
2224
  role: z.ZodLiteral<"system">;
2225
2225
  content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
2226
2226
  text: z.ZodString;
@@ -2412,7 +2412,7 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2412
2412
  content: string;
2413
2413
  role: "tool";
2414
2414
  tool_call_id: string;
2415
- }>]>, "many">>;
2415
+ }>]>, "many">;
2416
2416
  frequency_penalty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2417
2417
  logprobs: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
2418
2418
  top_logprobs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -2519,34 +2519,7 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2519
2519
  type: "function";
2520
2520
  }>]>>;
2521
2521
  }, "strip", z.ZodTypeAny, {
2522
- temperature?: number | null | undefined;
2523
- top_p?: number | null | undefined;
2524
- frequency_penalty?: number | null | undefined;
2525
- presence_penalty?: number | null | undefined;
2526
- seed?: number | null | undefined;
2527
- logprobs?: boolean | null | undefined;
2528
- top_logprobs?: number | null | undefined;
2529
- response_format?: {
2530
- type: "text" | "json_object";
2531
- } | {
2532
- type: "json_schema";
2533
- json_schema: {
2534
- name: string;
2535
- description?: string | undefined;
2536
- strict?: boolean | undefined;
2537
- schema?: any;
2538
- };
2539
- } | undefined;
2540
- tool_choice?: "auto" | "required" | "none" | {
2541
- function: {
2542
- name: string;
2543
- };
2544
- type: "function";
2545
- } | undefined;
2546
- max_tokens?: number | null | undefined;
2547
- stop?: string | string[] | null | undefined;
2548
- model?: string | undefined;
2549
- messages?: ({
2522
+ messages: ({
2550
2523
  content: string | {
2551
2524
  type: "text";
2552
2525
  text: string;
@@ -2582,17 +2555,7 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2582
2555
  content: string;
2583
2556
  role: "tool";
2584
2557
  tool_call_id: string;
2585
- })[] | undefined;
2586
- tools?: {
2587
- function: {
2588
- name: string;
2589
- description?: string | undefined;
2590
- strict?: boolean | undefined;
2591
- parameters?: any;
2592
- };
2593
- type: "function";
2594
- }[] | undefined;
2595
- }, {
2558
+ })[];
2596
2559
  temperature?: number | null | undefined;
2597
2560
  top_p?: number | null | undefined;
2598
2561
  frequency_penalty?: number | null | undefined;
@@ -2620,7 +2583,17 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2620
2583
  max_tokens?: number | null | undefined;
2621
2584
  stop?: string | string[] | null | undefined;
2622
2585
  model?: string | undefined;
2623
- messages?: ({
2586
+ tools?: {
2587
+ function: {
2588
+ name: string;
2589
+ description?: string | undefined;
2590
+ strict?: boolean | undefined;
2591
+ parameters?: any;
2592
+ };
2593
+ type: "function";
2594
+ }[] | undefined;
2595
+ }, {
2596
+ messages: ({
2624
2597
  content: string | {
2625
2598
  type: "text";
2626
2599
  text: string;
@@ -2656,17 +2629,7 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2656
2629
  content: string;
2657
2630
  role: "tool";
2658
2631
  tool_call_id: string;
2659
- })[] | undefined;
2660
- tools?: {
2661
- function: {
2662
- name: string;
2663
- description?: string | undefined;
2664
- strict?: boolean | undefined;
2665
- parameters?: any;
2666
- };
2667
- type: "function";
2668
- }[] | undefined;
2669
- }>, {
2632
+ })[];
2670
2633
  temperature?: number | null | undefined;
2671
2634
  top_p?: number | null | undefined;
2672
2635
  frequency_penalty?: number | null | undefined;
@@ -2694,7 +2657,17 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2694
2657
  max_tokens?: number | null | undefined;
2695
2658
  stop?: string | string[] | null | undefined;
2696
2659
  model?: string | undefined;
2697
- messages?: ({
2660
+ tools?: {
2661
+ function: {
2662
+ name: string;
2663
+ description?: string | undefined;
2664
+ strict?: boolean | undefined;
2665
+ parameters?: any;
2666
+ };
2667
+ type: "function";
2668
+ }[] | undefined;
2669
+ }>, {
2670
+ messages: ({
2698
2671
  content: string | {
2699
2672
  type: "text";
2700
2673
  text: string;
@@ -2730,17 +2703,7 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2730
2703
  content: string;
2731
2704
  role: "tool";
2732
2705
  tool_call_id: string;
2733
- })[] | undefined;
2734
- tools?: {
2735
- function: {
2736
- name: string;
2737
- description?: string | undefined;
2738
- strict?: boolean | undefined;
2739
- parameters?: any;
2740
- };
2741
- type: "function";
2742
- }[] | undefined;
2743
- }, {
2706
+ })[];
2744
2707
  temperature?: number | null | undefined;
2745
2708
  top_p?: number | null | undefined;
2746
2709
  frequency_penalty?: number | null | undefined;
@@ -2768,7 +2731,17 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2768
2731
  max_tokens?: number | null | undefined;
2769
2732
  stop?: string | string[] | null | undefined;
2770
2733
  model?: string | undefined;
2771
- messages?: ({
2734
+ tools?: {
2735
+ function: {
2736
+ name: string;
2737
+ description?: string | undefined;
2738
+ strict?: boolean | undefined;
2739
+ parameters?: any;
2740
+ };
2741
+ type: "function";
2742
+ }[] | undefined;
2743
+ }, {
2744
+ messages: ({
2772
2745
  content: string | {
2773
2746
  type: "text";
2774
2747
  text: string;
@@ -2804,7 +2777,34 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2804
2777
  content: string;
2805
2778
  role: "tool";
2806
2779
  tool_call_id: string;
2807
- })[] | undefined;
2780
+ })[];
2781
+ temperature?: number | null | undefined;
2782
+ top_p?: number | null | undefined;
2783
+ frequency_penalty?: number | null | undefined;
2784
+ presence_penalty?: number | null | undefined;
2785
+ seed?: number | null | undefined;
2786
+ logprobs?: boolean | null | undefined;
2787
+ top_logprobs?: number | null | undefined;
2788
+ response_format?: {
2789
+ type: "text" | "json_object";
2790
+ } | {
2791
+ type: "json_schema";
2792
+ json_schema: {
2793
+ name: string;
2794
+ description?: string | undefined;
2795
+ strict?: boolean | undefined;
2796
+ schema?: any;
2797
+ };
2798
+ } | undefined;
2799
+ tool_choice?: "auto" | "required" | "none" | {
2800
+ function: {
2801
+ name: string;
2802
+ };
2803
+ type: "function";
2804
+ } | undefined;
2805
+ max_tokens?: number | null | undefined;
2806
+ stop?: string | string[] | null | undefined;
2807
+ model?: string | undefined;
2808
2808
  tools?: {
2809
2809
  function: {
2810
2810
  name: string;
@@ -2856,8 +2856,8 @@ declare class BaseChatModel implements ChatModelV1<ChatModelSchemaType> {
2856
2856
  getTokenCount(messages: MessageType[]): number;
2857
2857
  transformModelRequest(request: OpenAIChatRequestType): {
2858
2858
  modelName: string | undefined;
2859
- config: ConfigType | undefined;
2860
- messages: MessageType[] | undefined;
2859
+ config: ConfigType;
2860
+ messages: MessageType[];
2861
2861
  tools: ToolType[] | undefined;
2862
2862
  };
2863
2863
  transformConfig(config: ConfigType, messages?: MessageType[], tools?: ToolType[]): ParamsType;
@@ -3005,19 +3005,19 @@ declare const OpenAIEmbeddingRequestInput: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z
3005
3005
  type OpenAIEmbeddingRequestInputType = z.infer<typeof OpenAIEmbeddingRequestInput>;
3006
3006
  declare const OpenAIEmbeddingRequest: z.ZodObject<{
3007
3007
  model: z.ZodOptional<z.ZodString>;
3008
- input: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodArray<z.ZodNumber, "many">]>, z.ZodArray<z.ZodArray<z.ZodNumber, "many">, "many">]>>;
3008
+ input: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodArray<z.ZodNumber, "many">]>, z.ZodArray<z.ZodArray<z.ZodNumber, "many">, "many">]>;
3009
3009
  encoding_format: z.ZodOptional<z.ZodEnum<["float", "base64"]>>;
3010
3010
  dimensions: z.ZodOptional<z.ZodNumber>;
3011
3011
  }, "strip", z.ZodTypeAny, {
3012
+ input: string | string[] | number[] | number[][];
3012
3013
  encoding_format?: "float" | "base64" | undefined;
3013
3014
  dimensions?: number | undefined;
3014
3015
  model?: string | undefined;
3015
- input?: string | string[] | number[] | number[][] | undefined;
3016
3016
  }, {
3017
+ input: string | string[] | number[] | number[][];
3017
3018
  encoding_format?: "float" | "base64" | undefined;
3018
3019
  dimensions?: number | undefined;
3019
3020
  model?: string | undefined;
3020
- input?: string | string[] | number[] | number[][] | undefined;
3021
3021
  }>;
3022
3022
  type OpenAIEmbeddingRequestType = z.infer<typeof OpenAIEmbeddingRequest>;
3023
3023
 
@@ -3052,8 +3052,8 @@ declare class BaseEmbeddingModel implements EmbeddingModelV1<EmbeddingModelSchem
3052
3052
  getTokenCount(requests: EmbeddingRequestsType): number;
3053
3053
  transformModelRequest(request: any): {
3054
3054
  modelName: string | undefined;
3055
- config: ConfigType | undefined;
3056
- embeddingRequests: EmbeddingRequestsType | undefined;
3055
+ config: ConfigType;
3056
+ embeddingRequests: EmbeddingRequestsType;
3057
3057
  };
3058
3058
  transformConfig(config: ConfigType, requests?: EmbeddingRequestsType): ParamsType;
3059
3059
  transformEmbeddingRequests(requests: EmbeddingRequestsType): ParamsType;
package/dist/index.d.ts CHANGED
@@ -2220,7 +2220,7 @@ declare const OpenAIChatRequestMessage: z.ZodUnion<[z.ZodObject<{
2220
2220
  type OpenAIChatRequestMessageType = z.infer<typeof OpenAIChatRequestMessage>;
2221
2221
  declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2222
2222
  model: z.ZodOptional<z.ZodString>;
2223
- messages: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
2223
+ messages: z.ZodArray<z.ZodUnion<[z.ZodObject<{
2224
2224
  role: z.ZodLiteral<"system">;
2225
2225
  content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
2226
2226
  text: z.ZodString;
@@ -2412,7 +2412,7 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2412
2412
  content: string;
2413
2413
  role: "tool";
2414
2414
  tool_call_id: string;
2415
- }>]>, "many">>;
2415
+ }>]>, "many">;
2416
2416
  frequency_penalty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2417
2417
  logprobs: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
2418
2418
  top_logprobs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -2519,34 +2519,7 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2519
2519
  type: "function";
2520
2520
  }>]>>;
2521
2521
  }, "strip", z.ZodTypeAny, {
2522
- temperature?: number | null | undefined;
2523
- top_p?: number | null | undefined;
2524
- frequency_penalty?: number | null | undefined;
2525
- presence_penalty?: number | null | undefined;
2526
- seed?: number | null | undefined;
2527
- logprobs?: boolean | null | undefined;
2528
- top_logprobs?: number | null | undefined;
2529
- response_format?: {
2530
- type: "text" | "json_object";
2531
- } | {
2532
- type: "json_schema";
2533
- json_schema: {
2534
- name: string;
2535
- description?: string | undefined;
2536
- strict?: boolean | undefined;
2537
- schema?: any;
2538
- };
2539
- } | undefined;
2540
- tool_choice?: "auto" | "required" | "none" | {
2541
- function: {
2542
- name: string;
2543
- };
2544
- type: "function";
2545
- } | undefined;
2546
- max_tokens?: number | null | undefined;
2547
- stop?: string | string[] | null | undefined;
2548
- model?: string | undefined;
2549
- messages?: ({
2522
+ messages: ({
2550
2523
  content: string | {
2551
2524
  type: "text";
2552
2525
  text: string;
@@ -2582,17 +2555,7 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2582
2555
  content: string;
2583
2556
  role: "tool";
2584
2557
  tool_call_id: string;
2585
- })[] | undefined;
2586
- tools?: {
2587
- function: {
2588
- name: string;
2589
- description?: string | undefined;
2590
- strict?: boolean | undefined;
2591
- parameters?: any;
2592
- };
2593
- type: "function";
2594
- }[] | undefined;
2595
- }, {
2558
+ })[];
2596
2559
  temperature?: number | null | undefined;
2597
2560
  top_p?: number | null | undefined;
2598
2561
  frequency_penalty?: number | null | undefined;
@@ -2620,7 +2583,17 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2620
2583
  max_tokens?: number | null | undefined;
2621
2584
  stop?: string | string[] | null | undefined;
2622
2585
  model?: string | undefined;
2623
- messages?: ({
2586
+ tools?: {
2587
+ function: {
2588
+ name: string;
2589
+ description?: string | undefined;
2590
+ strict?: boolean | undefined;
2591
+ parameters?: any;
2592
+ };
2593
+ type: "function";
2594
+ }[] | undefined;
2595
+ }, {
2596
+ messages: ({
2624
2597
  content: string | {
2625
2598
  type: "text";
2626
2599
  text: string;
@@ -2656,17 +2629,7 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2656
2629
  content: string;
2657
2630
  role: "tool";
2658
2631
  tool_call_id: string;
2659
- })[] | undefined;
2660
- tools?: {
2661
- function: {
2662
- name: string;
2663
- description?: string | undefined;
2664
- strict?: boolean | undefined;
2665
- parameters?: any;
2666
- };
2667
- type: "function";
2668
- }[] | undefined;
2669
- }>, {
2632
+ })[];
2670
2633
  temperature?: number | null | undefined;
2671
2634
  top_p?: number | null | undefined;
2672
2635
  frequency_penalty?: number | null | undefined;
@@ -2694,7 +2657,17 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2694
2657
  max_tokens?: number | null | undefined;
2695
2658
  stop?: string | string[] | null | undefined;
2696
2659
  model?: string | undefined;
2697
- messages?: ({
2660
+ tools?: {
2661
+ function: {
2662
+ name: string;
2663
+ description?: string | undefined;
2664
+ strict?: boolean | undefined;
2665
+ parameters?: any;
2666
+ };
2667
+ type: "function";
2668
+ }[] | undefined;
2669
+ }>, {
2670
+ messages: ({
2698
2671
  content: string | {
2699
2672
  type: "text";
2700
2673
  text: string;
@@ -2730,17 +2703,7 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2730
2703
  content: string;
2731
2704
  role: "tool";
2732
2705
  tool_call_id: string;
2733
- })[] | undefined;
2734
- tools?: {
2735
- function: {
2736
- name: string;
2737
- description?: string | undefined;
2738
- strict?: boolean | undefined;
2739
- parameters?: any;
2740
- };
2741
- type: "function";
2742
- }[] | undefined;
2743
- }, {
2706
+ })[];
2744
2707
  temperature?: number | null | undefined;
2745
2708
  top_p?: number | null | undefined;
2746
2709
  frequency_penalty?: number | null | undefined;
@@ -2768,7 +2731,17 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2768
2731
  max_tokens?: number | null | undefined;
2769
2732
  stop?: string | string[] | null | undefined;
2770
2733
  model?: string | undefined;
2771
- messages?: ({
2734
+ tools?: {
2735
+ function: {
2736
+ name: string;
2737
+ description?: string | undefined;
2738
+ strict?: boolean | undefined;
2739
+ parameters?: any;
2740
+ };
2741
+ type: "function";
2742
+ }[] | undefined;
2743
+ }, {
2744
+ messages: ({
2772
2745
  content: string | {
2773
2746
  type: "text";
2774
2747
  text: string;
@@ -2804,7 +2777,34 @@ declare const OpenAIChatRequest: z.ZodEffects<z.ZodObject<{
2804
2777
  content: string;
2805
2778
  role: "tool";
2806
2779
  tool_call_id: string;
2807
- })[] | undefined;
2780
+ })[];
2781
+ temperature?: number | null | undefined;
2782
+ top_p?: number | null | undefined;
2783
+ frequency_penalty?: number | null | undefined;
2784
+ presence_penalty?: number | null | undefined;
2785
+ seed?: number | null | undefined;
2786
+ logprobs?: boolean | null | undefined;
2787
+ top_logprobs?: number | null | undefined;
2788
+ response_format?: {
2789
+ type: "text" | "json_object";
2790
+ } | {
2791
+ type: "json_schema";
2792
+ json_schema: {
2793
+ name: string;
2794
+ description?: string | undefined;
2795
+ strict?: boolean | undefined;
2796
+ schema?: any;
2797
+ };
2798
+ } | undefined;
2799
+ tool_choice?: "auto" | "required" | "none" | {
2800
+ function: {
2801
+ name: string;
2802
+ };
2803
+ type: "function";
2804
+ } | undefined;
2805
+ max_tokens?: number | null | undefined;
2806
+ stop?: string | string[] | null | undefined;
2807
+ model?: string | undefined;
2808
2808
  tools?: {
2809
2809
  function: {
2810
2810
  name: string;
@@ -2856,8 +2856,8 @@ declare class BaseChatModel implements ChatModelV1<ChatModelSchemaType> {
2856
2856
  getTokenCount(messages: MessageType[]): number;
2857
2857
  transformModelRequest(request: OpenAIChatRequestType): {
2858
2858
  modelName: string | undefined;
2859
- config: ConfigType | undefined;
2860
- messages: MessageType[] | undefined;
2859
+ config: ConfigType;
2860
+ messages: MessageType[];
2861
2861
  tools: ToolType[] | undefined;
2862
2862
  };
2863
2863
  transformConfig(config: ConfigType, messages?: MessageType[], tools?: ToolType[]): ParamsType;
@@ -3005,19 +3005,19 @@ declare const OpenAIEmbeddingRequestInput: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z
3005
3005
  type OpenAIEmbeddingRequestInputType = z.infer<typeof OpenAIEmbeddingRequestInput>;
3006
3006
  declare const OpenAIEmbeddingRequest: z.ZodObject<{
3007
3007
  model: z.ZodOptional<z.ZodString>;
3008
- input: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodArray<z.ZodNumber, "many">]>, z.ZodArray<z.ZodArray<z.ZodNumber, "many">, "many">]>>;
3008
+ input: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodArray<z.ZodNumber, "many">]>, z.ZodArray<z.ZodArray<z.ZodNumber, "many">, "many">]>;
3009
3009
  encoding_format: z.ZodOptional<z.ZodEnum<["float", "base64"]>>;
3010
3010
  dimensions: z.ZodOptional<z.ZodNumber>;
3011
3011
  }, "strip", z.ZodTypeAny, {
3012
+ input: string | string[] | number[] | number[][];
3012
3013
  encoding_format?: "float" | "base64" | undefined;
3013
3014
  dimensions?: number | undefined;
3014
3015
  model?: string | undefined;
3015
- input?: string | string[] | number[] | number[][] | undefined;
3016
3016
  }, {
3017
+ input: string | string[] | number[] | number[][];
3017
3018
  encoding_format?: "float" | "base64" | undefined;
3018
3019
  dimensions?: number | undefined;
3019
3020
  model?: string | undefined;
3020
- input?: string | string[] | number[] | number[][] | undefined;
3021
3021
  }>;
3022
3022
  type OpenAIEmbeddingRequestType = z.infer<typeof OpenAIEmbeddingRequest>;
3023
3023
 
@@ -3052,8 +3052,8 @@ declare class BaseEmbeddingModel implements EmbeddingModelV1<EmbeddingModelSchem
3052
3052
  getTokenCount(requests: EmbeddingRequestsType): number;
3053
3053
  transformModelRequest(request: any): {
3054
3054
  modelName: string | undefined;
3055
- config: ConfigType | undefined;
3056
- embeddingRequests: EmbeddingRequestsType | undefined;
3055
+ config: ConfigType;
3056
+ embeddingRequests: EmbeddingRequestsType;
3057
3057
  };
3058
3058
  transformConfig(config: ConfigType, requests?: EmbeddingRequestsType): ParamsType;
3059
3059
  transformEmbeddingRequests(requests: EmbeddingRequestsType): ParamsType;