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.

·3 min read·View Oracle Docs

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 NameReturn TypeSupported Script TypesDescription
Citation.documentIdsstring[]Server scriptsContains the IDs of documents where the cited text resides.
Citation.endnumberServer scriptsIndicates the ending position of the cited text in the response.
Citation.startnumberServer scriptsRepresents the starting position of the cited text.
Citation.textstringServer scriptsThe 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:

    suitescript
    const 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:

    suitescript
    const citation = {
    end: 83,
    // other properties...
    };
  • Citation.start: Similarly, this property indicates where the cited text begins within the response string.

    suitescript
    const 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.

    suitescript
    const citation = {
    text: "only live in the Sahara desert.",
    // other properties...
    };

Example Usage

Here is an example demonstrating how these properties might be utilized:

suitescript
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, and text to 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?
No specific prerequisites are mentioned in the article, but familiarity with SuiteScript 2.1 and Large Language Model (LLM) functionalities are implied as essential for effective use of the Citation object.
Which script types support the members of the Citation object?
All the members of the Citation object, including documentIds, start, end, and text, are supported by server scripts in SuiteScript 2.1.
How do the 'start' and 'end' properties of the Citation object work in SuiteScript 2.1?
The 'start' and 'end' properties represent the character positions where the cited text begins and ends within the generated text response, allowing developers to accurately reference portions of text from the source documents.
How can the Citation object assist in working with multiple document sources in LLM integrations?
The Citation object allows developers to reference text citations from multiple document sources by providing properties such as documentIds, start, end, and text, which help manage and label text references in responses generated by LLM calls.
Source: Citation Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Platform

View all Platform articles →