sliftutils 1.0.1 → 1.0.2
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/index.d.ts +3 -0
- package/misc/openrouter.d.ts +3 -0
- package/misc/openrouter.ts +14 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -100,6 +100,9 @@ declare module "sliftutils/misc/openrouter" {
|
|
|
100
100
|
onCost?: (cost: number) => void;
|
|
101
101
|
validate?: (response: T) => void;
|
|
102
102
|
}): Promise<T>;
|
|
103
|
+
export declare function simpleAICall(model: string, message: string): Promise<string>;
|
|
104
|
+
/** The message must request the result to be returned in YAML. */
|
|
105
|
+
export declare function simpleAICallTyped<T>(model: string, message: string): Promise<T>;
|
|
103
106
|
export declare function openRouterCall(config: {
|
|
104
107
|
model: string;
|
|
105
108
|
messages: MessageHistory;
|
package/misc/openrouter.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ export declare function yamlOpenRouterCall<T>(config: {
|
|
|
28
28
|
onCost?: (cost: number) => void;
|
|
29
29
|
validate?: (response: T) => void;
|
|
30
30
|
}): Promise<T>;
|
|
31
|
+
export declare function simpleAICall(model: string, message: string): Promise<string>;
|
|
32
|
+
/** The message must request the result to be returned in YAML. */
|
|
33
|
+
export declare function simpleAICallTyped<T>(model: string, message: string): Promise<T>;
|
|
31
34
|
export declare function openRouterCall(config: {
|
|
32
35
|
model: string;
|
|
33
36
|
messages: MessageHistory;
|
package/misc/openrouter.ts
CHANGED
|
@@ -52,6 +52,20 @@ export async function yamlOpenRouterCall<T>(config: {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
export async function simpleAICall(model: string, message: string): Promise<string> {
|
|
56
|
+
return await openRouterCallBase({
|
|
57
|
+
model,
|
|
58
|
+
messages: [{ role: "user", content: message }],
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/** The message must request the result to be returned in YAML. */
|
|
62
|
+
export async function simpleAICallTyped<T>(model: string, message: string): Promise<T> {
|
|
63
|
+
return await yamlOpenRouterCall({
|
|
64
|
+
model,
|
|
65
|
+
messages: [{ role: "user", content: message }],
|
|
66
|
+
}) as T;
|
|
67
|
+
}
|
|
68
|
+
|
|
55
69
|
let pendingLog: {
|
|
56
70
|
count: number;
|
|
57
71
|
duration: number;
|