@nx-ddd/any-func 19.139.0 → 19.140.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.
|
@@ -4,7 +4,7 @@ import * as i0 from '@angular/core';
|
|
|
4
4
|
import { Injectable, InjectionToken, inject } from '@angular/core';
|
|
5
5
|
import { injectOpenAiService } from '@nx-ddd/common/infrastructure/externals/openai';
|
|
6
6
|
import { lastValueFrom, of, map, switchMap, tap, catchError, retry } from 'rxjs';
|
|
7
|
-
import {
|
|
7
|
+
import { ZodType } from 'zod';
|
|
8
8
|
import zodToJsonSchema from 'zod-to-json-schema';
|
|
9
9
|
import { LOCAL_STORAGE } from '@nx-ddd/any-func/adapters/local-storage';
|
|
10
10
|
import CryptoJS from 'crypto-js';
|
|
@@ -315,7 +315,7 @@ class AnyFuncService {
|
|
|
315
315
|
return this.jsonSchema(_input, parameters, { ...options, validator });
|
|
316
316
|
}
|
|
317
317
|
async call(_input, args, params = {}) {
|
|
318
|
-
if (args instanceof
|
|
318
|
+
if (args instanceof ZodType)
|
|
319
319
|
return this.callByZod(_input, args, params);
|
|
320
320
|
if (args instanceof Function)
|
|
321
321
|
return this.callByClassValidator(_input, args, params);
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx-ddd/any-func",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.140.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/core": ">=17.0.0",
|
|
6
|
-
"@nx-ddd/common": "19.
|
|
6
|
+
"@nx-ddd/common": "19.140.2",
|
|
7
7
|
"class-transformer": "^0.5.1",
|
|
8
8
|
"class-validator": "^0.14.0",
|
|
9
9
|
"class-validator-jsonschema": "^5.0.0",
|
|
@@ -4,7 +4,7 @@ import { FunctionTool } from 'openai/resources/beta/assistants';
|
|
|
4
4
|
import { ChatCompletionCreateParamsBase } from 'openai/resources/chat/completions';
|
|
5
5
|
import { OpenAiServiceImpl } from '@nx-ddd/common/infrastructure/externals/openai/impl';
|
|
6
6
|
import * as _nx_ddd_common_types_nx_ddd_common_infrastructure_externals_openai_impl from '@nx-ddd/common/types/nx-ddd-common-infrastructure-externals-openai-impl';
|
|
7
|
-
import {
|
|
7
|
+
import { ZodType } from 'zod';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
9
|
import { InjectionToken } from '@angular/core';
|
|
10
10
|
import { ValidatorAdapter } from '@nx-ddd/any-func/adapters/validator';
|
|
@@ -120,13 +120,13 @@ declare class AnyFuncService {
|
|
|
120
120
|
constructor();
|
|
121
121
|
jsonSchema(_input: any, jsonSchema: FunctionParameters, options?: CallOptions<any, any>): Promise<any>;
|
|
122
122
|
callByJsonSchema(_input: any, jsonSchema: FunctionParameters, { instructions, model, specs, embeddings, sample, temperature, maxRetry, validator, }?: CallOptions<any, any>): Promise<any>;
|
|
123
|
-
callByZod<I, O>(_input: I, zod:
|
|
123
|
+
callByZod<I, O>(_input: I, zod: ZodType<O>, options?: CallOptions<I, O>): Promise<O>;
|
|
124
124
|
callByClassValidator<I, O>(_input: I, args: {
|
|
125
125
|
new (): O;
|
|
126
126
|
}, options?: CallOptions<I, O>): Promise<O>;
|
|
127
127
|
call<I, O>(_input: I, args: {
|
|
128
128
|
new (): O;
|
|
129
|
-
} |
|
|
129
|
+
} | ZodType<O> | JsonSchema, params?: CallOptions<I, O>): Promise<O>;
|
|
130
130
|
protected complete<I, O>(_input: any, jsonSchema: FunctionParameters, messages: ChatCompletionMessageParam[], { model, temperature }?: CallOptions<I, O> & {
|
|
131
131
|
functionOutput?: object;
|
|
132
132
|
}): Promise<openai_resources.ChatCompletionMessage>;
|