class SortXYZBlockchainLoaderClass representing a document loader for loading data from the SortXYZ blockchain using the SortXYZ API.
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.
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({ model: "gpt-4o-mini", temperature: 0.9 })
const response = await model.invoke(
prompt + JSON.stringify(blockchainData[0], null, 2),
);
console.log(`user > ${prompt}`);
console.log(`chatgpt > ${response}`);