@jaypie/llm 1.1.6 → 1.1.7

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.
@@ -1,8 +1,8 @@
1
- import { JsonObject } from "@jaypie/types";
1
+ import { AnyValue, JsonObject } from "@jaypie/types";
2
2
  export interface LlmTool {
3
3
  description: string;
4
4
  name: string;
5
5
  parameters: JsonObject;
6
6
  type: "function" | string;
7
- call: (...args: any[]) => Promise<any> | any;
7
+ call: (args?: JsonObject) => Promise<AnyValue> | AnyValue;
8
8
  }
@@ -0,0 +1,24 @@
1
+ import { LlmHistory, LlmInputMessage, LlmMessageRole } from "../types/LlmProvider.interface.js";
2
+ import { NaturalMap } from "@jaypie/types";
3
+ /**
4
+ * Options for formatOperateInput function
5
+ */
6
+ export interface FormatOperateInputOptions {
7
+ /**
8
+ * Data to use for placeholder substitution
9
+ */
10
+ data?: NaturalMap;
11
+ /**
12
+ * Role to use when converting a string to LlmInputMessage
13
+ */
14
+ role?: LlmMessageRole;
15
+ }
16
+ /**
17
+ * Converts various input types to a standardized LlmHistory format
18
+ * @param input - String, LlmInputMessage, or LlmHistory to format
19
+ * @param options - Optional configuration
20
+ * @param options.data - Data to use for placeholder substitution
21
+ * @param options.role - Role to use when converting a string to LlmInputMessage (defaults to User)
22
+ * @returns Standardized LlmHistory array
23
+ */
24
+ export declare function formatOperateInput(input: string | LlmInputMessage | LlmHistory, options?: FormatOperateInputOptions): LlmHistory;
@@ -0,0 +1,24 @@
1
+ import { LlmInputMessage, LlmMessageRole } from "../types/LlmProvider.interface.js";
2
+ import { NaturalMap } from "@jaypie/types";
3
+ /**
4
+ * Options for formatOperateMessage function
5
+ */
6
+ export interface FormatOperateMessageOptions {
7
+ /**
8
+ * Data to use for placeholder substitution
9
+ */
10
+ data?: NaturalMap;
11
+ /**
12
+ * Role to use for the message
13
+ */
14
+ role?: LlmMessageRole;
15
+ }
16
+ /**
17
+ * Converts a string to a standardized LlmInputMessage
18
+ * @param input - String to format
19
+ * @param options - Optional configuration
20
+ * @param options.data - Data to use for placeholder substitution
21
+ * @param options.role - Role to use for the message (defaults to User)
22
+ * @returns LlmInputMessage
23
+ */
24
+ export declare function formatOperateMessage(input: string, options?: FormatOperateMessageOptions): LlmInputMessage;
@@ -0,0 +1,7 @@
1
+ export * from "./formatOperateInput.js";
2
+ export * from "./formatOperateMessage.js";
3
+ export * from "./logger.js";
4
+ export * from "./maxTurnsFromOptions.js";
5
+ export * from "./naturalZodSchema.js";
6
+ export * from "./random.js";
7
+ export * from "./tryParseNumber.js";
@@ -0,0 +1,71 @@
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
+ };
@@ -0,0 +1,10 @@
1
+ import { LlmOperateOptions } from "../types/LlmProvider.interface.js";
2
+ export declare const MAX_TURNS_ABSOLUTE_LIMIT = 72;
3
+ export declare const MAX_TURNS_DEFAULT_LIMIT = 12;
4
+ /**
5
+ * Determines the maximum number of turns based on the provided options
6
+ *
7
+ * @param options - The LLM operate options
8
+ * @returns The maximum number of turns
9
+ */
10
+ export declare function maxTurnsFromOptions(options: LlmOperateOptions): number;
@@ -1,3 +1,3 @@
1
1
  import { z } from "zod";
2
2
  import { NaturalSchema } from "@jaypie/types";
3
- export default function naturalZodSchema(definition: NaturalSchema): z.ZodTypeAny;
3
+ export declare function naturalZodSchema(definition: NaturalSchema): z.ZodTypeAny;
@@ -35,5 +35,5 @@ export declare const DEFAULT_MAX = 1;
35
35
  * // Use consistent seeding
36
36
  * const seeded = rng({ seed: "my-seed" });
37
37
  */
38
- declare const random: (defaultSeed?: string) => RandomFunction;
39
- export default random;
38
+ export declare function random(defaultSeed?: string): RandomFunction;
39
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Options for tryParseNumber function
3
+ */
4
+ export interface TryParseNumberOptions {
5
+ /**
6
+ * Default value to return if parsing fails or results in NaN
7
+ */
8
+ defaultValue?: number;
9
+ /**
10
+ * Function to call with warning message if parsing fails or results in NaN
11
+ */
12
+ warnFunction?: (message: string) => void;
13
+ }
14
+ /**
15
+ * Attempts to parse a value as a number. Returns the original input if parsing fails or results in NaN.
16
+ * @param input - The value to attempt to parse as a number
17
+ * @param options - Optional configuration
18
+ * @param options.defaultValue - Default value to return if parsing fails or results in NaN
19
+ * @param options.warnFunction - Function to call with warning message if parsing fails or results in NaN
20
+ * @returns The parsed number, defaultValue (if specified and parsing fails), or the original input
21
+ */
22
+ export declare function tryParseNumber(input: unknown, options?: TryParseNumberOptions): number | unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/llm",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Large language model utilities",
5
5
  "license": "MIT",
6
6
  "author": "Finlayson Studio",
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "1026f2fc0b3f6ae0ca2e1b6495437364f1c4e6fe"
40
+ "gitHead": "8afa77184376db70544710e7414de80ed3a0f60a"
41
41
  }