@squidcloud/client 1.0.350 → 1.0.352
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/cjs/index.js +1 -1
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +2 -2
- package/dist/typescript-client/src/execute-function-options.d.ts +73 -0
- package/dist/typescript-client/src/index.d.ts +1 -0
- package/dist/typescript-client/src/squid.d.ts +4 -2
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ export declare const OPENAI_REASONING_CHAT_MODEL_NAMES: readonly ["o1", "o1-mini
|
|
|
13
13
|
/**
|
|
14
14
|
* @category AI
|
|
15
15
|
*/
|
|
16
|
-
export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-4o", "gpt-4o-mini", "o1", "o1-mini", "o3", "o3-mini", "o4-mini"];
|
|
16
|
+
export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-4o", "gpt-4o-mini", "gpt-4.1-nano", "gpt-4.1-mini", "gpt-4.1", "o1", "o1-mini", "o3", "o3-mini", "o4-mini"];
|
|
17
17
|
/**
|
|
18
18
|
* @category AI
|
|
19
19
|
*/
|
|
@@ -26,7 +26,7 @@ export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-3-5-haiku-lat
|
|
|
26
26
|
* The supported AI model names.
|
|
27
27
|
* @category AI
|
|
28
28
|
*/
|
|
29
|
-
export declare const AI_CHAT_MODEL_NAMES: readonly ["gpt-4o", "gpt-4o-mini", "o1", "o1-mini", "o3", "o3-mini", "o4-mini", "claude-3-5-haiku-latest", "claude-3-5-sonnet-latest", "claude-3-7-sonnet-latest", "gemini-1.5-pro", "gemini-2.0-flash"];
|
|
29
|
+
export declare const AI_CHAT_MODEL_NAMES: readonly ["gpt-4o", "gpt-4o-mini", "gpt-4.1-nano", "gpt-4.1-mini", "gpt-4.1", "o1", "o1-mini", "o3", "o3-mini", "o4-mini", "claude-3-5-haiku-latest", "claude-3-5-sonnet-latest", "claude-3-7-sonnet-latest", "gemini-1.5-pro", "gemini-2.0-flash"];
|
|
30
30
|
/**
|
|
31
31
|
* @category AI
|
|
32
32
|
*/
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Advanced options for a Squid `executeFunction` call. */
|
|
2
|
+
export interface ExecuteFunctionOptions<ResultType> {
|
|
3
|
+
/** The name of the `@executable` function to invoke. */
|
|
4
|
+
functionName: string;
|
|
5
|
+
/** Optional caching configuration. Reuses results based on argument values. */
|
|
6
|
+
caching?: ExecuteFunctionCachingOptions<ResultType>;
|
|
7
|
+
/**
|
|
8
|
+
* Deduplication config for sharing results of concurrent calls with the same args.
|
|
9
|
+
* When set to true a default mode with 'compareArgsByReference' is used.
|
|
10
|
+
*/
|
|
11
|
+
deduplication?: ConcurrentCallDeduplicationOptions | boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Defines caching behavior for `executeFunction`. */
|
|
14
|
+
export interface ExecuteFunctionCachingOptions<T> {
|
|
15
|
+
/** The caching implementation to use. */
|
|
16
|
+
cache: ExecuteFunctionCache<T>;
|
|
17
|
+
}
|
|
18
|
+
/** Interface for a function result cache. */
|
|
19
|
+
export interface ExecuteFunctionCache<ValueType> {
|
|
20
|
+
/** Retrieves a cached value for the given arguments. */
|
|
21
|
+
get(args: Array<unknown>): ExecuteFunctionCacheLookupResult<ValueType>;
|
|
22
|
+
/** Caches a result for the given arguments. */
|
|
23
|
+
set(args: Array<unknown>, value: ValueType): void;
|
|
24
|
+
}
|
|
25
|
+
/** Result object returned from a cache lookup. */
|
|
26
|
+
export type ExecuteFunctionCacheLookupResult<ValueType> = {
|
|
27
|
+
/** The cached value. */
|
|
28
|
+
value: ValueType;
|
|
29
|
+
/** Indicates that the value was found in the cache. */
|
|
30
|
+
found: true;
|
|
31
|
+
} | {
|
|
32
|
+
/** Indicates that the value was not found in the cache. */
|
|
33
|
+
found: false;
|
|
34
|
+
};
|
|
35
|
+
/** Comparator function type for evaluating argument equality. */
|
|
36
|
+
export type ExecuteFunctionArgsComparator = (args1: Array<unknown>, args2: Array<unknown>) => boolean;
|
|
37
|
+
/** Comparator that checks reference equality of arguments. */
|
|
38
|
+
export declare const compareArgsByReference: ExecuteFunctionArgsComparator;
|
|
39
|
+
/** Comparator that checks argument equality using serialization. */
|
|
40
|
+
export declare const compareArgsBySerializedValue: ExecuteFunctionArgsComparator;
|
|
41
|
+
/** A single cached result of a function call. */
|
|
42
|
+
export interface ExecuteFunctionCachedResult<T> {
|
|
43
|
+
/** Arguments used for the function call. */
|
|
44
|
+
args: Array<unknown>;
|
|
45
|
+
/** The result value returned by the function. */
|
|
46
|
+
result: T;
|
|
47
|
+
/** Time (in ms) when the result was cached. */
|
|
48
|
+
cacheTimeMillis: number;
|
|
49
|
+
}
|
|
50
|
+
/** Options for `LastUsedValueExecuteFunctionCache`. */
|
|
51
|
+
interface LastUsedValueExecuteFunctionCacheOptions {
|
|
52
|
+
/** Argument equality comparator. */
|
|
53
|
+
argsComparator: ExecuteFunctionArgsComparator;
|
|
54
|
+
/** Validity duration in milliseconds. */
|
|
55
|
+
valueExpirationMillis: number;
|
|
56
|
+
}
|
|
57
|
+
/** Lightweight cache storing only the last computed result. */
|
|
58
|
+
export declare class LastUsedValueExecuteFunctionCache<T> implements ExecuteFunctionCache<T> {
|
|
59
|
+
private readonly options;
|
|
60
|
+
protected cachedEntry?: ExecuteFunctionCachedResult<T>;
|
|
61
|
+
/** Creates a new instance of `LastUsedValueExecuteFunctionCache`. */
|
|
62
|
+
constructor(options: Partial<LastUsedValueExecuteFunctionCacheOptions>);
|
|
63
|
+
/** @inheritdoc */
|
|
64
|
+
get(args: Array<unknown>): ExecuteFunctionCacheLookupResult<T>;
|
|
65
|
+
/** @inheritdoc */
|
|
66
|
+
set(args: Array<unknown>, value: T): void;
|
|
67
|
+
}
|
|
68
|
+
/** Configuration for deduplicating concurrent function calls. */
|
|
69
|
+
export interface ConcurrentCallDeduplicationOptions {
|
|
70
|
+
/** Comparator to determine if concurrent calls are equivalent. */
|
|
71
|
+
argsComparator: ExecuteFunctionArgsComparator;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
@@ -17,6 +17,7 @@ export * from './document-identity.service';
|
|
|
17
17
|
export * from './document-reference.factory';
|
|
18
18
|
export * from './document-reference';
|
|
19
19
|
export * from './document-store';
|
|
20
|
+
export * from './execute-function-options';
|
|
20
21
|
export * from './mutation/mutation-sender';
|
|
21
22
|
export * from './native-query-manager';
|
|
22
23
|
export * from './public-types';
|
|
@@ -13,6 +13,7 @@ import { SchedulerClient } from './scheduler-client';
|
|
|
13
13
|
import { AdminClient } from './admin-client';
|
|
14
14
|
import { AiClient } from './ai-client';
|
|
15
15
|
import { WebClient } from './web-client';
|
|
16
|
+
import { ExecuteFunctionOptions } from './execute-function-options';
|
|
16
17
|
/**
|
|
17
18
|
* The different options that can be used to initialize a Squid instance.
|
|
18
19
|
* @category Platform
|
|
@@ -185,12 +186,13 @@ export declare class Squid {
|
|
|
185
186
|
* on the backend.
|
|
186
187
|
* - Arrays of files can also be passed directly as parameters.
|
|
187
188
|
*
|
|
188
|
-
* @param
|
|
189
|
+
* @param functionNameOrOptions - The name of the backend function to execute or detailed options which include
|
|
190
|
+
* additional advanced options along with the function name.
|
|
189
191
|
* @param params - A list of parameters to pass to the backend function.
|
|
190
192
|
* @returns A promise that resolves to the result of the backend function.
|
|
191
193
|
* @typeParam T - The expected type of the result returned by the backend function.
|
|
192
194
|
*/
|
|
193
|
-
executeFunction<T = any>(
|
|
195
|
+
executeFunction<T = any>(functionNameOrOptions: string | ExecuteFunctionOptions<T>, ...params: Array<any | File>): Promise<T>;
|
|
194
196
|
/**
|
|
195
197
|
* Executes a native relational query with the given parameters and returns a promise with the result.
|
|
196
198
|
* See https://docs.getsquid.ai/docs/client-sdk/database/native-queries.
|