Class representing a document loader for loading data from the SortXYZ blockchain using the SortXYZ API.

Example

const blockchainLoader = new SortXYZBlockchainLoader({
apiKey: "YOUR_SORTXYZ_API_KEY",
query: {
type: "NFTMetadata",
blockchain: "ethereum",
contractAddress: "0x887F3909C14DAbd9e9510128cA6cBb448E932d7f".toLowerCase(),
},
});

const blockchainData = await blockchainLoader.load();

const prompt =
"Describe the character with the attributes from the following json document in a 4 sentence story. ";
const model = new ChatOpenAI({ temperature: 0.9 })
const response = await model.invoke(
prompt + JSON.stringify(blockchainData[0], null, 2),
);
console.log(`user > ${prompt}`);
console.log(`chatgpt > ${response}`);

Hierarchy (view full)

Constructors

Properties

apiKey: string
blockchain: string
contractAddress: string
limit: number
queryType: string
sql: string

Methods

  • Method that loads the data from the SortXYZ blockchain based on the specified query parameters. It makes requests to the SortXYZ API and returns an array of Documents representing the retrieved data.

    Returns Promise<Document[]>

    Promise<Document[]> - An array of Documents representing the retrieved data.

  • Loads the documents and splits them using a specified text splitter.

    Parameters

    • splitter: TextSplitter = ...

    Returns Promise<Document[]>

    A Promise that resolves with an array of Document instances, each split according to the provided TextSplitter.

Generated using TypeDoc