@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 3.42 kB
Source Map (JSON)
{"version":3,"file":"sort_xyz_blockchain.d.cts","names":["Document","BaseDocumentLoader","Query","SortXYZBlockchainLoaderParams","SortXYZBlockchainAPIResponse","Record","SortXYZBlockchainLoader","apiKey","query","Promise"],"sources":["../../../src/document_loaders/web/sort_xyz_blockchain.d.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\nimport { BaseDocumentLoader } from \"@langchain/core/document_loaders/base\";\n/**\n * See https://docs.sort.xyz/docs/api-keys to get your free Sort API key.\n * See https://docs.sort.xyz for more information on the available queries.\n * See https://docs.sort.xyz/reference for more information about Sort's REST API.\n */\nexport interface Query {\n type: \"NFTMetadata\" | \"latestTransactions\";\n contractAddress: string;\n blockchain: \"ethereum\" | \"polygon\" | \"goerli\";\n limit?: number;\n}\n/**\n * Interface representing the parameters for the SortXYZBlockchainLoader\n * class.\n */\nexport interface SortXYZBlockchainLoaderParams {\n apiKey: string;\n query: Query | string;\n}\n/**\n * Interface representing the response from the SortXYZ API.\n */\nexport interface SortXYZBlockchainAPIResponse {\n code: number;\n data: {\n durationMs: number;\n id: string;\n query: string;\n records: Record<string, unknown>[];\n recordCount: number;\n };\n}\n/**\n * Class representing a document loader for loading data from the SortXYZ\n * blockchain using the SortXYZ API.\n * @example\n * ```typescript\n * const blockchainLoader = new SortXYZBlockchainLoader({\n * apiKey: \"YOUR_SORTXYZ_API_KEY\",\n * query: {\n * type: \"NFTMetadata\",\n * blockchain: \"ethereum\",\n * contractAddress: \"0x887F3909C14DAbd9e9510128cA6cBb448E932d7f\".toLowerCase(),\n * },\n * });\n *\n * const blockchainData = await blockchainLoader.load();\n *\n * const prompt =\n * \"Describe the character with the attributes from the following json document in a 4 sentence story. \";\n * const model = new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0.9 })\n * const response = await model.invoke(\n * prompt + JSON.stringify(blockchainData[0], null, 2),\n * );\n * console.log(`user > ${prompt}`);\n * console.log(`chatgpt > ${response}`);\n * ```\n */\nexport declare class SortXYZBlockchainLoader extends BaseDocumentLoader {\n readonly contractAddress: string;\n readonly blockchain: string;\n readonly apiKey: string;\n readonly queryType: string;\n readonly sql: string;\n readonly limit: number;\n constructor({ apiKey, query }: SortXYZBlockchainLoaderParams);\n /**\n * Method that loads the data from the SortXYZ blockchain based on the\n * specified query parameters. It makes requests to the SortXYZ API and\n * returns an array of Documents representing the retrieved data.\n * @returns Promise<Document[]> - An array of Documents representing the retrieved data.\n */\n load(): Promise<Document[]>;\n}\n//# sourceMappingURL=sort_xyz_blockchain.d.ts.map"],"mappings":";;;;;;;AAOA;AAUA;AAOA;AAoCqBM,UArDJJ,KAAAA,CAqDII;EAOHC,IAAAA,EAAAA,aAAAA,GAAAA,oBAAAA;EAAQC,eAAAA,EAAAA,MAAAA;EAASL,UAAAA,EAAAA,UAAAA,GAAAA,SAAAA,GAAAA,QAAAA;EAOfH,KAAAA,CAAAA,EAAAA,MAAAA;;;AAdmD;;;UA3CtDG,6BAAAA;;SAEND;;;;;UAKME,4BAAAA;;;;;;aAMAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8BIC,uBAAAA,SAAgCL,kBAAAA;;;;;;;;;;KAOlBE;;;;;;;UAOvBM,QAAQT"}