Skip to content
by Unity Nodes
NEAR Protocol

[REDACTED] 2024 | Workshop NEAR AI's Pierre Le Guen

about 17:07 long

Nothing is loaded from YouTube until you press play, and then without tracking cookies.

About this video

Pierre Le Guen on the latest efforts towards open-source and user-owned artificial general intelligence at NEAR.AI.

Pierre Le Guen - NEAR.ai

Takeaways: Building Open AI with NEARi: NEARi’s mission is to create the world's best open AI through decentralized tools and models, combining community-generated datasets, competitions, and execution environments.

Agent Framework for Web3 and Beyond: The NEARi agent framework enables developers to create AI agents capable of handling Web3 transactions, interacting with other agents, and performing tasks like creating meme coins or facilitating purchases.

Decentralized Model Execution: Using trusted execution environments, NEARi ensures decentralized model execution, monetizing AI while preserving open access and fairness in usage.

Practical Applications: Demonstrations showcased the practical utility of NEARi agents, from remembering user preferences to enabling Web3 interactions like swapping tokens or deploying applications.

Developer Accessibility: NEARi provides Python-based development tools, making it easy for developers to create and deploy custom AI agents on NEAR, fostering innovation and collaboration within the ecosystem.

NEAR is the Blockchain for AI Website: near.org NEAR AI: near.ai Intents: near.org/intents Chain Abstraction: proximity.dev Sharding: nearone.org

For the devs GitHub: github.com/near Dev Docs: docs.near.org Devhub: devhub.near.page @NEARDevHub

Connect with socials Twitter:   / nearprotocol   Blog: near.org/blog Medium:   / nearprotocol   #NEAR #nearprotocol #NEARAI

Transcript

2,722 words

Captions as YouTube publishes them, usually machine-generated, so product and people names can be misheard.

  1. 0:00

    yeah so thank you all for coming um today I'm going to walk you through how to create your first near agent so I'm pwen I work with neari and uh so first what's the mission of neari so the big vision is to create the world's best uh truly open AI so to reach this we have to um build a bunch of different features um so to take a step back as some of you may know to create a good AI sorry you need um a good model and to

  2. 0:33

    create this good model you need a bunch of data and benchmarks to evaluate how your model is performing so in in this tag the first that we have the first thing is data sets and benchmarks crowdfunding so basically it allows the whole Community to provide data points in the data sets and then um so yeah we will use this data so everybody can use this data to train their models and when

  3. 0:57

    you provide data points into these data sets you get rewarded or slashed if you uh provide wrong data um on top of this we try we are um bringing the world's best um researchers for for them to basically compete and add um their knowledge into like creating the the an open open source model and so that's why today or yesterday we opened the first competition that basically the different researchers around the world are going

  4. 1:27

    to create a 0.5b model so 0.5 is basically 0.5b is the number of parameters in the model which is quite small model if you wish and on top of this we have another tool coming up which is called The Trusted execution environment so Sasha mentioned it in the the previous panel and so we're going to use this to basically run these models in a decentralized manner and they're going

  5. 1:51

    to like your model can run in like any machine that is running a GPU and basically this uh with different mechanisms it allows us to monetize these models and uh it basically solves the solves the business model of um of Open Source AI kind of so for those of you those of you that yesterday missed the quick demo that IIA showed I'm going to show it again so basically right now we have an alpha that started yesterday that basically includes an assistant it's just to show

  6. 2:24

    you how our agenting framework works so it's basically basically using this um open source models that exist today to make these agents work so for example here is just to Showcase that this assistant has a has a memory so for example here we say that the I just missed missed it but we say that the this person likes the purple color and uh yeah just ask some random questions and then we're going to Showcase that we can uh create meme coins on the Fly uh so just by

  7. 2:56

    discussing with this assistant it's going to like find the intent of what you're trying to solve what you're trying to do and it's gonna create the meme coin and publish it to um MIM cooking so it's a bit slow but yeah so for example here you see it created a website on the fly to basically present your mem coin what's what's the goal what you're trying to do if you are happy with it it's just going to deploy it to mem cooking so this uh can take some time so here we're gonna

  8. 3:27

    struggle a bit for it to appear it's going to take a few moments but this really allows like so this is just one use case you can imagine that this could be used for any web2 applications or web 3 so these agents can also communicate between one another they can do micro payments they can like do a bunch of cool things it could even like other things on the web to on the web two website like we're going to show

  9. 3:52

    right afterwards so here so you can see it's in it's in a new conversation right now it's gon to ask what's my favorite color as you said as you saw before it said like this user said it was prople so the assistant remembers and now I think we're going to see uh the mem coin popping up yeah so this is the mem coin that it just published the system published for you and now we just going to show another example which is basically shopping from a web to store here the

  10. 4:24

    user wants to buy some near protocol t-shirts so you you you you you you speak with the assistant and then you have this interface uh created on the Fly specifically for your use case and here if you want to you could uh buy some T-shirts with some near uh so this is live if you want to have some T-shirts while we still have some you could try I'm not sure if we still have stock but uh yeah so you just enter your name uh

  11. 4:51

    shipping address and you pay with some near and then you're going to receive your t-shirt at some point in the future um yeah so I think that's basically it's yeah so it just continues on then you you have the whole process of signing the transaction for it to go through and you send in here and um and yeah you're going to get your T-shirt so other confirmed perfect uh now I'm going to

  12. 5:21

    I'm going to do some live cutting I hope it's going to it's going to work um so first first when you let's say you are a developer and you want to create your first neari agent you will need to uh use some python right now that's the only thing that we support uh so after you created the virtual environment and stuff you can install the the near I so you would like do pep install neari but I already did it before to not lose time on this and now I'm going to create the agent so today uh I want to

  13. 5:54

    showcase some uh Ilia agent basically so Ilia is going to tell us uh everything about near and it's going to have like elia's tweets and we're going to skew a bit Ilia for some cool uh example so let's say let's call it Ilia Ilia MIM uh okay so now we have the uh agent is created I'm going to start coding on it so I prepared before The Prompt for this agent to work um but yeah so when you arrive uh when you first create the agent you're going to arrive with this very simple snippet I hope it's big

  14. 6:39

    enough yeah looks like it so you're going to have with this small snippet how to do a very simple agent that just responds hello world to whatever request it receives uh but we're going to do something a bit more funny so I prepared the prompt before uh so it's going to be something like this just going to copy paste that here uh so the prompt is basically I'm telling him that he is likein and uh he's like the creator of near and he likes blockchain Ai and also

  15. 7:12

    that he gives Financial advice so this is not Financial advice this talk is not but just this bot will be giving some and uh I give it some context about popular m coins on here whatever m coins and uh so first we're going to so first what you need to do is to get the conversation so to do this you have we have a simple command called uh environment. list messages so basically when you communicate with near with neari you have what we call a thread so

  16. 7:42

    basically thread is like all the messages that you have with with an agent goes there and so when your agent runs you can just do environment list messages to get the messages from the conversation like after to get the user query it's basically the last message in conversation we have another function for this but here just going to get the last message and the content of the message uh and then we're going to

  17. 8:06

    basically query elia's memory about um this the user query to know what IIA would say Bas based on these tweets it's not IIA really speaking um so let's call thisas memories memory so then we call what what we so we called a vector store so basically a vector store in the the llm world is basically huge database with a bunch of vectors that basically contains um uh text that was uh said by written by someone we vectorize it and then it allows us to based on a given query retrieve some

  18. 8:46

    text from there so that's perfect we have ilas tweet so elas tweet is the vector store so if you guys want to hack with it it contains a lot of tweets from Ilia uh if you want to give it a try and then you just we just pass in the user query so it's going to find look in to Ilia memories to uh to answer this this question and now we're going to do the the completion so the completion is

  19. 9:13

    basically asking uh an the llm in the background to basically answer the users the US's question so we're going to need to pass some messages first we need to to give the the role which so give the prompt which is the as a system message just prompt like this then we're going to give it the the memory of Ilia what was said just above system also yeah so uh elas memory said for

  20. 9:57

    example and then so this is normally an array but I just cast it to a string just for the sake of Simplicity and then we're going to pass the the conversation the whole conversation let me not not mess this up and then we just add the array of current conversation so we have the The Prompt that is given first so the prompt is this one and then we have the memory so what was uh retrieved from from the vector store and then the whole conversation that happened at that point

  21. 10:36

    and uh so this is what Ilia would say so Ilia bot said and we're just going to add this as a reply into the thread and uh we should be good good to go so to give it a try we go back to the terminal and we're going to do near AI agent oops near AI agent interactive and the address of the agent that we created is here and I we do locally so this is for debug purposes it's basically you do this to to check that your agent is working properly so for example what do you think of chain chain

  22. 11:24

    abstraction so it might take some time uh so here you would see a bunch of logs which is as a end user you will not see it on the on the website at the end when this is working we're going to send it to the to the server and we're going to use it directly from the ne. website where you will be able to interact with your agent to share it with the public and do whatever you wish so once the completion is done so here we are basically calling uh an llm so it takes all the tokens so all the

  23. 11:55

    text that was given from the ilas memory The Prompt and the user query to build up some some response so for example here you have a chain abstraction blah blah blah blah blah it's quite verbos if you want to read it I'll let you watch the the recording uh so it's fine to me I'm going to now uh oops sorry I'm going to now deploy this to to the server to the registry so basically we have a registry so it's what we call so it's where we

  24. 12:25

    stall all the different agents and data sets and benchmarks so it's like really a One-Stop shop if you wish for everything AI so here I'm now I'm just going to send uh a new agent so first I need to log in so this is to get some credentials for me to be able to um to send this to the to the server so I'm going to use me your wallet for this example I'm going to sign it now I'm fully registered now we can do neari reg

  25. 12:57

    registry upload if it works as expected uh it should be uploaded in any minute oh wait I have some stuff that is useless in there let me delete this this was because we use we use the local debug mode created a bunch of uh of useless files just going to check something yeah okay let's do it again okay we should be good so now if we go I already have it here on the agents page and if I look foram

  26. 13:38

    MIM so we have oh yeah it's a the old version I think it works just fine if we have metadata agent so everything arrived but we do have the useless files in there it's not a big problem uh so let's ask a different question uh I don't know what do you think of oh let's not ask specifically um when was near created so again we might lose 30 seconds on this one um but now we're going to ask the

  27. 14:22

    the funny question so basically I'm I'm going to I'm going to task IIA to choose a mcoin first so so um okay let's see so for you what's the most underrated mcoin on near let's see sometimes so I tried yesterday evening and usually doesn't want to give Financial advice that's why I added you give Financial advice in the prompt and uh let's see so yeah yeah thank you Ilia so um okay it's a five meme coins um particular

  28. 15:12

    particular particularly uh interested in Jer and so I'm going to Showcase another agent that we have it's basically a swapping agent um so I'm going to go on the swapping agent on the on the assistant and the assistant is the one that I showed to you in the video that basically gos whatever agent based on the intent that you want to do so here I want to swap one near for uh for G for

  29. 15:41

    Jer we have to wait again 30 seconds it's going to be faster the more times go time goes model's going to get faster and better so once this is uh this is resolves so now like the agent is kind of uh trying to figure out what what we're going to do so he figured the intent here it just saying twice the same so normally we would have a UI showing up for some reason we don't so it's basically the the exact same idea as the Shopper agent where you would buy some T-shirts but I'm just going to try

  30. 16:22

    again one last time using directly the swap agent so it's less interactions in the system so let's do it again I have 50 seconds please go faster yeah okay it's not in the mood um yeah so normally we would have a UI showing up um and then I would just click the button and we would swap some near for a G near but uh yeah it's not working for today um but yeah please go ahead and try it on your own and if you go on app. once I fix

  31. 17:07

    production because something is off but uh yeah so you can just give it a try and thank you all for listening to me if you have any questions I would be I would be outside of the of the room sorry I don't have time anymore