@hitc/netsuite-types 2024.2.11 → 2024.2.12
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/N/llm.d.ts +118 -0
- package/N/query.d.ts +3 -2
- package/N.d.ts +4 -0
- package/package.json +1 -1
package/N/llm.d.ts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The N/llm module supports generative artificial intelligence (AI) capabilities in SuiteScript.
|
|
3
|
+
* You can use this module to send requests to the large language models (LLMs) supported by NetSuite and to receive LLM responses to use in your scripts.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** The chat message object returned by the llm.createChatMessage(options) method. */
|
|
7
|
+
interface ChatMessage {
|
|
8
|
+
text: string;
|
|
9
|
+
readonly role: ChatRole;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** The response returned from LLM. Use the llm.generateText(options) or the llm.generateText.promise(options) method to retrieve a response from the LLM. */
|
|
13
|
+
interface Response {
|
|
14
|
+
readonly text: string;
|
|
15
|
+
readonly model: string;
|
|
16
|
+
readonly chatHistory: ChatMessage[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function createChatMessage(options: { role: string, text: string }): ChatMessage;
|
|
20
|
+
|
|
21
|
+
export const generateText: GenerateTextFunction;
|
|
22
|
+
|
|
23
|
+
/** Returns the number of free requests in the current month. */
|
|
24
|
+
export const getRemainingFreeUsage: GetRemainingFreeUsageFunction;
|
|
25
|
+
|
|
26
|
+
interface GenerateTextFunction {
|
|
27
|
+
(options: IGenerateTextOptions): Response;
|
|
28
|
+
promise(options: IGenerateTextOptions): Response;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface GetRemainingFreeUsageFunction {
|
|
32
|
+
(): number;
|
|
33
|
+
promise(): number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface IGenerateTextOptions {
|
|
37
|
+
/** Prompt for the LLM. */
|
|
38
|
+
prompt: string;
|
|
39
|
+
/** Chat history to be taken into consideration. */
|
|
40
|
+
chatHistory?: ChatMessage[];
|
|
41
|
+
/** Specifies the LLM to use. Use llm.ModelFamily to set the value. If not specified, the Cohere Command R LLM is used. */
|
|
42
|
+
modelFamily?: ModelFamily;
|
|
43
|
+
modelParameters?: IModelParameters;
|
|
44
|
+
/**
|
|
45
|
+
* Configuration needed for unlimited usage through OCI Generative AI Service.
|
|
46
|
+
* Required only when accessing the LLM through an Oracle Cloud Account and the OCI Generative AI Service.
|
|
47
|
+
* SuiteApps installed to target accounts are prevented from using the free usage pool for N/llm and must use the OCI configuration.
|
|
48
|
+
*/
|
|
49
|
+
ociConfig?: IOCIConfig;
|
|
50
|
+
preamble?: string;
|
|
51
|
+
timeout?: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface IModelParameters {
|
|
55
|
+
/** A penalty that is assigned to a token when that token appears frequently. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. See Model Parameter Values by LLM for valid values. */
|
|
56
|
+
frequencyPenalty?: number;
|
|
57
|
+
/** The maximum number of tokens the LLM is allowed to generate. The average number of tokens per word is 3. See Model Parameter Values by LLM for valid values. */
|
|
58
|
+
maxTokens?: number;
|
|
59
|
+
/**
|
|
60
|
+
* A penalty that is assigned to each token when it appears in the output to encourage generating outputs with tokens that haven't been used.
|
|
61
|
+
* Similar to frequencyPenalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
|
|
62
|
+
* See Model Parameter Values by LLM for valid values.
|
|
63
|
+
*/
|
|
64
|
+
presencePenalty?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Defines a range of randomness for the response.
|
|
67
|
+
* A lower temperature will lean toward the highest probability tokens and expected answers, while a higher temperature will deviate toward random and unconventional responses.
|
|
68
|
+
* A lower value works best for responses that must be more factual or accurate, and a higher value works best for getting more creative responses.
|
|
69
|
+
* See Model Parameter Values by LLM for valid values.
|
|
70
|
+
*/
|
|
71
|
+
temperature?: number;
|
|
72
|
+
/** Determines how many tokens are considered for generation at each step. See Model Parameter Values by LLM for valid values. */
|
|
73
|
+
topK?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Sets the probability, which ensures that only the most likely tokens with total probability mass of p are considered for generation at each step.
|
|
76
|
+
* If both topK and topP are set, topP acts after topK. See Model Parameter Values by LLM for valid values.
|
|
77
|
+
*/
|
|
78
|
+
topP?: number;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface IOCIConfig {
|
|
82
|
+
/** Compartment OCID. For more information, refer to Managing Compartments in the Oracle Cloud Infrastructure Documentation. */
|
|
83
|
+
compartmentId?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Endpoint ID. This value is needed only when a custom OCI DAC (dedicated AI cluster) is to be used.
|
|
86
|
+
* For more information, refer to Managing an Endpoint in Generative AI in the Oracle Cloud Infrastructure Documentation.
|
|
87
|
+
*/
|
|
88
|
+
endpointId?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Fingerprint of the public key (only a NetSuite secret is accepted—see Creating Secrets).
|
|
91
|
+
* For more information, refer to Required Keys and OCIDs in the Oracle Cloud Infrastructure Documentation.
|
|
92
|
+
*/
|
|
93
|
+
fingerprint?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Private key of the OCI user (only a NetSuite secret is accepted—see Creating Secrets).
|
|
96
|
+
* For more information, refer to Required Keys and OCIDs in the Oracle Cloud Infrastructure Documentation.
|
|
97
|
+
*/
|
|
98
|
+
privateKey?: string;
|
|
99
|
+
/** Tenancy OCID. For more information, refer to Managing the Tenancy in the Oracle Cloud Infrastructure Documentation. */
|
|
100
|
+
tenancyId?: string;
|
|
101
|
+
/** User OCID. For more information, refer to Managing Users in the Oracle Cloud Infrastructure Documentation. */
|
|
102
|
+
userId?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare enum ChatRole {
|
|
106
|
+
/** Identifies the author of the chat message (prompt) sent to the large language model. */
|
|
107
|
+
USER = "USER",
|
|
108
|
+
/** Identifies the author of the chat message (response text) received from the large language model. */
|
|
109
|
+
CHATBOT = "CHATBOT"
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** The large language model to be used. */
|
|
113
|
+
declare enum ModelFamily {
|
|
114
|
+
/** Always uses the latest supported Cohere model. Cohere Command-R is the default when the options.modelFamily parameter is omitted. */
|
|
115
|
+
COHERE_COMMAND = 'cohere.command-r-16k',
|
|
116
|
+
/** Always uses the latest supported Meta Llama model. */
|
|
117
|
+
META_LLAMA = 'meta.llama-3.1-70b-instruct'
|
|
118
|
+
}
|
package/N/query.d.ts
CHANGED
|
@@ -602,7 +602,8 @@ export interface Condition {
|
|
|
602
602
|
readonly component: Component;
|
|
603
603
|
}
|
|
604
604
|
|
|
605
|
-
export type
|
|
605
|
+
export type QueryResultValue = string | boolean | number | bigint | null;
|
|
606
|
+
export type QueryResultMap = { [fieldId: string]: QueryResultValue };
|
|
606
607
|
/**
|
|
607
608
|
* Set of results returned by the query.
|
|
608
609
|
*/
|
|
@@ -648,7 +649,7 @@ export interface Result {
|
|
|
648
649
|
* the array exactly matches the ResultSet.types, ResultSet.columns or Result.columns property.
|
|
649
650
|
* @throws {SuiteScriptError} READ_ONLY when setting the property is attempted
|
|
650
651
|
*/
|
|
651
|
-
readonly values: Array<
|
|
652
|
+
readonly values: Array<QueryResultValue>;
|
|
652
653
|
|
|
653
654
|
/**
|
|
654
655
|
* The return columns. This is equivalent to ResultSet.columns.
|
package/N.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ import * as N_http from './N/http';
|
|
|
17
17
|
import * as N_https from './N/https';
|
|
18
18
|
import * as N_keyControl from './N/keyControl';
|
|
19
19
|
import * as N_log from './N/log';
|
|
20
|
+
import * as N_llm from './N/llm';
|
|
21
|
+
import * as N_pgp from './N/pgp';
|
|
20
22
|
import * as N_plugin from './N/plugin';
|
|
21
23
|
import * as N_portlet from './N/portlet';
|
|
22
24
|
import * as N_query from './N/query';
|
|
@@ -64,6 +66,8 @@ export {N_http as http};
|
|
|
64
66
|
export {N_https as https};
|
|
65
67
|
export {N_keyControl as keyControl}
|
|
66
68
|
export {N_log as log};
|
|
69
|
+
export {N_llm as llm};
|
|
70
|
+
export {N_pgp as pgp};
|
|
67
71
|
export {N_piRemoval as piremoval};
|
|
68
72
|
export {N_plugin as plugin};
|
|
69
73
|
export {N_portlet as portlet};
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"posttest": "npm run cleanup"
|
|
9
9
|
},
|
|
10
10
|
"homepage": "https://github.com/headintheclouddev/typings-suitescript-2.0",
|
|
11
|
-
"version": "2024.2.
|
|
11
|
+
"version": "2024.2.12",
|
|
12
12
|
"author": "Head in the Cloud Development <gurus@headintheclouddev.com> (www.headintheclouddev.com)",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"repository": {
|