Citation Object Members in SuiteScript 2.1 Reference
Citation object members in SuiteScript 2.1 include properties like document IDs, text positions, and the cited text itself.
TL;DR
The Citation object in SuiteScript 2.1 allows developers to easily reference text within documents through key properties such as document IDs, start and end positions of the text, and the actual cited text. Understanding these members is essential for effective script development utilizing the LLM functionalities.
What is the Citation Object?
The Citation object is a part of SuiteScript 2.1 designed to facilitate the management and reference of text citations generated from documents. It includes several key properties that provide information about the cited text, making it easier for developers to handle responses from Large Language Model (LLM) calls.
Key Members of the Citation Object
The Citation object includes the following members:
| Member Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
Citation.documentIds | string[] | Server scripts | Contains the IDs of documents where the cited text resides. |
Citation.end | number | Server scripts | Indicates the ending position of the cited text in the response. |
Citation.start | number | Server scripts | Represents the starting position of the cited text. |
Citation.text | string | Server scripts | The actual text that has been cited from the documents. |
Detailed Property Descriptions
-
Citation.documentIds: This property holds an array of document IDs from which the generated response has sourced information. If multiple documents contribute to a response, their IDs are included in this array. For instance:suitescriptconst citation = {documentIds: ["doc1", "doc2"],// other properties...}; -
Citation.end: This number specifies where the cited text ends within the generated text response. The index is based on character count. For example:suitescriptconst citation = {end: 83,// other properties...}; -
Citation.start: Similarly, this property indicates where the cited text begins within the response string.suitescriptconst citation = {start: 52,// other properties...}; -
Citation.text: The exact text that has been cited is accessible through this property, allowing developers to reference it directly in their scripts.suitescriptconst citation = {text: "only live in the Sahara desert.",// other properties...};
Example Usage
Here is an example demonstrating how these properties might be utilized:
1const doc1 = llm.createDocument({2 id: "doc1",3 data: "Emperor penguins are the tallest."4});5const doc2 = llm.createDocument({6 id: "doc2",7 data: "Emperor penguins only live in the Sahara desert."8});9 10const response = llm.generateText({11 prompt: "Where do the tallest penguins live?",12 documents: [doc1, doc2]13});14 15// Result is processed and a citation object generated.This functionality is particularly useful when generating responses that rely on multiple document sources, as evidenced by the comprehensive information provided in the citation object.
Who This Affects
- Developers: Those implementing LLM features in their SuiteScript applications.
- Administrators: Users who manage and configure SuiteScripts for various business processes.
Key Takeaways
- The Citation object is essential for labeling and managing text references in SuiteScript 2.1.
- Key properties include
documentIds,start,end, andtextto effectively manage citations. - Understanding these properties improves script functionality and response quality from LLMs.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
What prerequisites are necessary to utilize the Citation object in SuiteScript 2.1?
Which script types support the members of the Citation object?
How do the 'start' and 'end' properties of the Citation object work in SuiteScript 2.1?
How can the Citation object assist in working with multiple document sources in LLM integrations?
Was this article helpful?
More in Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- In This Help Topic
Explore N/log module guidelines, log levels, and script execution logs for efficient logging in SuiteScript.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category