@jaypie/llm 1.2.1 → 1.2.3

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 (47) hide show
  1. package/dist/cjs/Llm.d.ts +5 -5
  2. package/dist/cjs/constants.d.ts +33 -77
  3. package/dist/cjs/index.cjs +725 -112
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.ts +3 -1
  6. package/dist/cjs/operate/OperateLoop.d.ts +2 -2
  7. package/dist/cjs/operate/StreamLoop.d.ts +2 -2
  8. package/dist/cjs/operate/adapters/AnthropicAdapter.d.ts +1 -1
  9. package/dist/cjs/operate/adapters/GeminiAdapter.d.ts +2 -1
  10. package/dist/cjs/operate/adapters/OpenAiAdapter.d.ts +1 -1
  11. package/dist/cjs/operate/adapters/OpenRouterAdapter.d.ts +12 -2
  12. package/dist/cjs/operate/input/InputProcessor.d.ts +3 -3
  13. package/dist/cjs/operate/response/ResponseBuilder.d.ts +14 -1
  14. package/dist/cjs/types/LlmOperateInput.guards.d.ts +17 -0
  15. package/dist/cjs/types/LlmProvider.interface.d.ts +48 -2
  16. package/dist/cjs/upload/detectMimeType.d.ts +16 -0
  17. package/dist/cjs/upload/extractPdfPages.d.ts +13 -0
  18. package/dist/cjs/upload/index.d.ts +5 -0
  19. package/dist/cjs/upload/loadLocalFile.d.ts +6 -0
  20. package/dist/cjs/upload/loadS3File.d.ts +7 -0
  21. package/dist/cjs/upload/resolveOperateInput.d.ts +12 -0
  22. package/dist/cjs/util/extractReasoning.d.ts +14 -0
  23. package/dist/cjs/util/index.d.ts +1 -0
  24. package/dist/esm/Llm.d.ts +5 -5
  25. package/dist/esm/constants.d.ts +33 -77
  26. package/dist/esm/index.d.ts +3 -1
  27. package/dist/esm/index.js +722 -114
  28. package/dist/esm/index.js.map +1 -1
  29. package/dist/esm/operate/OperateLoop.d.ts +2 -2
  30. package/dist/esm/operate/StreamLoop.d.ts +2 -2
  31. package/dist/esm/operate/adapters/AnthropicAdapter.d.ts +1 -1
  32. package/dist/esm/operate/adapters/GeminiAdapter.d.ts +2 -1
  33. package/dist/esm/operate/adapters/OpenAiAdapter.d.ts +1 -1
  34. package/dist/esm/operate/adapters/OpenRouterAdapter.d.ts +12 -2
  35. package/dist/esm/operate/input/InputProcessor.d.ts +3 -3
  36. package/dist/esm/operate/response/ResponseBuilder.d.ts +14 -1
  37. package/dist/esm/types/LlmOperateInput.guards.d.ts +17 -0
  38. package/dist/esm/types/LlmProvider.interface.d.ts +48 -2
  39. package/dist/esm/upload/detectMimeType.d.ts +16 -0
  40. package/dist/esm/upload/extractPdfPages.d.ts +13 -0
  41. package/dist/esm/upload/index.d.ts +5 -0
  42. package/dist/esm/upload/loadLocalFile.d.ts +6 -0
  43. package/dist/esm/upload/loadS3File.d.ts +7 -0
  44. package/dist/esm/upload/resolveOperateInput.d.ts +12 -0
  45. package/dist/esm/util/extractReasoning.d.ts +14 -0
  46. package/dist/esm/util/index.d.ts +1 -0
  47. package/package.json +2 -1
@@ -1,10 +1,12 @@
1
1
  export { default as Llm } from "./Llm.js";
2
2
  export * as LLM from "./constants.js";
3
- export type { LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProvider, } from "./types/LlmProvider.interface.js";
3
+ export type { LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmOperateInput, LlmOperateInputContent, LlmOperateInputFile, LlmOperateInputImage, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProvider, } from "./types/LlmProvider.interface.js";
4
4
  export { LlmMessageRole, LlmMessageType, } from "./types/LlmProvider.interface.js";
5
+ export { isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, } from "./types/LlmOperateInput.guards.js";
5
6
  export type { LlmTool } from "./types/LlmTool.interface.js";
6
7
  export type { LlmStreamChunk, LlmStreamChunkDone, LlmStreamChunkError, LlmStreamChunkText, LlmStreamChunkToolCall, LlmStreamChunkToolResult, } from "./types/LlmStreamChunk.interface.js";
7
8
  export { LlmStreamChunkType } from "./types/LlmStreamChunk.interface.js";
8
9
  export { JaypieToolkit, toolkit, Toolkit, tools } from "./tools/index.js";
10
+ export { extractReasoning } from "./util/extractReasoning.js";
9
11
  export { GeminiProvider } from "./providers/gemini/index.js";
10
12
  export { OpenRouterProvider } from "./providers/openrouter/index.js";
@@ -1,4 +1,4 @@
1
- import { LlmHistory, LlmInputMessage, LlmOperateOptions, LlmOperateResponse } from "../types/LlmProvider.interface.js";
1
+ import { LlmHistory, LlmInputMessage, LlmOperateInput, LlmOperateOptions, LlmOperateResponse } from "../types/LlmProvider.interface.js";
2
2
  import { ProviderAdapter } from "./adapters/ProviderAdapter.interface.js";
3
3
  import { HookRunner } from "./hooks/index.js";
4
4
  import { InputProcessor } from "./input/index.js";
@@ -28,7 +28,7 @@ export declare class OperateLoop {
28
28
  /**
29
29
  * Execute the operate loop for multi-turn conversations with tool calling.
30
30
  */
31
- execute(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): Promise<LlmOperateResponse>;
31
+ execute(input: string | LlmHistory | LlmInputMessage | LlmOperateInput, options?: LlmOperateOptions): Promise<LlmOperateResponse>;
32
32
  private initializeState;
33
33
  private createContext;
34
34
  private buildInitialRequest;
@@ -1,4 +1,4 @@
1
- import { LlmHistory, LlmInputMessage, LlmOperateOptions } from "../types/LlmProvider.interface.js";
1
+ import { LlmHistory, LlmInputMessage, LlmOperateInput, LlmOperateOptions } from "../types/LlmProvider.interface.js";
2
2
  import { LlmStreamChunk } from "../types/LlmStreamChunk.interface.js";
3
3
  import { ProviderAdapter } from "./adapters/ProviderAdapter.interface.js";
4
4
  import { HookRunner } from "./hooks/index.js";
@@ -24,7 +24,7 @@ export declare class StreamLoop {
24
24
  * Execute the streaming loop for multi-turn conversations with tool calling.
25
25
  * Yields stream chunks as they become available.
26
26
  */
27
- execute(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
27
+ execute(input: string | LlmHistory | LlmInputMessage | LlmOperateInput, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
28
28
  private initializeState;
29
29
  private createContext;
30
30
  private buildInitialRequest;
@@ -13,7 +13,7 @@ import { BaseProviderAdapter } from "./ProviderAdapter.interface.js";
13
13
  */
14
14
  export declare class AnthropicAdapter extends BaseProviderAdapter {
15
15
  readonly name: "anthropic";
16
- readonly defaultModel: "claude-opus-4-1";
16
+ readonly defaultModel: "claude-sonnet-4-5";
17
17
  buildRequest(request: OperateRequest): Anthropic.MessageCreateParams;
18
18
  formatTools(toolkit: Toolkit, outputSchema?: JsonObject): ProviderToolDefinition[];
19
19
  formatOutputSchema(schema: JsonObject | NaturalSchema | z.ZodType): JsonObject;
@@ -13,7 +13,7 @@ import { GeminiPart, GeminiRawResponse, GeminiRequest } from "../../providers/ge
13
13
  */
14
14
  export declare class GeminiAdapter extends BaseProviderAdapter {
15
15
  readonly name: "gemini";
16
- readonly defaultModel: "gemini-2.5-flash";
16
+ readonly defaultModel: "gemini-3-pro-preview";
17
17
  buildRequest(request: OperateRequest): GeminiRequest;
18
18
  formatTools(toolkit: Toolkit, outputSchema?: JsonObject): ProviderToolDefinition[];
19
19
  formatOutputSchema(schema: JsonObject | NaturalSchema | z.ZodType): JsonObject;
@@ -30,6 +30,7 @@ export declare class GeminiAdapter extends BaseProviderAdapter {
30
30
  hasStructuredOutput(response: unknown): boolean;
31
31
  extractStructuredOutput(response: unknown): JsonObject | undefined;
32
32
  private convertMessagesToContents;
33
+ private convertContentToParts;
33
34
  private mapRole;
34
35
  private hasToolCalls;
35
36
  private getFinishReason;
@@ -12,7 +12,7 @@ import { BaseProviderAdapter } from "./ProviderAdapter.interface.js";
12
12
  */
13
13
  export declare class OpenAiAdapter extends BaseProviderAdapter {
14
14
  readonly name: "openai";
15
- readonly defaultModel: "gpt-5";
15
+ readonly defaultModel: "gpt-5.1";
16
16
  buildRequest(request: OperateRequest): unknown;
17
17
  formatTools(toolkit: Toolkit, _outputSchema?: JsonObject): ProviderToolDefinition[];
18
18
  formatOutputSchema(schema: JsonObject | NaturalSchema | z.ZodType): JsonObject;
@@ -7,7 +7,7 @@ import { ClassifiedError, OperateRequest, ParsedResponse, ProviderToolDefinition
7
7
  import { BaseProviderAdapter } from "./ProviderAdapter.interface.js";
8
8
  interface OpenRouterMessage {
9
9
  role: "system" | "user" | "assistant" | "tool";
10
- content?: string | null;
10
+ content?: string | OpenRouterContentPart[] | null;
11
11
  toolCalls?: OpenRouterToolCall[];
12
12
  toolCallId?: string;
13
13
  }
@@ -39,6 +39,9 @@ interface OpenRouterUsage {
39
39
  prompt_tokens?: number;
40
40
  completion_tokens?: number;
41
41
  total_tokens?: number;
42
+ completionTokensDetails?: {
43
+ reasoningTokens?: number;
44
+ };
42
45
  }
43
46
  interface OpenRouterResponse {
44
47
  id: string;
@@ -66,6 +69,13 @@ interface OpenRouterRequest {
66
69
  };
67
70
  user?: string;
68
71
  }
72
+ /**
73
+ * OpenRouter content part types (text only - images/files not supported)
74
+ */
75
+ type OpenRouterContentPart = {
76
+ type: "text";
77
+ text: string;
78
+ };
69
79
  /**
70
80
  * OpenRouterAdapter implements the ProviderAdapter interface for OpenRouter's API.
71
81
  * OpenRouter provides a unified API to access hundreds of AI models through OpenAI-compatible endpoints.
@@ -74,7 +84,7 @@ interface OpenRouterRequest {
74
84
  */
75
85
  export declare class OpenRouterAdapter extends BaseProviderAdapter {
76
86
  readonly name: "openrouter";
77
- readonly defaultModel: "openai/gpt-4o";
87
+ readonly defaultModel: "z-ai/glm-4.7";
78
88
  buildRequest(request: OperateRequest): OpenRouterRequest;
79
89
  formatTools(toolkit: Toolkit, outputSchema?: JsonObject): ProviderToolDefinition[];
80
90
  formatOutputSchema(schema: JsonObject | NaturalSchema | z.ZodType): JsonObject;
@@ -1,4 +1,4 @@
1
- import { LlmHistory, LlmInputMessage, LlmOperateOptions } from "../../types/LlmProvider.interface.js";
1
+ import { LlmHistory, LlmInputMessage, LlmOperateInput, LlmOperateOptions } from "../../types/LlmProvider.interface.js";
2
2
  export interface ProcessedInput {
3
3
  /** The processed history with all messages formatted */
4
4
  history: LlmHistory;
@@ -15,11 +15,11 @@ export declare class InputProcessor {
15
15
  /**
16
16
  * Process input with placeholders, history merging, and system message handling
17
17
  *
18
- * @param input - The raw input (string, message, or history)
18
+ * @param input - The raw input (string, message, history, or LlmOperateInput)
19
19
  * @param options - The operate options containing data, history, system, etc.
20
20
  * @returns Processed input with all transformations applied
21
21
  */
22
- process(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): ProcessedInput;
22
+ process(input: string | LlmHistory | LlmInputMessage | LlmOperateInput, options?: LlmOperateOptions): Promise<ProcessedInput>;
23
23
  /**
24
24
  * Format input and apply placeholders if data is provided
25
25
  */
@@ -45,6 +45,18 @@ export declare class ResponseBuilder {
45
45
  * Append items to the output
46
46
  */
47
47
  appendToOutput(...items: LlmOutput): this;
48
+ /**
49
+ * Set the reasoning array
50
+ */
51
+ setReasoning(reasoning: string[]): this;
52
+ /**
53
+ * Append reasoning text items
54
+ */
55
+ appendToReasoning(...items: string[]): this;
56
+ /**
57
+ * Get the current reasoning array
58
+ */
59
+ getReasoning(): string[];
48
60
  /**
49
61
  * Add a raw provider response
50
62
  */
@@ -78,7 +90,8 @@ export declare class ResponseBuilder {
78
90
  */
79
91
  incomplete(): this;
80
92
  /**
81
- * Build and return the final response object
93
+ * Build and return the final response object.
94
+ * Automatically extracts reasoning from history if not already set.
82
95
  */
83
96
  build(): LlmOperateResponse;
84
97
  }
@@ -0,0 +1,17 @@
1
+ import type { LlmOperateInput, LlmOperateInputContent, LlmOperateInputFile, LlmOperateInputImage } from "./LlmProvider.interface.js";
2
+ /**
3
+ * Type guard to check if an item is an LlmOperateInputFile
4
+ */
5
+ export declare function isLlmOperateInputFile(item: unknown): item is LlmOperateInputFile;
6
+ /**
7
+ * Type guard to check if an item is an LlmOperateInputImage
8
+ */
9
+ export declare function isLlmOperateInputImage(item: unknown): item is LlmOperateInputImage;
10
+ /**
11
+ * Type guard to check if an item is an LlmOperateInputContent
12
+ */
13
+ export declare function isLlmOperateInputContent(item: unknown): item is LlmOperateInputContent;
14
+ /**
15
+ * Type guard to check if input is an LlmOperateInput array
16
+ */
17
+ export declare function isLlmOperateInput(input: unknown): input is LlmOperateInput;
@@ -56,6 +56,51 @@ export interface LlmInputMessage {
56
56
  role: LlmMessageRole;
57
57
  type?: LlmMessageType.Message;
58
58
  }
59
+ /**
60
+ * File input that can be loaded from local filesystem, S3, or provided as base64 data.
61
+ * For PDFs, specific pages can be extracted via the `pages` property.
62
+ * If the file extension is an image type, it will be treated as an image internally.
63
+ */
64
+ export interface LlmOperateInputFile {
65
+ /** Path or filename (extension determines type via /\.(\w+)$/) */
66
+ file: string;
67
+ /** S3 bucket name (if present, load from S3) */
68
+ bucket?: string;
69
+ /** Specific pages to extract from PDF (omit = all pages) */
70
+ pages?: number[];
71
+ /** Base64 data (if present, use directly instead of loading from file) */
72
+ data?: string;
73
+ }
74
+ /**
75
+ * Image input that can be loaded from local filesystem, S3, or provided as base64 data.
76
+ */
77
+ export interface LlmOperateInputImage {
78
+ /** Path or filename */
79
+ image: string;
80
+ /** S3 bucket name (if present, load from S3) */
81
+ bucket?: string;
82
+ /** Base64 data (if present, use directly instead of loading from file) */
83
+ data?: string;
84
+ }
85
+ /**
86
+ * Content item in LlmOperateInput array.
87
+ * Can be a string (text), file object, or image object.
88
+ */
89
+ export type LlmOperateInputContent = string | LlmOperateInputFile | LlmOperateInputImage;
90
+ /**
91
+ * Simplified input format for operate() that supports automatic file resolution.
92
+ * Files/images are loaded from local filesystem, S3, or provided data.
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * const input: LlmOperateInput = [
97
+ * "Extract text from these documents",
98
+ * { file: "document.pdf", bucket: "my-bucket", pages: [1, 2, 3] },
99
+ * { image: "photo.png" }, // loads from local filesystem
100
+ * ];
101
+ * ```
102
+ */
103
+ export type LlmOperateInput = LlmOperateInputContent[];
59
104
  export interface LlmOutputContentText {
60
105
  annotations?: AnyValue[];
61
106
  text: string;
@@ -188,13 +233,14 @@ export interface LlmOperateResponse {
188
233
  model?: string;
189
234
  output: LlmOutput;
190
235
  provider?: string;
236
+ reasoning: string[];
191
237
  responses: JsonReturn[];
192
238
  status: LlmResponseStatus;
193
239
  usage: LlmUsage;
194
240
  }
195
241
  export interface LlmProvider {
196
- operate?(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): Promise<LlmOperateResponse>;
242
+ operate?(input: string | LlmHistory | LlmInputMessage | LlmOperateInput, options?: LlmOperateOptions): Promise<LlmOperateResponse>;
197
243
  send(message: string, options?: LlmMessageOptions): Promise<string | JsonObject>;
198
- stream?(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
244
+ stream?(input: string | LlmHistory | LlmInputMessage | LlmOperateInput, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
199
245
  }
200
246
  export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Extract file extension from a path or filename
3
+ */
4
+ export declare function getFileExtension(filePath: string): string | undefined;
5
+ /**
6
+ * Determine MIME type from file extension
7
+ */
8
+ export declare function getMimeType(filePath: string): string | undefined;
9
+ /**
10
+ * Check if a file path has an image extension
11
+ */
12
+ export declare function isImageExtension(filePath: string): boolean;
13
+ /**
14
+ * Check if a file path has a PDF extension
15
+ */
16
+ export declare function isPdfExtension(filePath: string): boolean;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Extract specific pages from a PDF buffer
3
+ * @param pdfBytes - Buffer containing the PDF data
4
+ * @param pages - Array of page numbers to extract (1-indexed)
5
+ * @returns Buffer containing a new PDF with only the specified pages
6
+ */
7
+ export declare function extractPdfPages(pdfBytes: Buffer, pages: number[]): Promise<Buffer>;
8
+ /**
9
+ * Get the total number of pages in a PDF
10
+ * @param pdfBytes - Buffer containing the PDF data
11
+ * @returns Total number of pages
12
+ */
13
+ export declare function getPdfPageCount(pdfBytes: Buffer): Promise<number>;
@@ -0,0 +1,5 @@
1
+ export { getFileExtension, getMimeType, isImageExtension, isPdfExtension, } from "./detectMimeType.js";
2
+ export { extractPdfPages, getPdfPageCount } from "./extractPdfPages.js";
3
+ export { loadLocalFile } from "./loadLocalFile.js";
4
+ export { loadS3File } from "./loadS3File.js";
5
+ export { resolveOperateInput } from "./resolveOperateInput.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Load a file from the local filesystem
3
+ * @param filePath - Path to the file (relative paths resolve from process.cwd())
4
+ * @returns Buffer containing the file contents
5
+ */
6
+ export declare function loadLocalFile(filePath: string): Promise<Buffer>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Load a file from S3
3
+ * @param bucket - S3 bucket name
4
+ * @param key - S3 object key
5
+ * @returns Buffer containing the file contents
6
+ */
7
+ export declare function loadS3File(bucket: string, key: string): Promise<Buffer>;
@@ -0,0 +1,12 @@
1
+ import { LlmInputMessage, LlmOperateInput } from "../types/LlmProvider.interface.js";
2
+ /**
3
+ * Resolve LlmOperateInput to LlmInputMessage
4
+ *
5
+ * This function takes the simplified LlmOperateInput format and resolves
6
+ * all files/images from their sources (provided data, S3, or local filesystem),
7
+ * converting them to the standard LlmInputMessage format.
8
+ *
9
+ * @param input - LlmOperateInput array
10
+ * @returns LlmInputMessage ready for LLM providers
11
+ */
12
+ export declare function resolveOperateInput(input: LlmOperateInput): Promise<LlmInputMessage>;
@@ -0,0 +1,14 @@
1
+ import { LlmHistory } from "../types/LlmProvider.interface.js";
2
+ /**
3
+ * Extracts reasoning text from LLM history items.
4
+ *
5
+ * Reasoning items may have text in different locations depending on the provider:
6
+ * - OpenAI: `summary` array with objects containing `text` property (type: "reasoning")
7
+ * - OpenAI: `content` property on reasoning items (type: "reasoning")
8
+ * - Anthropic: `thinking` property on thinking items (type: "thinking")
9
+ * - OpenRouter/z-ai: `reasoning` property on message items
10
+ *
11
+ * @param history - The LLM history array to extract reasoning from
12
+ * @returns Array of reasoning text strings
13
+ */
14
+ export declare function extractReasoning(history: LlmHistory): string[];
@@ -1,4 +1,5 @@
1
1
  export * from "./determineModelProvider.js";
2
+ export * from "./extractReasoning.js";
2
3
  export * from "./formatOperateInput.js";
3
4
  export * from "./formatOperateMessage.js";
4
5
  export * from "./logger.js";
package/dist/esm/Llm.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { JsonObject } from "@jaypie/types";
2
2
  import { LlmProviderName } from "./constants.js";
3
- import { LlmProvider, LlmHistory, LlmInputMessage, LlmMessageOptions, LlmOperateOptions, LlmOptions, LlmOperateResponse } from "./types/LlmProvider.interface.js";
3
+ import { LlmHistory, LlmInputMessage, LlmMessageOptions, LlmOperateInput, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProvider } from "./types/LlmProvider.interface.js";
4
4
  import { LlmStreamChunk } from "./types/LlmStreamChunk.interface.js";
5
5
  declare class Llm implements LlmProvider {
6
6
  private _provider;
@@ -9,19 +9,19 @@ declare class Llm implements LlmProvider {
9
9
  constructor(providerName?: LlmProviderName | string, options?: LlmOptions);
10
10
  private createProvider;
11
11
  send(message: string, options?: LlmMessageOptions): Promise<string | JsonObject>;
12
- operate(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): Promise<LlmOperateResponse>;
13
- stream(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
12
+ operate(input: string | LlmHistory | LlmInputMessage | LlmOperateInput, options?: LlmOperateOptions): Promise<LlmOperateResponse>;
13
+ stream(input: string | LlmHistory | LlmInputMessage | LlmOperateInput, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
14
14
  static send(message: string, options?: LlmMessageOptions & {
15
15
  llm?: LlmProviderName;
16
16
  apiKey?: string;
17
17
  model?: string;
18
18
  }): Promise<string | JsonObject>;
19
- static operate(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions & {
19
+ static operate(input: string | LlmHistory | LlmInputMessage | LlmOperateInput, options?: LlmOperateOptions & {
20
20
  llm?: LlmProviderName;
21
21
  apiKey?: string;
22
22
  model?: string;
23
23
  }): Promise<LlmOperateResponse>;
24
- static stream(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions & {
24
+ static stream(input: string | LlmHistory | LlmInputMessage | LlmOperateInput, options?: LlmOperateOptions & {
25
25
  llm?: LlmProviderName;
26
26
  apiKey?: string;
27
27
  model?: string;
@@ -1,10 +1,10 @@
1
1
  export declare const PROVIDER: {
2
2
  readonly OPENROUTER: {
3
3
  readonly MODEL: {
4
- readonly DEFAULT: "openai/gpt-4o";
5
- readonly SMALL: "openai/gpt-4o-mini";
6
- readonly LARGE: "anthropic/claude-3-opus";
7
- readonly TINY: "openai/gpt-4o-mini";
4
+ readonly DEFAULT: "z-ai/glm-4.7";
5
+ readonly SMALL: "z-ai/glm-4.7";
6
+ readonly LARGE: "z-ai/glm-4.7";
7
+ readonly TINY: "z-ai/glm-4.7";
8
8
  };
9
9
  readonly MODEL_MATCH_WORDS: readonly ["openrouter"];
10
10
  readonly NAME: "openrouter";
@@ -17,17 +17,10 @@ export declare const PROVIDER: {
17
17
  };
18
18
  readonly GEMINI: {
19
19
  readonly MODEL: {
20
- readonly DEFAULT: "gemini-2.5-flash";
21
- readonly SMALL: "gemini-2.5-flash";
22
- readonly LARGE: "gemini-2.5-pro";
23
- readonly TINY: "gemini-2.0-flash-lite";
24
- readonly GEMINI_2_5_PRO: "gemini-2.5-pro";
25
- readonly GEMINI_2_5_FLASH: "gemini-2.5-flash";
26
- readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
27
- readonly GEMINI_2_0_FLASH_LITE: "gemini-2.0-flash-lite";
28
- readonly GEMINI_1_5_PRO: "gemini-1.5-pro";
29
- readonly GEMINI_1_5_FLASH: "gemini-1.5-flash";
30
- readonly GEMINI_1_5_FLASH_8B: "gemini-1.5-flash-8b";
20
+ readonly DEFAULT: "gemini-3-pro-preview";
21
+ readonly LARGE: "gemini-3-pro-preview";
22
+ readonly SMALL: "gemini-3-flash-preview";
23
+ readonly TINY: "gemini-3-flash-preview";
31
24
  };
32
25
  readonly MODEL_MATCH_WORDS: readonly ["gemini", "google"];
33
26
  readonly NAME: "gemini";
@@ -38,24 +31,10 @@ export declare const PROVIDER: {
38
31
  };
39
32
  readonly ANTHROPIC: {
40
33
  readonly MODEL: {
41
- readonly DEFAULT: "claude-opus-4-1";
42
- readonly SMALL: "claude-sonnet-4-0";
43
- readonly TINY: "claude-3-5-haiku-latest";
44
- readonly LARGE: "claude-opus-4-1";
45
- readonly CLAUDE_OPUS_4: "claude-opus-4-1";
46
- readonly CLAUDE_SONNET_4: "claude-sonnet-4-0";
47
- readonly CLAUDE_3_HAIKU: "claude-3-5-haiku-latest";
48
- readonly CLAUDE_3_OPUS: "claude-3-opus-latest";
49
- readonly CLAUDE_3_SONNET: "claude-3-7-sonnet-latest";
50
- readonly CLAUDE_OPUS_4_1: "claude-opus-4-1";
51
- readonly CLAUDE_OPUS_4_0: "claude-opus-4-0";
52
- readonly CLAUDE_SONNET_4_0: "claude-sonnet-4-0";
53
- readonly CLAUDE_3_7_SONNET: "claude-3-7-sonnet-latest\t";
54
- readonly CLAUDE_3_5_SONNET: "claude-3-5-sonnet-latest";
55
- readonly CLAUDE_3_5_HAIKU: "claude-3-5-haiku-latest";
56
- readonly CLAUDE_HAIKU_3: "claude-3-5-haiku-latest";
57
- readonly CLAUDE_OPUS_3: "claude-3-opus-latest";
58
- readonly CLAUDE_SONNET_3: "claude-3-7-sonnet-latest";
34
+ readonly DEFAULT: "claude-sonnet-4-5";
35
+ readonly LARGE: "claude-opus-4-5";
36
+ readonly SMALL: "claude-sonnet-4-5";
37
+ readonly TINY: "claude-haiku-4-5";
59
38
  };
60
39
  readonly MODEL_MATCH_WORDS: readonly ["anthropic", "claude", "haiku", "opus", "sonnet"];
61
40
  readonly NAME: "anthropic";
@@ -77,28 +56,10 @@ export declare const PROVIDER: {
77
56
  };
78
57
  readonly OPENAI: {
79
58
  readonly MODEL: {
80
- readonly DEFAULT: "gpt-5";
81
- readonly SMALL: "gpt-5-mini";
82
- readonly LARGE: "gpt-5";
83
- readonly TINY: "gpt-5-nano";
84
- readonly GPT_5: "gpt-5";
85
- readonly GPT_5_MINI: "gpt-5-mini";
86
- readonly GPT_5_NANO: "gpt-5-nano";
87
- readonly GPT_4_1: "gpt-4.1";
88
- readonly GPT_4_1_MINI: "gpt-4.1-mini";
89
- readonly GPT_4_1_NANO: "gpt-4.1-nano";
90
- readonly GPT_4: "gpt-4";
91
- readonly GPT_4_O_MINI: "gpt-4o-mini";
92
- readonly GPT_4_O: "gpt-4o";
93
- readonly GPT_4_5: "gpt-4.5-preview";
94
- readonly O1: "o1";
95
- readonly O1_MINI: "o1-mini";
96
- readonly O1_PRO: "o1-pro";
97
- readonly O3_MINI: "o3-mini";
98
- readonly O3_MINI_HIGH: "o3-mini-high";
99
- readonly O3: "o3";
100
- readonly O3_PRO: "o3-pro";
101
- readonly O4_MINI: "o4-mini";
59
+ readonly DEFAULT: "gpt-5.1";
60
+ readonly LARGE: "gpt-5.1";
61
+ readonly SMALL: "gpt-5.1-mini";
62
+ readonly TINY: "gpt-5.1-nano";
102
63
  };
103
64
  readonly MODEL_MATCH_WORDS: readonly ["openai", "gpt", RegExp];
104
65
  readonly NAME: "openai";
@@ -106,32 +67,27 @@ export declare const PROVIDER: {
106
67
  };
107
68
  export type LlmProviderName = typeof PROVIDER.ANTHROPIC.NAME | typeof PROVIDER.GEMINI.NAME | typeof PROVIDER.OPENAI.NAME | typeof PROVIDER.OPENROUTER.NAME;
108
69
  export declare const DEFAULT: {
70
+ readonly MODEL: {
71
+ readonly BASE: "gpt-5.1";
72
+ readonly LARGE: "gpt-5.1";
73
+ readonly SMALL: "gpt-5.1-mini";
74
+ readonly TINY: "gpt-5.1-nano";
75
+ };
109
76
  readonly PROVIDER: {
110
77
  readonly MODEL: {
111
- readonly DEFAULT: "gpt-5";
112
- readonly SMALL: "gpt-5-mini";
113
- readonly LARGE: "gpt-5";
114
- readonly TINY: "gpt-5-nano";
115
- readonly GPT_5: "gpt-5";
116
- readonly GPT_5_MINI: "gpt-5-mini";
117
- readonly GPT_5_NANO: "gpt-5-nano";
118
- readonly GPT_4_1: "gpt-4.1";
119
- readonly GPT_4_1_MINI: "gpt-4.1-mini";
120
- readonly GPT_4_1_NANO: "gpt-4.1-nano";
121
- readonly GPT_4: "gpt-4";
122
- readonly GPT_4_O_MINI: "gpt-4o-mini";
123
- readonly GPT_4_O: "gpt-4o";
124
- readonly GPT_4_5: "gpt-4.5-preview";
125
- readonly O1: "o1";
126
- readonly O1_MINI: "o1-mini";
127
- readonly O1_PRO: "o1-pro";
128
- readonly O3_MINI: "o3-mini";
129
- readonly O3_MINI_HIGH: "o3-mini-high";
130
- readonly O3: "o3";
131
- readonly O3_PRO: "o3-pro";
132
- readonly O4_MINI: "o4-mini";
78
+ readonly DEFAULT: "gpt-5.1";
79
+ readonly LARGE: "gpt-5.1";
80
+ readonly SMALL: "gpt-5.1-mini";
81
+ readonly TINY: "gpt-5.1-nano";
133
82
  };
134
83
  readonly MODEL_MATCH_WORDS: readonly ["openai", "gpt", RegExp];
135
84
  readonly NAME: "openai";
136
85
  };
137
86
  };
87
+ export declare const ALL: {
88
+ readonly BASE: readonly ["claude-sonnet-4-5", "gemini-3-pro-preview", "gpt-5.1"];
89
+ readonly COMBINED: readonly ["claude-sonnet-4-5", "claude-opus-4-5", "claude-sonnet-4-5", "claude-haiku-4-5", "gemini-3-pro-preview", "gemini-3-pro-preview", "gemini-3-flash-preview", "gemini-3-flash-preview", "gpt-5.1", "gpt-5.1", "gpt-5.1-mini", "gpt-5.1-nano"];
90
+ readonly LARGE: readonly ["claude-opus-4-5", "gemini-3-pro-preview", "gpt-5.1"];
91
+ readonly SMALL: readonly ["claude-sonnet-4-5", "gemini-3-flash-preview", "gpt-5.1-mini"];
92
+ readonly TINY: readonly ["claude-haiku-4-5", "gemini-3-flash-preview", "gpt-5.1-nano"];
93
+ };
@@ -1,10 +1,12 @@
1
1
  export { default as Llm } from "./Llm.js";
2
2
  export * as LLM from "./constants.js";
3
- export type { LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProvider, } from "./types/LlmProvider.interface.js";
3
+ export type { LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmOperateInput, LlmOperateInputContent, LlmOperateInputFile, LlmOperateInputImage, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProvider, } from "./types/LlmProvider.interface.js";
4
4
  export { LlmMessageRole, LlmMessageType, } from "./types/LlmProvider.interface.js";
5
+ export { isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, } from "./types/LlmOperateInput.guards.js";
5
6
  export type { LlmTool } from "./types/LlmTool.interface.js";
6
7
  export type { LlmStreamChunk, LlmStreamChunkDone, LlmStreamChunkError, LlmStreamChunkText, LlmStreamChunkToolCall, LlmStreamChunkToolResult, } from "./types/LlmStreamChunk.interface.js";
7
8
  export { LlmStreamChunkType } from "./types/LlmStreamChunk.interface.js";
8
9
  export { JaypieToolkit, toolkit, Toolkit, tools } from "./tools/index.js";
10
+ export { extractReasoning } from "./util/extractReasoning.js";
9
11
  export { GeminiProvider } from "./providers/gemini/index.js";
10
12
  export { OpenRouterProvider } from "./providers/openrouter/index.js";