Skip to content

Wiki Plugin

The Wiki Plugin enables your agent to retrieve blockchain knowledge from IQ.Wiki

Terminal window
npm i @iqai/agent @iqai/plugin-wiki

Hereโ€™s a complete example of setting up an agent with the Wiki plugin:

import { AgentBuilder, ModelProviderName } from "@iqai/agent";
import { createWikiPlugin } from "@iqai/plugin-wiki";
async function main() {
// Initialize Wiki plugin
const wikiPlugin = await createWikiPlugin();
// Create agent with plugin
const agent = new AgentBuilder()
.withModelProvider(
ModelProviderName.OPENAI,
process.env.OPENAI_API_KEY
)
.withPlugin(wikiPlugin)
.build();
await agent.start();
}
main().catch(console.error);
  • Wiki Retrieval: Get specific wiki articles by ID
  • User Created Wikis: Get wikis created by a specific user
  • User Edited Wikis: Get wikis edited by a specific user
  • User Wiki Activities: Get all wiki activities (both creations and edits) by a specific user
  • Time-Filtered Activities: Filter any of the above operations by time range
OperationExample Query
Get WikiShow me the wiki for bitcoin
User Created WikisShow wikis created by user 0x8AF7a19a26d8FBC48dEfB35AEfb15Ec8c407f889
User Edited WikisShow edited wikis by user 0x8AF7a19a26d8FBC48dEfB35AEfb15Ec8c407f889
User Wiki ActivitiesShow me wiki activities for 0x8AF7a19a26d8FBC48dEfB35AEfb15Ec8c407f889
Time-Filtered ActivitiesShow wiki activities for 0x8AF7a19a26d8FBC48dEfB35AEfb15Ec8c407f889 in last 24 hours

Query:

Get me wiki on ai meme hub

The agent will process this to:

{
"id": "ai-meme-hub",
}

Response will be formatted as:

๐Ÿ“œ Wiki Details
- Title: AI Meme Hub
- Summary: AI Meme Hub is a decentralized platform for creating and sharing AI-generated memes...
๐Ÿ”— Source: https://iq.wiki/ai-meme-hub
๐Ÿ”— Transaction: https://polygonscan.com/tx/0x123...

Query:

Get me wikis created by 0x9130241234123434

The agent will process this to:

{
"id": "0x9130241234123434"
}

Response will be formatted as:

๐Ÿ“œ Wiki Created
- Title: Ethereum
- Summary: Ethereum is a decentralized platform...
- Created: 5/5/2023, 11:03:26 PM
๐Ÿ”— Source: https://iq.wiki/ethereum
๐Ÿ”— Transaction: https://polygonscan.com/tx/0x456...
๐Ÿ“œ Wiki Created
- Title: Solana
- Summary: Solana is a high-performance blockchain...
- Created: 5/4/2023, 10:15:42 AM
๐Ÿ”— Source: https://iq.wiki/solana
๐Ÿ”— Transaction: https://polygonscan.com/tx/0x789...

Query:

Show me edited wikis by 0x9130241234123434

The agent will process this to:

{
"id": "0x9130241234123434"
}

Response will be formatted as:

๐Ÿ“œ Wiki Edited
- Title: Bitcoin
- Summary: Bitcoin is a decentralized digital currency...
- Edited: 5/6/2023, 1:26:58 AM
- Changes: 52 words (21.36%)
- Modified sections: content, tags
๐Ÿ”— Source: https://iq.wiki/revision/0f9ed751-f46a-40f7-af56-a54cc8951754
๐Ÿ”— Transaction: https://polygonscan.com/tx/0xabc...

Query:

Show me wiki activities for 0x9130241234123434

The agent will process this to:

{
"id": "0x9130241234123434"
}

Response will include both creations and edits:

๐Ÿ“œ Wiki Edited
- Title: Bitcoin
- Summary: Bitcoin is a decentralized digital currency...
- Edited: 5/6/2023, 1:26:58 AM
- Changes: 52 words (21.36%)
- Modified sections: content, tags
๐Ÿ”— Source: https://iq.wiki/revision/0f9ed751-f46a-40f7-af56-a54cc8951754
๐Ÿ”— Transaction: https://polygonscan.com/tx/0xabc...
๐Ÿ“œ Wiki Created
- Title: Ethereum
- Summary: Ethereum is a decentralized platform...
- Created: 5/5/2023, 11:03:26 PM
๐Ÿ”— Source: https://iq.wiki/ethereum
๐Ÿ”— Transaction: https://polygonscan.com/tx/0x456...

Query:

Get me wiki activities by 0x9130241234123434 in last 24 hours

The agent will process this to:

{
"id": "0x9130241234123434",
"timeFrameSeconds": 86400
}

Always implement proper error handling when using the plugin:

try {
const wikiPlugin = await createWikiPlugin();
} catch (error) {
console.error('Failed to initialize Wiki plugin:', error);
}
  • ID Validation: Ensure wiki IDs are correctly formatted
  • User Address Format: Use complete Ethereum addresses
  • Time Filtering: Specify clear time periods for filtered results
  • Error Handling: Implement robust error handling for all operations
  • Wiki Not Found: Verify the wiki ID exists on IQ.Wiki
  • User Not Found: Ensure the Ethereum address is correct
  • No Recent Activities: The user may not have any wiki activities in the specified time period
  • API Connection: Check your network connection if requests fail