typia 9.2.0 → 9.3.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.
- package/lib/factories/ExpressionFactory.d.mts +1 -1
- package/lib/factories/ExpressionFactory.d.ts +1 -1
- package/lib/factories/ExpressionFactory.js +2 -2
- package/lib/factories/ExpressionFactory.js.map +1 -1
- package/lib/factories/ExpressionFactory.mjs +2 -2
- package/lib/llm.d.mts +185 -35
- package/lib/llm.d.ts +185 -35
- package/lib/llm.js +7 -0
- package/lib/llm.js.map +1 -1
- package/lib/llm.mjs +7 -1
- package/lib/schemas/json/IJsonApplication.d.mts +5 -1
- package/lib/schemas/json/IJsonApplication.d.ts +5 -1
- package/lib/schemas/json/IJsonApplication.js.map +1 -1
- package/lib/transformers/CallExpressionTransformer.js +2 -0
- package/lib/transformers/CallExpressionTransformer.js.map +1 -1
- package/lib/transformers/CallExpressionTransformer.mjs +2 -0
- package/lib/transformers/features/llm/LlmApplicationTransformer.js +46 -35
- package/lib/transformers/features/llm/LlmApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmApplicationTransformer.mjs +44 -34
- package/lib/transformers/features/llm/LlmControllerTransformer.d.mts +5 -0
- package/lib/transformers/features/llm/LlmControllerTransformer.d.ts +5 -0
- package/lib/transformers/features/llm/LlmControllerTransformer.js +67 -0
- package/lib/transformers/features/llm/LlmControllerTransformer.js.map +1 -0
- package/lib/transformers/features/llm/LlmControllerTransformer.mjs +63 -0
- package/lib/transformers/features/llm/LlmControllerTransformer.mjs.map +1 -0
- package/package.json +3 -3
- package/src/factories/ExpressionFactory.ts +5 -2
- package/src/llm.ts +207 -36
- package/src/schemas/json/IJsonApplication.ts +5 -1
- package/src/transformers/CallExpressionTransformer.ts +2 -0
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +64 -47
- package/src/transformers/features/llm/LlmControllerTransformer.ts +93 -0
|
@@ -16,7 +16,7 @@ export declare namespace ExpressionFactory {
|
|
|
16
16
|
function: ts.Expression;
|
|
17
17
|
arguments: ts.Expression[];
|
|
18
18
|
}) => ts.CallExpression;
|
|
19
|
-
const selfCall: (body: ts.ConciseBody) => ts.CallExpression;
|
|
19
|
+
const selfCall: (body: ts.ConciseBody, type?: ts.TypeNode | undefined) => ts.CallExpression;
|
|
20
20
|
const getEscapedText: (props: {
|
|
21
21
|
printer: ts.Printer;
|
|
22
22
|
input: ts.Expression;
|
|
@@ -16,7 +16,7 @@ export declare namespace ExpressionFactory {
|
|
|
16
16
|
function: ts.Expression;
|
|
17
17
|
arguments: ts.Expression[];
|
|
18
18
|
}) => ts.CallExpression;
|
|
19
|
-
const selfCall: (body: ts.ConciseBody) => ts.CallExpression;
|
|
19
|
+
const selfCall: (body: ts.ConciseBody, type?: ts.TypeNode | undefined) => ts.CallExpression;
|
|
20
20
|
const getEscapedText: (props: {
|
|
21
21
|
printer: ts.Printer;
|
|
22
22
|
input: ts.Expression;
|
|
@@ -38,9 +38,9 @@ var ExpressionFactory;
|
|
|
38
38
|
prev = typescript_1.default.factory.createCallExpression(prev, undefined, [param]);
|
|
39
39
|
return prev;
|
|
40
40
|
};
|
|
41
|
-
ExpressionFactory.selfCall = (body) => typescript_1.default.isCallExpression(body)
|
|
41
|
+
ExpressionFactory.selfCall = (body, type) => typescript_1.default.isCallExpression(body)
|
|
42
42
|
? body
|
|
43
|
-
: typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createParenthesizedExpression(typescript_1.default.factory.createArrowFunction(undefined, undefined, [],
|
|
43
|
+
: typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createParenthesizedExpression(typescript_1.default.factory.createArrowFunction(undefined, undefined, [], type, undefined, body)), undefined, undefined);
|
|
44
44
|
ExpressionFactory.getEscapedText = (props) => props.printer.printNode(typescript_1.default.EmitHint.Expression, props.input, props.input.getSourceFile());
|
|
45
45
|
ExpressionFactory.transpile = (props) => {
|
|
46
46
|
const file = typescript_1.default.createSourceFile(`${(0, _randomFormatUuid_1._randomFormatUuid)()}.ts`, props.script, typescript_1.default.ScriptTarget.ESNext, true, typescript_1.default.ScriptKind.TS);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressionFactory.js","sourceRoot":"","sources":["../../src/factories/ExpressionFactory.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAI5B,qEAAkE;AAElE,IAAiB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ExpressionFactory.js","sourceRoot":"","sources":["../../src/factories/ExpressionFactory.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAI5B,qEAAkE;AAElE,IAAiB,iBAAiB,CAoNjC;AApND,WAAiB,iBAAiB;IACnB,wBAAM,GAAG,CAAC,KAAa,EAAE,EAAE,CACtC,KAAK,GAAG,CAAC;QACP,CAAC,CAAC,oBAAE,CAAC,OAAO,CAAC,2BAA2B,CACpC,oBAAE,CAAC,UAAU,CAAC,UAAU,EACxB,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CACjD;QACH,CAAC,CAAC,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAEhC,wBAAM,GAAG,CAAC,KAAsB,EAAE,EAAE,CAC/C,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAC7B,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EACrC,SAAS,EACT,CAAC,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAChD,CAAC;IAES,4BAAU,GAAG,CAAC,KAAoB,EAAiB,EAAE,CAChE,oBAAE,CAAC,OAAO,CAAC,sBAAsB,CAC/B,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,EACxC,KAAK,CACN,CAAC;IAES,yBAAO,GAAG,CAAC,KAAoB,EAAiB,EAAE,CAC7D,oBAAE,CAAC,OA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|
36
|
-
ExpressionFactory.selfCall = (body) => ts.isCallExpression(body)
|
|
36
|
+
ExpressionFactory.selfCall = (body, type) => ts.isCallExpression(body)
|
|
37
37
|
? body
|
|
38
|
-
: ts.factory.createCallExpression(ts.factory.createParenthesizedExpression(ts.factory.createArrowFunction(undefined, undefined, [],
|
|
38
|
+
: ts.factory.createCallExpression(ts.factory.createParenthesizedExpression(ts.factory.createArrowFunction(undefined, undefined, [], type, undefined, body)), undefined, undefined);
|
|
39
39
|
ExpressionFactory.getEscapedText = (props) => props.printer.printNode(ts.EmitHint.Expression, props.input, props.input.getSourceFile());
|
|
40
40
|
ExpressionFactory.transpile = (props) => {
|
|
41
41
|
const file = ts.createSourceFile(`${_randomFormatUuid()}.ts`, props.script, ts.ScriptTarget.ESNext, true, ts.ScriptKind.TS);
|
package/lib/llm.d.mts
CHANGED
|
@@ -1,6 +1,150 @@
|
|
|
1
|
-
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
1
|
+
import { ILlmApplication, ILlmController, ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
/**
|
|
3
|
-
* > You must configure the generic argument `
|
|
3
|
+
* > You must configure the generic argument `Class`.
|
|
4
|
+
*
|
|
5
|
+
* TypeScript functions to LLM function calling controller.
|
|
6
|
+
*
|
|
7
|
+
* Creates a controller of LLM (Large Language Model) function calling
|
|
8
|
+
* from a TypeScript class or interface type containing the target functions to be
|
|
9
|
+
* called by the LLM function calling feature. The returned controller contains
|
|
10
|
+
* not only the {@link application} of {@link ILlmFunction function calling schemas},
|
|
11
|
+
* but also the {@link ILlmController.execute executor} of the functions.
|
|
12
|
+
*
|
|
13
|
+
* If you put the returned {@link ILlmController} to the LLM provider like
|
|
14
|
+
* [OpenAI (ChatGPT)](https://openai.com/), the LLM will automatically select the
|
|
15
|
+
* proper function and fill its arguments from the conversation (maybe chatting text)
|
|
16
|
+
* with user (human). And you can actually call the function by using
|
|
17
|
+
* {@link ILlmController.execute} property. This is the concept of the LLM function
|
|
18
|
+
* calling.
|
|
19
|
+
*
|
|
20
|
+
* Here is an example of using `typia.llm.controller()` function for AI agent
|
|
21
|
+
* development of performing such AI function calling to mobile API classes
|
|
22
|
+
* through this `typia` and external `@agentica` libraries.
|
|
23
|
+
*
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { Agentica } from "@agentica/core";
|
|
26
|
+
* import typia from "typia";
|
|
27
|
+
*
|
|
28
|
+
* const agentica = new Agentica({
|
|
29
|
+
* model: "chatgpt",
|
|
30
|
+
* vendor: {
|
|
31
|
+
* api: new OpenAI({ apiKey: "********" }),
|
|
32
|
+
* model: "gpt-4o-mini",
|
|
33
|
+
* },
|
|
34
|
+
* controllers: [
|
|
35
|
+
* typia.llm.controller<ReactNativeFileSystem, "chatgpt">(
|
|
36
|
+
* "filesystem",
|
|
37
|
+
* new ReactNativeFileSystem(),
|
|
38
|
+
* ),
|
|
39
|
+
* typia.llm.controller<ReactNativeGallery, "chatgpt">(
|
|
40
|
+
* "gallery",
|
|
41
|
+
* new ReactNativeGallery(),
|
|
42
|
+
* ),
|
|
43
|
+
* ],
|
|
44
|
+
* });
|
|
45
|
+
* await agentica.conversate(
|
|
46
|
+
* "Organize photo collection and sort them into appropriate folders.",
|
|
47
|
+
* );
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* Here is the list of available `Model` types with their corresponding LLM schema.
|
|
51
|
+
* Reading the following list, and determine the `Model` type considering the
|
|
52
|
+
* characteristics of the target LLM provider.
|
|
53
|
+
*
|
|
54
|
+
* - LLM provider schemas
|
|
55
|
+
* - `chatgpt`: [`IChatGptSchema`](https://samchon.github.io/openapi/api/types/IChatGptSchema-1.html)
|
|
56
|
+
* - `claude`: [`IClaudeSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
57
|
+
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
58
|
+
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
59
|
+
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
60
|
+
* - Midldle layer schemas
|
|
61
|
+
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
62
|
+
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
63
|
+
*
|
|
64
|
+
* @template Class Target class or interface type collecting the functions to call
|
|
65
|
+
* @template Model LLM schema model
|
|
66
|
+
* @template Config Configuration of LLM schema composition
|
|
67
|
+
* @param name Identifier name of the controller
|
|
68
|
+
* @param execute Executor instance
|
|
69
|
+
* @param options Options for the LLM application construction
|
|
70
|
+
* @returns Controller of LLM function calling
|
|
71
|
+
* @reference https://wrtnlabs.io/agentica/docs/core/controller/typescript/
|
|
72
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
73
|
+
*/
|
|
74
|
+
export declare function controller(name: string, execute: object, options?: Partial<Pick<ILlmApplication.IOptions<any>, "separate">>): never;
|
|
75
|
+
/**
|
|
76
|
+
* TypeScript functions to LLM function calling controller.
|
|
77
|
+
*
|
|
78
|
+
* Creates a controller of LLM (Large Language Model) function calling
|
|
79
|
+
* from a TypeScript class or interface type containing the target functions to be
|
|
80
|
+
* called by the LLM function calling feature. The returned controller contains
|
|
81
|
+
* not only the {@link application} of {@link ILlmFunction function calling schemas},
|
|
82
|
+
* but also the {@link ILlmController.execute executor} of the functions.
|
|
83
|
+
*
|
|
84
|
+
* If you put the returned {@link ILlmController} to the LLM provider like
|
|
85
|
+
* [OpenAI (ChatGPT)](https://openai.com/), the LLM will automatically select the
|
|
86
|
+
* proper function and fill its arguments from the conversation (maybe chatting text)
|
|
87
|
+
* with user (human). And you can actually call the function by using
|
|
88
|
+
* {@link ILlmController.execute} property. This is the concept of the LLM function
|
|
89
|
+
* calling.
|
|
90
|
+
*
|
|
91
|
+
* Here is an example of using `typia.llm.controller()` function for AI agent
|
|
92
|
+
* development of performing such AI function calling to mobile API classes
|
|
93
|
+
* through this `typia` and external `@agentica` libraries.
|
|
94
|
+
*
|
|
95
|
+
* ```typescript
|
|
96
|
+
* import { Agentica } from "@agentica/core";
|
|
97
|
+
* import typia from "typia";
|
|
98
|
+
*
|
|
99
|
+
* const agentica = new Agentica({
|
|
100
|
+
* model: "chatgpt",
|
|
101
|
+
* vendor: {
|
|
102
|
+
* api: new OpenAI({ apiKey: "********" }),
|
|
103
|
+
* model: "gpt-4o-mini",
|
|
104
|
+
* },
|
|
105
|
+
* controllers: [
|
|
106
|
+
* typia.llm.controller<ReactNativeFileSystem, "chatgpt">(
|
|
107
|
+
* "filesystem",
|
|
108
|
+
* new ReactNativeFileSystem(),
|
|
109
|
+
* ),
|
|
110
|
+
* typia.llm.controller<ReactNativeGallery, "chatgpt">(
|
|
111
|
+
* "gallery",
|
|
112
|
+
* new ReactNativeGallery(),
|
|
113
|
+
* ),
|
|
114
|
+
* ],
|
|
115
|
+
* });
|
|
116
|
+
* await agentica.conversate(
|
|
117
|
+
* "Organize photo collection and sort them into appropriate folders.",
|
|
118
|
+
* );
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* Here is the list of available `Model` types with their corresponding LLM schema.
|
|
122
|
+
* Reading the following list, and determine the `Model` type considering the
|
|
123
|
+
* characteristics of the target LLM provider.
|
|
124
|
+
*
|
|
125
|
+
* - LLM provider schemas
|
|
126
|
+
* - `chatgpt`: [`IChatGptSchema`](https://samchon.github.io/openapi/api/types/IChatGptSchema-1.html)
|
|
127
|
+
* - `claude`: [`IClaudeSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
128
|
+
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
129
|
+
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
130
|
+
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
131
|
+
* - Midldle layer schemas
|
|
132
|
+
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
133
|
+
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
134
|
+
*
|
|
135
|
+
* @template Class Target class or interface type collecting the functions to call
|
|
136
|
+
* @template Model LLM schema model
|
|
137
|
+
* @template Config Configuration of LLM schema composition
|
|
138
|
+
* @param name Identifier name of the controller
|
|
139
|
+
* @param execute Executor instance
|
|
140
|
+
* @param options Options for the LLM application construction
|
|
141
|
+
* @returns Controller of LLM function calling
|
|
142
|
+
* @reference https://wrtnlabs.io/agentica/docs/core/controller/typescript/
|
|
143
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
144
|
+
*/
|
|
145
|
+
export declare function controller<Class extends Record<string, any>, Model extends ILlmSchema.Model, Config extends Partial<ILlmSchema.ModelConfig[Model]> = {}>(name: string, execute: Class, options?: Partial<Pick<ILlmApplication.IOptions<Model>, "separate">>): ILlmController<Model>;
|
|
146
|
+
/**
|
|
147
|
+
* > You must configure the generic argument `Class`.
|
|
4
148
|
*
|
|
5
149
|
* TypeScript functions to LLM function calling application.
|
|
6
150
|
*
|
|
@@ -37,14 +181,15 @@ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
|
37
181
|
*
|
|
38
182
|
* - LLM provider schemas
|
|
39
183
|
* - `chatgpt`: [`IChatGptSchema`](https://github.com/samchon/openapi/blob/master/src/structures/IChatGptSchema.ts)
|
|
40
|
-
* - `claude`: [`IClaudeSchema`](https://github.
|
|
41
|
-
* - `
|
|
42
|
-
* - `
|
|
184
|
+
* - `claude`: [`IClaudeSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
185
|
+
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
186
|
+
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
187
|
+
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
43
188
|
* - Midldle layer schemas
|
|
44
|
-
* - `3.0`: [`ILlmSchemaV3`](https://github.
|
|
45
|
-
* - `3.1`: [`ILlmSchemaV3_1`](https://github.
|
|
189
|
+
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
190
|
+
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
46
191
|
*
|
|
47
|
-
* @template
|
|
192
|
+
* @template Class Target class or interface type collecting the functions to call
|
|
48
193
|
* @template Model LLM schema model
|
|
49
194
|
* @template Config Configuration of LLM schema composition
|
|
50
195
|
* @param options Options for the LLM application construction
|
|
@@ -89,14 +234,15 @@ export declare function application(options?: Partial<Pick<ILlmApplication.IOpti
|
|
|
89
234
|
*
|
|
90
235
|
* - LLM provider schemas
|
|
91
236
|
* - `chatgpt`: [`IChatGptSchema`](https://github.com/samchon/openapi/blob/master/src/structures/IChatGptSchema.ts)
|
|
92
|
-
* - `claude`: [`IClaudeSchema`](https://github.
|
|
93
|
-
* - `
|
|
94
|
-
* - `
|
|
237
|
+
* - `claude`: [`IClaudeSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
238
|
+
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
239
|
+
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
240
|
+
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
95
241
|
* - Midldle layer schemas
|
|
96
|
-
* - `3.0`: [`ILlmSchemaV3`](https://github.
|
|
97
|
-
* - `3.1`: [`ILlmSchemaV3_1`](https://github.
|
|
242
|
+
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
243
|
+
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
98
244
|
*
|
|
99
|
-
* @template
|
|
245
|
+
* @template Class Target class or interface type collecting the functions to call
|
|
100
246
|
* @template Model LLM schema model
|
|
101
247
|
* @template Config Configuration of LLM schema composition
|
|
102
248
|
* @param options Options for the LLM application construction
|
|
@@ -104,7 +250,7 @@ export declare function application(options?: Partial<Pick<ILlmApplication.IOpti
|
|
|
104
250
|
* @reference https://platform.openai.com/docs/guides/function-calling
|
|
105
251
|
* @author Jeongho Nam - https://github.com/samchon
|
|
106
252
|
*/
|
|
107
|
-
export declare function application<
|
|
253
|
+
export declare function application<Class extends Record<string, any>, Model extends ILlmSchema.Model, Config extends Partial<ILlmSchema.ModelConfig[Model]> = {}>(options?: Partial<Pick<ILlmApplication.IOptions<Model>, "separate">>): ILlmApplication<Model, Class>;
|
|
108
254
|
/**
|
|
109
255
|
* > You must configure the generic argument `Parameters`.
|
|
110
256
|
*
|
|
@@ -131,12 +277,13 @@ export declare function application<App extends Record<string, any>, Model exten
|
|
|
131
277
|
*
|
|
132
278
|
* - LLM provider schemas
|
|
133
279
|
* - `chatgpt`: [`IChatGptSchema`](https://github.com/samchon/openapi/blob/master/src/structures/IChatGptSchema.ts)
|
|
134
|
-
* - `claude`: [`IClaudeSchema`](https://github.
|
|
135
|
-
* - `
|
|
136
|
-
* - `
|
|
280
|
+
* - `claude`: [`IClaudeSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
281
|
+
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
282
|
+
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
283
|
+
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
137
284
|
* - Midldle layer schemas
|
|
138
|
-
* - `3.0`: [`ILlmSchemaV3`](https://github.
|
|
139
|
-
* - `3.1`: [`ILlmSchemaV3_1`](https://github.
|
|
285
|
+
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
286
|
+
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
140
287
|
*
|
|
141
288
|
* @template Parameters Target parameters type
|
|
142
289
|
* @template Model LLM schema model
|
|
@@ -170,12 +317,13 @@ export declare function parameters(): never;
|
|
|
170
317
|
*
|
|
171
318
|
* - LLM provider schemas
|
|
172
319
|
* - `chatgpt`: [`IChatGptSchema`](https://github.com/samchon/openapi/blob/master/src/structures/IChatGptSchema.ts)
|
|
173
|
-
* - `claude`: [`IClaudeSchema`](https://github.
|
|
174
|
-
* - `
|
|
175
|
-
* - `
|
|
320
|
+
* - `claude`: [`IClaudeSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
321
|
+
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
322
|
+
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
323
|
+
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
176
324
|
* - Midldle layer schemas
|
|
177
|
-
* - `3.0`: [`ILlmSchemaV3`](https://github.
|
|
178
|
-
* - `3.1`: [`ILlmSchemaV3_1`](https://github.
|
|
325
|
+
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
326
|
+
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
179
327
|
*
|
|
180
328
|
* @template Parameters Target parameters type
|
|
181
329
|
* @template Model LLM schema model
|
|
@@ -201,12 +349,13 @@ export declare function parameters<Parameters extends Record<string, any>, Model
|
|
|
201
349
|
*
|
|
202
350
|
* - LLM provider schemas
|
|
203
351
|
* - `chatgpt`: [`IChatGptSchema`](https://github.com/samchon/openapi/blob/master/src/structures/IChatGptSchema.ts)
|
|
204
|
-
* - `claude`: [`IClaudeSchema`](https://github.
|
|
205
|
-
* - `
|
|
206
|
-
* - `
|
|
352
|
+
* - `claude`: [`IClaudeSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
353
|
+
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
354
|
+
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
355
|
+
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
207
356
|
* - Midldle layer schemas
|
|
208
|
-
* - `3.0`: [`ILlmSchemaV3`](https://github.
|
|
209
|
-
* - `3.1`: [`ILlmSchemaV3_1`](https://github.
|
|
357
|
+
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
358
|
+
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
210
359
|
*
|
|
211
360
|
* If you actually want to perform the LLM function calling with TypeScript functions,
|
|
212
361
|
* you can do it with the {@link application} function. Otherwise you hope to perform the
|
|
@@ -247,12 +396,13 @@ export declare function schema(): never;
|
|
|
247
396
|
*
|
|
248
397
|
* - LLM provider schemas
|
|
249
398
|
* - `chatgpt`: [`IChatGptSchema`](https://github.com/samchon/openapi/blob/master/src/structures/IChatGptSchema.ts)
|
|
250
|
-
* - `claude`: [`IClaudeSchema`](https://github.
|
|
251
|
-
* - `
|
|
252
|
-
* - `
|
|
399
|
+
* - `claude`: [`IClaudeSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
400
|
+
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
401
|
+
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
402
|
+
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
253
403
|
* - Midldle layer schemas
|
|
254
|
-
* - `3.0`: [`ILlmSchemaV3`](https://github.
|
|
255
|
-
* - `3.1`: [`ILlmSchemaV3_1`](https://github.
|
|
404
|
+
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
405
|
+
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
256
406
|
*
|
|
257
407
|
* If you actually want to perform the LLM function calling with TypeScript functions,
|
|
258
408
|
* you can do it with the {@link application} function. Otherwise you hope to perform the
|