@jaypie/llm 1.1.30-rc.0 → 1.2.0-rc.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.
Files changed (35) hide show
  1. package/dist/cjs/constants.d.ts +17 -1
  2. package/dist/cjs/index.cjs +725 -109
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.d.ts +1 -0
  5. package/dist/cjs/operate/adapters/AnthropicAdapter.d.ts +1 -1
  6. package/dist/cjs/operate/adapters/OpenRouterAdapter.d.ts +96 -0
  7. package/dist/cjs/operate/adapters/index.d.ts +1 -0
  8. package/dist/cjs/operate/index.d.ts +1 -1
  9. package/dist/cjs/providers/anthropic/utils.d.ts +3 -37
  10. package/dist/cjs/providers/gemini/utils.d.ts +3 -37
  11. package/dist/cjs/providers/openai/utils.d.ts +1 -36
  12. package/dist/cjs/providers/openrouter/OpenRouterProvider.class.d.ts +17 -0
  13. package/dist/cjs/providers/openrouter/index.d.ts +2 -0
  14. package/dist/cjs/providers/openrouter/utils.d.ts +15 -0
  15. package/dist/cjs/util/logger.d.ts +2 -71
  16. package/dist/esm/constants.d.ts +17 -1
  17. package/dist/esm/index.d.ts +1 -0
  18. package/dist/esm/index.js +709 -94
  19. package/dist/esm/index.js.map +1 -1
  20. package/dist/esm/operate/adapters/AnthropicAdapter.d.ts +1 -1
  21. package/dist/esm/operate/adapters/OpenRouterAdapter.d.ts +96 -0
  22. package/dist/esm/operate/adapters/index.d.ts +1 -0
  23. package/dist/esm/operate/index.d.ts +1 -1
  24. package/dist/esm/providers/anthropic/utils.d.ts +3 -37
  25. package/dist/esm/providers/gemini/utils.d.ts +3 -37
  26. package/dist/esm/providers/openai/utils.d.ts +1 -36
  27. package/dist/esm/providers/openrouter/OpenRouterProvider.class.d.ts +17 -0
  28. package/dist/esm/providers/openrouter/index.d.ts +2 -0
  29. package/dist/esm/providers/openrouter/utils.d.ts +15 -0
  30. package/dist/esm/util/logger.d.ts +2 -71
  31. package/package.json +24 -7
  32. package/dist/cjs/providers/anthropic/operate.d.ts +0 -16
  33. package/dist/cjs/providers/openai/operate.d.ts +0 -26
  34. package/dist/esm/providers/anthropic/operate.d.ts +0 -16
  35. package/dist/esm/providers/openai/operate.d.ts +0 -26
@@ -1,4 +1,4 @@
1
- import { Anthropic } from "@anthropic-ai/sdk";
1
+ import type { Anthropic } from "@anthropic-ai/sdk";
2
2
  import { JsonObject, NaturalSchema } from "@jaypie/types";
3
3
  import { z } from "zod/v4";
4
4
  import { Toolkit } from "../../tools/Toolkit.class.js";
@@ -0,0 +1,96 @@
1
+ import { JsonObject, NaturalSchema } from "@jaypie/types";
2
+ import { z } from "zod/v4";
3
+ import { Toolkit } from "../../tools/Toolkit.class.js";
4
+ import { LlmHistory, LlmOperateOptions, LlmUsageItem } from "../../types/LlmProvider.interface.js";
5
+ import { ClassifiedError, OperateRequest, ParsedResponse, ProviderToolDefinition, StandardToolCall, StandardToolResult } from "../types.js";
6
+ import { BaseProviderAdapter } from "./ProviderAdapter.interface.js";
7
+ interface OpenRouterMessage {
8
+ role: "system" | "user" | "assistant" | "tool";
9
+ content?: string | null;
10
+ toolCalls?: OpenRouterToolCall[];
11
+ toolCallId?: string;
12
+ }
13
+ interface OpenRouterToolCall {
14
+ id: string;
15
+ type: "function";
16
+ function: {
17
+ name: string;
18
+ arguments: string;
19
+ };
20
+ }
21
+ interface OpenRouterResponseMessage {
22
+ role: "assistant";
23
+ content?: string | null;
24
+ toolCalls?: OpenRouterToolCall[];
25
+ refusal?: string | null;
26
+ reasoning?: string | null;
27
+ }
28
+ interface OpenRouterChoice {
29
+ index: number;
30
+ message: OpenRouterResponseMessage;
31
+ finishReason: string | null;
32
+ finish_reason?: string | null;
33
+ }
34
+ interface OpenRouterUsage {
35
+ promptTokens: number;
36
+ completionTokens: number;
37
+ totalTokens: number;
38
+ prompt_tokens?: number;
39
+ completion_tokens?: number;
40
+ total_tokens?: number;
41
+ }
42
+ interface OpenRouterResponse {
43
+ id: string;
44
+ object: string;
45
+ created: number;
46
+ model: string;
47
+ choices: OpenRouterChoice[];
48
+ usage?: OpenRouterUsage;
49
+ }
50
+ interface OpenRouterTool {
51
+ type: "function";
52
+ function: {
53
+ name: string;
54
+ description: string;
55
+ parameters: JsonObject;
56
+ };
57
+ }
58
+ interface OpenRouterRequest {
59
+ model: string;
60
+ messages: OpenRouterMessage[];
61
+ tools?: OpenRouterTool[];
62
+ tool_choice?: "auto" | "none" | "required";
63
+ response_format?: {
64
+ type: "json_object" | "text";
65
+ };
66
+ user?: string;
67
+ }
68
+ /**
69
+ * OpenRouterAdapter implements the ProviderAdapter interface for OpenRouter's API.
70
+ * OpenRouter provides a unified API to access hundreds of AI models through OpenAI-compatible endpoints.
71
+ * It handles request building, response parsing, and error classification
72
+ * specific to OpenRouter's Chat Completions API.
73
+ */
74
+ export declare class OpenRouterAdapter extends BaseProviderAdapter {
75
+ readonly name: "openrouter";
76
+ readonly defaultModel: "openai/gpt-4o";
77
+ buildRequest(request: OperateRequest): OpenRouterRequest;
78
+ formatTools(toolkit: Toolkit, outputSchema?: JsonObject): ProviderToolDefinition[];
79
+ formatOutputSchema(schema: JsonObject | NaturalSchema | z.ZodType): JsonObject;
80
+ executeRequest(client: unknown, request: unknown): Promise<OpenRouterResponse>;
81
+ parseResponse(response: unknown, _options?: LlmOperateOptions): ParsedResponse;
82
+ extractToolCalls(response: unknown): StandardToolCall[];
83
+ extractUsage(response: unknown, model: string): LlmUsageItem;
84
+ formatToolResult(toolCall: StandardToolCall, result: StandardToolResult): OpenRouterMessage;
85
+ appendToolResult(request: unknown, toolCall: StandardToolCall, result: StandardToolResult): OpenRouterRequest;
86
+ responseToHistoryItems(response: unknown): LlmHistory;
87
+ classifyError(error: unknown): ClassifiedError;
88
+ isComplete(response: unknown): boolean;
89
+ hasStructuredOutput(response: unknown): boolean;
90
+ extractStructuredOutput(response: unknown): JsonObject | undefined;
91
+ private hasToolCalls;
92
+ private extractContent;
93
+ private convertMessagesToOpenRouter;
94
+ }
95
+ export declare const openRouterAdapter: OpenRouterAdapter;
96
+ export {};
@@ -3,3 +3,4 @@ export type { ProviderAdapter } from "./ProviderAdapter.interface.js";
3
3
  export { AnthropicAdapter, anthropicAdapter } from "./AnthropicAdapter.js";
4
4
  export { GeminiAdapter, geminiAdapter } from "./GeminiAdapter.js";
5
5
  export { OpenAiAdapter, openAiAdapter } from "./OpenAiAdapter.js";
6
+ export { OpenRouterAdapter, openRouterAdapter } from "./OpenRouterAdapter.js";
@@ -1,4 +1,4 @@
1
- export { AnthropicAdapter, anthropicAdapter, BaseProviderAdapter, GeminiAdapter, geminiAdapter, OpenAiAdapter, openAiAdapter, } from "./adapters/index.js";
1
+ export { AnthropicAdapter, anthropicAdapter, BaseProviderAdapter, GeminiAdapter, geminiAdapter, OpenAiAdapter, openAiAdapter, OpenRouterAdapter, openRouterAdapter, } from "./adapters/index.js";
2
2
  export type { ProviderAdapter } from "./adapters/index.js";
3
3
  export { createOperateLoop, OperateLoop } from "./OperateLoop.js";
4
4
  export type { OperateLoopConfig } from "./OperateLoop.js";
@@ -1,43 +1,9 @@
1
- import { log } from "@jaypie/core";
2
- import Anthropic from "@anthropic-ai/sdk";
1
+ import type Anthropic from "@anthropic-ai/sdk";
3
2
  import { LlmMessageOptions } from "../../types/LlmProvider.interface.js";
4
3
  import { z } from "zod/v4";
5
4
  import { JsonObject, NaturalSchema } from "@jaypie/types";
6
- export declare const getLogger: () => {
7
- debug: {
8
- (...args: unknown[]): void;
9
- var(key: string | Record<string, unknown>, value?: unknown): void;
10
- };
11
- error: {
12
- (...args: unknown[]): void;
13
- var(key: string | Record<string, unknown>, value?: unknown): void;
14
- };
15
- fatal: {
16
- (...args: unknown[]): void;
17
- var(key: string | Record<string, unknown>, value?: unknown): void;
18
- };
19
- info: {
20
- (...args: unknown[]): void;
21
- var(key: string | Record<string, unknown>, value?: unknown): void;
22
- };
23
- trace: {
24
- (...args: unknown[]): void;
25
- var(key: string | Record<string, unknown>, value?: unknown): void;
26
- };
27
- warn: {
28
- (...args: unknown[]): void;
29
- var(key: string | Record<string, unknown>, value?: unknown): void;
30
- };
31
- var(key: string | Record<string, unknown>, value?: unknown): void;
32
- with(tags: Record<string, unknown>): typeof log;
33
- tag(key: string | string[] | Record<string, unknown> | null, value?: string): void;
34
- untag(tags: string | string[] | Record<string, unknown> | null): void;
35
- lib(options: {
36
- level?: string;
37
- lib?: string;
38
- tags?: Record<string, unknown>;
39
- }): typeof log;
40
- };
5
+ export declare function loadSdk(): Promise<typeof import("@anthropic-ai/sdk")>;
6
+ export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger.js").default;
41
7
  export declare function initializeClient({ apiKey, }?: {
42
8
  apiKey?: string;
43
9
  }): Promise<Anthropic>;
@@ -1,41 +1,7 @@
1
- import { log as defaultLog } from "@jaypie/core";
2
- import { GoogleGenAI } from "@google/genai";
1
+ import type { GoogleGenAI } from "@google/genai";
3
2
  import { LlmMessageOptions } from "../../types/LlmProvider.interface.js";
4
- export declare const getLogger: () => {
5
- debug: {
6
- (...args: unknown[]): void;
7
- var(key: string | Record<string, unknown>, value?: unknown): void;
8
- };
9
- error: {
10
- (...args: unknown[]): void;
11
- var(key: string | Record<string, unknown>, value?: unknown): void;
12
- };
13
- fatal: {
14
- (...args: unknown[]): void;
15
- var(key: string | Record<string, unknown>, value?: unknown): void;
16
- };
17
- info: {
18
- (...args: unknown[]): void;
19
- var(key: string | Record<string, unknown>, value?: unknown): void;
20
- };
21
- trace: {
22
- (...args: unknown[]): void;
23
- var(key: string | Record<string, unknown>, value?: unknown): void;
24
- };
25
- warn: {
26
- (...args: unknown[]): void;
27
- var(key: string | Record<string, unknown>, value?: unknown): void;
28
- };
29
- var(key: string | Record<string, unknown>, value?: unknown): void;
30
- with(tags: Record<string, unknown>): typeof defaultLog;
31
- tag(key: string | string[] | Record<string, unknown> | null, value?: string): void;
32
- untag(tags: string | string[] | Record<string, unknown> | null): void;
33
- lib(options: {
34
- level?: string;
35
- lib?: string;
36
- tags?: Record<string, unknown>;
37
- }): typeof defaultLog;
38
- };
3
+ export declare function loadSdk(): Promise<typeof import("@google/genai")>;
4
+ export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger.js").default;
39
5
  export declare function initializeClient({ apiKey, }?: {
40
6
  apiKey?: string;
41
7
  }): Promise<GoogleGenAI>;
@@ -1,43 +1,8 @@
1
- import { log as defaultLog } from "@jaypie/core";
2
1
  import { JsonObject, NaturalSchema } from "@jaypie/types";
3
2
  import { OpenAI } from "openai";
4
3
  import { z } from "zod/v4";
5
4
  import { LlmMessageOptions } from "../../types/LlmProvider.interface.js";
6
- export declare const getLogger: () => {
7
- debug: {
8
- (...args: unknown[]): void;
9
- var(key: string | Record<string, unknown>, value?: unknown): void;
10
- };
11
- error: {
12
- (...args: unknown[]): void;
13
- var(key: string | Record<string, unknown>, value?: unknown): void;
14
- };
15
- fatal: {
16
- (...args: unknown[]): void;
17
- var(key: string | Record<string, unknown>, value?: unknown): void;
18
- };
19
- info: {
20
- (...args: unknown[]): void;
21
- var(key: string | Record<string, unknown>, value?: unknown): void;
22
- };
23
- trace: {
24
- (...args: unknown[]): void;
25
- var(key: string | Record<string, unknown>, value?: unknown): void;
26
- };
27
- warn: {
28
- (...args: unknown[]): void;
29
- var(key: string | Record<string, unknown>, value?: unknown): void;
30
- };
31
- var(key: string | Record<string, unknown>, value?: unknown): void;
32
- with(tags: Record<string, unknown>): typeof defaultLog;
33
- tag(key: string | string[] | Record<string, unknown> | null, value?: string): void;
34
- untag(tags: string | string[] | Record<string, unknown> | null): void;
35
- lib(options: {
36
- level?: string;
37
- lib?: string;
38
- tags?: Record<string, unknown>;
39
- }): typeof defaultLog;
40
- };
5
+ export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger.js").default;
41
6
  export declare function initializeClient({ apiKey, }?: {
42
7
  apiKey?: string;
43
8
  }): Promise<OpenAI>;
@@ -0,0 +1,17 @@
1
+ import { JsonObject } from "@jaypie/types";
2
+ import { LlmHistory, LlmInputMessage, LlmMessageOptions, LlmOperateOptions, LlmOperateResponse, LlmProvider } from "../../types/LlmProvider.interface.js";
3
+ export declare class OpenRouterProvider implements LlmProvider {
4
+ private model;
5
+ private _client?;
6
+ private _operateLoop?;
7
+ private apiKey?;
8
+ private log;
9
+ private conversationHistory;
10
+ constructor(model?: string, { apiKey }?: {
11
+ apiKey?: string;
12
+ });
13
+ private getClient;
14
+ private getOperateLoop;
15
+ send(message: string, options?: LlmMessageOptions): Promise<string | JsonObject>;
16
+ operate(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): Promise<LlmOperateResponse>;
17
+ }
@@ -0,0 +1,2 @@
1
+ export { OpenRouterProvider } from "./OpenRouterProvider.class.js";
2
+ export * from "./utils.js";
@@ -0,0 +1,15 @@
1
+ import type { OpenRouter } from "@openrouter/sdk";
2
+ import { LlmMessageOptions } from "../../types/LlmProvider.interface.js";
3
+ export declare function loadSdk(): Promise<typeof import("@openrouter/sdk")>;
4
+ export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger.js").default;
5
+ export declare function initializeClient({ apiKey, }?: {
6
+ apiKey?: string;
7
+ }): Promise<OpenRouter>;
8
+ export declare function getDefaultModel(): string;
9
+ export interface ChatMessage {
10
+ role: "system" | "user" | "assistant";
11
+ content: string;
12
+ }
13
+ export declare function formatSystemMessage(systemPrompt: string, { data, placeholders }?: Pick<LlmMessageOptions, "data" | "placeholders">): ChatMessage;
14
+ export declare function formatUserMessage(message: string, { data, placeholders }?: Pick<LlmMessageOptions, "data" | "placeholders">): ChatMessage;
15
+ export declare function prepareMessages(message: string, { system, data, placeholders }?: LlmMessageOptions): ChatMessage[];
@@ -1,71 +1,2 @@
1
- import { log as defaultLog } from "@jaypie/core";
2
- export declare const getLogger: () => {
3
- debug: {
4
- (...args: unknown[]): void;
5
- var(key: string | Record<string, unknown>, value?: unknown): void;
6
- };
7
- error: {
8
- (...args: unknown[]): void;
9
- var(key: string | Record<string, unknown>, value?: unknown): void;
10
- };
11
- fatal: {
12
- (...args: unknown[]): void;
13
- var(key: string | Record<string, unknown>, value?: unknown): void;
14
- };
15
- info: {
16
- (...args: unknown[]): void;
17
- var(key: string | Record<string, unknown>, value?: unknown): void;
18
- };
19
- trace: {
20
- (...args: unknown[]): void;
21
- var(key: string | Record<string, unknown>, value?: unknown): void;
22
- };
23
- warn: {
24
- (...args: unknown[]): void;
25
- var(key: string | Record<string, unknown>, value?: unknown): void;
26
- };
27
- var(key: string | Record<string, unknown>, value?: unknown): void;
28
- with(tags: Record<string, unknown>): typeof defaultLog;
29
- tag(key: string | string[] | Record<string, unknown> | null, value?: string): void;
30
- untag(tags: string | string[] | Record<string, unknown> | null): void;
31
- lib(options: {
32
- level?: string;
33
- lib?: string;
34
- tags?: Record<string, unknown>;
35
- }): typeof defaultLog;
36
- };
37
- export declare const log: {
38
- debug: {
39
- (...args: unknown[]): void;
40
- var(key: string | Record<string, unknown>, value?: unknown): void;
41
- };
42
- error: {
43
- (...args: unknown[]): void;
44
- var(key: string | Record<string, unknown>, value?: unknown): void;
45
- };
46
- fatal: {
47
- (...args: unknown[]): void;
48
- var(key: string | Record<string, unknown>, value?: unknown): void;
49
- };
50
- info: {
51
- (...args: unknown[]): void;
52
- var(key: string | Record<string, unknown>, value?: unknown): void;
53
- };
54
- trace: {
55
- (...args: unknown[]): void;
56
- var(key: string | Record<string, unknown>, value?: unknown): void;
57
- };
58
- warn: {
59
- (...args: unknown[]): void;
60
- var(key: string | Record<string, unknown>, value?: unknown): void;
61
- };
62
- var(key: string | Record<string, unknown>, value?: unknown): void;
63
- with(tags: Record<string, unknown>): typeof defaultLog;
64
- tag(key: string | string[] | Record<string, unknown> | null, value?: string): void;
65
- untag(tags: string | string[] | Record<string, unknown> | null): void;
66
- lib(options: {
67
- level?: string;
68
- lib?: string;
69
- tags?: Record<string, unknown>;
70
- }): typeof defaultLog;
71
- };
1
+ export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger").default;
2
+ export declare const log: import("@jaypie/logger/dist/esm/JaypieLogger").default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/llm",
3
- "version": "1.1.30-rc.0",
3
+ "version": "1.2.0-rc.0",
4
4
  "description": "Large language model utilities",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "license": "MIT",
10
10
  "author": "Finlayson Studio",
11
+ "sideEffects": false,
11
12
  "type": "module",
12
13
  "exports": {
13
14
  ".": {
@@ -31,11 +32,8 @@
31
32
  "typecheck": "tsc --noEmit"
32
33
  },
33
34
  "dependencies": {
34
- "@anthropic-ai/sdk": "^0.71.0",
35
- "@google/genai": "^1.30.0",
36
- "@jaypie/aws": "^1.1.15",
37
- "@jaypie/core": "^1.1.2",
38
- "@jaypie/errors": "^1.1.6",
35
+ "@jaypie/aws": "1.2.0-rc.0",
36
+ "@jaypie/errors": "1.2.0-rc.0",
39
37
  "openai": "^6.9.1",
40
38
  "openmeteo": "^1.2.0",
41
39
  "random": "^5.3.0",
@@ -43,7 +41,26 @@
43
41
  "zod": "^4.1.13"
44
42
  },
45
43
  "devDependencies": {
46
- "@jaypie/types": "^0.1.3"
44
+ "@anthropic-ai/sdk": "^0.71.0",
45
+ "@google/genai": "^1.30.0",
46
+ "@jaypie/types": "*",
47
+ "@openrouter/sdk": "^0.1.27"
48
+ },
49
+ "peerDependencies": {
50
+ "@anthropic-ai/sdk": "^0.71.0",
51
+ "@google/genai": "^1.30.0",
52
+ "@openrouter/sdk": "^0.1.27"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "@anthropic-ai/sdk": {
56
+ "optional": true
57
+ },
58
+ "@google/genai": {
59
+ "optional": true
60
+ },
61
+ "@openrouter/sdk": {
62
+ "optional": true
63
+ }
47
64
  },
48
65
  "publishConfig": {
49
66
  "access": "public"
@@ -1,16 +0,0 @@
1
- import { Anthropic } from "@anthropic-ai/sdk";
2
- import { LlmHistory, LlmInputMessage, LlmOperateOptions, LlmOperateResponse } from "../../types/LlmProvider.interface.js";
3
- import { LlmTool } from "../../types/LlmTool.interface.js";
4
- /**
5
- * OpenAI request options type that includes model and input properties
6
- */
7
- export type AnthropicRequestOptions = Omit<LlmOperateOptions, "tools"> & {
8
- model: string;
9
- input: LlmInputMessage | LlmHistory;
10
- text?: unknown;
11
- tools?: Omit<LlmTool, "call">[];
12
- };
13
- export declare function operate(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions, context?: {
14
- client: Anthropic;
15
- maxRetries?: number;
16
- }): Promise<LlmOperateResponse>;
@@ -1,26 +0,0 @@
1
- import { OpenAI } from "openai";
2
- import { LlmHistory, LlmInputMessage, LlmOperateOptions, LlmOperateResponse } from "../../types/LlmProvider.interface.js";
3
- import { LlmTool } from "../../types/LlmTool.interface.js";
4
- /**
5
- * OpenAI request options type that includes model and input properties
6
- */
7
- export type OpenAiRequestOptions = Omit<LlmOperateOptions, "tools"> & {
8
- model: string;
9
- input: LlmInputMessage | LlmHistory;
10
- text?: unknown;
11
- tools?: Omit<LlmTool, "call">[];
12
- };
13
- export declare const MAX_RETRIES_ABSOLUTE_LIMIT = 72;
14
- export declare const MAX_RETRIES_DEFAULT_LIMIT = 6;
15
- /**
16
- * Creates the request options for the OpenAI API call
17
- *
18
- * @param input - The formatted input messages
19
- * @param options - The LLM operation options
20
- * @returns The request options for the OpenAI API
21
- */
22
- export declare function createRequestOptions(input: LlmInputMessage | LlmHistory, options?: LlmOperateOptions): OpenAiRequestOptions;
23
- export declare function operate(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions, context?: {
24
- client: OpenAI;
25
- maxRetries?: number;
26
- }): Promise<LlmOperateResponse>;
@@ -1,16 +0,0 @@
1
- import { Anthropic } from "@anthropic-ai/sdk";
2
- import { LlmHistory, LlmInputMessage, LlmOperateOptions, LlmOperateResponse } from "../../types/LlmProvider.interface.js";
3
- import { LlmTool } from "../../types/LlmTool.interface.js";
4
- /**
5
- * OpenAI request options type that includes model and input properties
6
- */
7
- export type AnthropicRequestOptions = Omit<LlmOperateOptions, "tools"> & {
8
- model: string;
9
- input: LlmInputMessage | LlmHistory;
10
- text?: unknown;
11
- tools?: Omit<LlmTool, "call">[];
12
- };
13
- export declare function operate(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions, context?: {
14
- client: Anthropic;
15
- maxRetries?: number;
16
- }): Promise<LlmOperateResponse>;
@@ -1,26 +0,0 @@
1
- import { OpenAI } from "openai";
2
- import { LlmHistory, LlmInputMessage, LlmOperateOptions, LlmOperateResponse } from "../../types/LlmProvider.interface.js";
3
- import { LlmTool } from "../../types/LlmTool.interface.js";
4
- /**
5
- * OpenAI request options type that includes model and input properties
6
- */
7
- export type OpenAiRequestOptions = Omit<LlmOperateOptions, "tools"> & {
8
- model: string;
9
- input: LlmInputMessage | LlmHistory;
10
- text?: unknown;
11
- tools?: Omit<LlmTool, "call">[];
12
- };
13
- export declare const MAX_RETRIES_ABSOLUTE_LIMIT = 72;
14
- export declare const MAX_RETRIES_DEFAULT_LIMIT = 6;
15
- /**
16
- * Creates the request options for the OpenAI API call
17
- *
18
- * @param input - The formatted input messages
19
- * @param options - The LLM operation options
20
- * @returns The request options for the OpenAI API
21
- */
22
- export declare function createRequestOptions(input: LlmInputMessage | LlmHistory, options?: LlmOperateOptions): OpenAiRequestOptions;
23
- export declare function operate(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions, context?: {
24
- client: OpenAI;
25
- maxRetries?: number;
26
- }): Promise<LlmOperateResponse>;