Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFT Evaluator #210

Open
IkigaiLabsETH opened this issue Dec 19, 2024 · 0 comments
Open

NFT Evaluator #210

IkigaiLabsETH opened this issue Dec 19, 2024 · 0 comments
Assignees

Comments

@IkigaiLabsETH
Copy link
Owner

To use evaluators from the Eliza framework in the context of adding knowledge about curated NFT collections to your AI agent, you can create a custom evaluator that assesses and extracts relevant information from NFT-related conversations. Here's how you can implement this:

Custom NFT Evaluator

Create a new evaluator specifically for NFT collections:

import { Evaluator, IAgentRuntime, Memory, State } from "@ai16z/eliza";

const nftCollectionEvaluator: Evaluator = {
  evaluate: async (runtime: IAgentRuntime, message: Memory, state: State) => {
    const content = message.content.toLowerCase();
    
    // Extract relevant NFT information
    const extractedInfo = {
      mentionsCollection: content.includes("collection") || content.includes("nft"),
      mentionsFloorPrice: content.includes("floor price") || content.includes("floor"),
      mentionsVolume: content.includes("volume") || content.includes("trading volume"),
      mentionsRarity: content.includes("rare") || content.includes("rarity"),
    };

    // Update state with extracted information
    return {
      ...state,
      nftKnowledge: {
        ...state.nftKnowledge,
        ...extractedInfo,
      },
    };
  },
};

Integration with AgentRuntime

Register the NFT collection evaluator with the AgentRuntime:

runtime.registerEvaluator(nftCollectionEvaluator);

Enhancing Agent Responses

Use the evaluated information to enhance the agent's responses:

const enhanceResponse = (response: string, state: State) => {
  const { nftKnowledge } = state;

  if (nftKnowledge.mentionsCollection) {
    response += " Would you like to know more about specific NFT collections?";
  }

  if (nftKnowledge.mentionsFloorPrice) {
    response += " I can provide information on floor prices for popular collections.";
  }

  if (nftKnowledge.mentionsVolume) {
    response += " I can share recent trading volume data for NFT collections.";
  }

  if (nftKnowledge.mentionsRarity) {
    response += " I can explain rarity factors in NFT collections if you're interested.";
  }

  return response;
};

By implementing this custom evaluator, your Eliza agent will be able to assess NFT-related content in conversations, extract relevant information, and use that knowledge to provide more informed and context-aware responses about NFT collections[7][8].

Citations:
[1] https://ai16z.github.io/eliza/docs/core/evaluators/
[2] https://aclanthology.org/2024.emnlp-industry.18.pdf
[3] https://www.betterevaluation.org/frameworks-guides/evaluation-career-guide/what-career-evaluation-looks/types-roles-evaluation
[4] https://www.bee.com/es/36100.html
[5] https://www.cdc.gov/mmwr/volumes/73/rr/rr7306a1.htm
[6] https://www.youtube.com/watch?v=jksX0KwmPXs
[7] https://ai16z.github.io/eliza/docs/core/evaluators/
[8] https://ai16z.github.io/eliza/docs/core/agents/
[9] https://www.youtube.com/watch?v=nux0NkxBgC0
[10] https://www.youtube.com/watch?v=xmlsILjX23s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants