Introducing the LLM Canister: Deploy AI agents with a few lines of code

I noticed that as well. It happens a non-negligible number of times. I think this is a problem with the implementation of the sampler and not with the model itself. Looking into it.

Apart from the times where it returns gibberish, how did you find the model itself?

2 Likes

I think it works quite well for generating tweets based on a persona. Soon, we will start using them to analyze prediction markets, which will be a bit more challenging since they will need to estimate probabilities based on available data and compete.

1 Like

If a closed model is not possible, it would be nice to have DeepSeek working.

2 Likes

@Mar Done some changes, and I think now you shouldn’t be seeing gibberish anymore, or at least it should be way less probable now. We’ll have a more permanent solution to that problem very soon.

@marcio I’ve tried DeepSeek extensively, and it’s impressive. We’ll explore supporting one of their distilled versions.

4 Likes

Thanks for building this @ielashi!
We’ve just launched the “LlamaBot” within OpenChat which allows users to easily send prompts to the LLM canister!

9 Likes

How were you able to build a bot for openchat with it @ielashi

I built it, you can find the source code here - open-chat-bots/rs/offchain/examples/llama at main · open-chat-labs/open-chat-bots · GitHub

9 Likes

Quick update: we released a new example of an agent, just to showcase what it’s like to build an agent that specializes in a specific task. In this case, the task is to lookup ICP prices.

A Rust and a Motoko implementation are provided in the examples folder here.

6 Likes

Indeed, we need to use better models for this, as the difference in probability estimates is too large (compared to 4o, for instance).

Hey everyone,

I’d like to get some feedback here on what you think should be the highest priority for the LLM canister. There will be continuous work on all the topics below, but I’d like to gauge which one is the most important to you at this stage:

  • Support for more models (still centralized, managed by DFINITY)
  • Decentralizing the AI workers (models will no longer be managed centrally by DFINITY)
  • API improvements (e.g. support for tools, more tokens per request, images, etc.)
0 voters

Would love to hear also any comments you have wrt your choice.

2 Likes

I think supporting more models is the best choice in the near term. Then, we can spend more time decentralizing, plus we gain more time until open-source models catch up.

Thanks everyone for voting, I appreciate your input. I closed the poll now.

As I mentioned, we’ll be making progress across all three fronts, but this poll will definitely help with the prioritization.

Regarding bigger models: can you share which models you’d like to have access to? To allow for decentralization later on, we can only consider open weight models.


Regarding decentralizing the AI workers: I’ll start a separate thread about that, as it’s a bigger topic.


Regarding API improvements: We just released a typescript library to seamlessly integrate with Azle, so developers don’t need to learn Motoko or Rust to build AI agents on the IC. Checkout the quickstart example that can be used as a template for building agents in Typescript (cc @tiago89).

Prompting (single message)

import { IDL, update } from "azle";
import * as llm from "@dfinity/llm";

export default class {
  @update([IDL.Text], IDL.Text)
  async prompt(prompt: string): Promise<string> {
    return await llm.prompt(llm.Model.Llama3_1_8B, prompt);
  }
}

Chatting (multiple messages)

import { IDL, update } from "azle";
import { chat_message as ChatMessageIDL } from "azle/canisters/llm/idl";
import * as llm from "@dfinity/llm";

export default class {
  @update([IDL.Vec(ChatMessageIDL)], IDL.Text)
  async chat(messages: llm.ChatMessage[]): Promise<string> {
    return await llm.chat(llm.Model.Llama3_1_8B, messages);
  }
}
5 Likes

Thanks for this. Here is what I am using it for.

6 Likes

Very nice, I like the UX :slight_smile: I created an Anima and had a short conversation with it. Thanks for sharing. I recommend demoing this to the DeAI Technical Working Group so that more people from the community can also see it and provide feedback.

2 Likes

I second that! :slight_smile: cc @patnorris

1 Like

That’d be awesome, yes! Would you be open to sharing your work in one of the upcoming DeAI calls @swift ?

Sure :+1:. Just let me know where/when I can join.

1 Like

Hi @swift , the DeAI calls are each Thursday at 6pm CET in the ICP Discord voice channel. This should take you to this week’s event on Discord (and also show the time in your timezone): ICP

We’ve usually got an agenda for the call (and also for the next few calls) but leave a few minutes for new members to introduce themselves and what they are working on. So you could give a quick intro on one of the next calls and if you’re open to it, it’d be great to also have a dedicated session to showcase ANIMA during one of the calls in a few weeks, so there’s enough time for properly presenting it, discussion and questions (maybe one of the first Thursdays in May?). How does this sound to you?

1 Like

@patnorris Sounds fun, I am interested

1 Like

First, let me join everyone and congratulate you.

A useful LLM integration.

Three questions:

  • How large could the token output be in the future? 200 tokens now is very limited.
  • How large is the token input now, and any idea of the future?
  • Do you have plans to incorporate Llama 4? Any news or plans about it?

Thanks!

Joseph