My name is Roman from Cactus and welcome to a quick start of, building your first Flutter app with on device in app.
00:09
AI.
00:10
We're going to get started from the repo here and as a first step we're going to clone the code and head over to the ide.
00:19
Now I'm going to assume that you have your local environment set up with XCODE or Android Studio.
00:24
So we're not going to go through that.
00:25
And let's just look at the layout of the repository.
00:29
So once you have it cloned, you will see that the layout is pretty simple.
00:31
We have all the source code and the library folder here.
00:35
But the easiest way to get started actually is to head over into the example app and just build an example project.
00:42
Once you're in the example project, you can just run a standard command, flutter clean and flutter pub, get and flutter run.
00:53
And this will build an example application that showcases pretty much every piece of Cactus functionality you can see.
00:59
Now I'm going to fast forward through the build and let's see what the app can do.
01:05
Once you have the app built, you will see a screen with a few examples of, cactus functionality.
01:12
So let's take a look at the pretty basic one which is streaming completion and see what it can do.
01:17
We're going to need to download the model first, which I already did ahead of time.
01:21
we'll initialize it and we will run a simple streaming example.
01:25
This gives you a sense of what completion looks like with token by token streaming.
01:30
Now to see how streaming completion is implemented, we can open the library folder, open the streaming completion file and walk through the implementation.
01:40
So first of all we initialize the lm, which is the cactus language model.
01:44
And the language model has a few methods.
01:47
First of all we cleanly unload it.
01:49
When we dispose of the widget, we download it which is necessary only once for every app or for every model you work with we initialize it, which we have to do before we run completion on the model.
02:04
And finally we have a method for generating a completion stream which creates a stream result object that we can iterate through and handle the token by token appearance.
02:15
That's how streaming completion happens.
02:19
Now, in addition to streaming completion, Cactus comes with other awesome building blocks like function calling, which you can use to build agentic workflows.
02:27
Hybrid completion, which lets you balance between local and cloud inference, fetching different models, running embedding, which is useful for things like vector search and semantic search.
02:38
you can use it for rag which also comes built in out of the box with Cactus with an option on device vector database.
02:45
And we also support speech to text, which is great for things like transcription.
02:48
And you can use that to build voice agents, for example.
02:51
Now, if by the time you build this app, your screen looks different to mine, don't worry, we ship, new features all the time, so that just means we added more functionality.
02:59
But you can use all of those building blocks and each of them lives in their own corresponding file so you can see how they're implemented and you can mix and match different functionality and yeah, let us know what you build with this.
03:11
Join our discord and we love feedback and hopefully speak to you soon.
03:17
Actually, one more thing before I sign off.
03:19
If we go to the pubspec file of the example app that we just built, you will see that the cactus dependency points to a local file path, which is basically the repo that we just installed.
03:30
In order to add Cactus to your own, app or to a new app that you're building, be sure to go to our docs on the website and follow the simple installation steps here.
03:40
That will make sure that you install a, fresh, version.
03:46
And one last thing I will say is Cactus also comes built in with some pretty powerful telemetry.
03:51
Now it's fully anonymized, but make sure you go over to the dashboard.
03:55
You can get to it by clicking this button here.
03:57
It'll take you to the dashboard.
03:59
And if you get a telemetry token, for your app and pop it into your local environment by following the, instructions here, you'll see that, we have a pretty powerful telemetry suite that lets you monitor things like active devices, daily activity, error rate, and do some of the diagnostics and telemetry that comes built in.
04:21
So make sure to use that.
04:22
It's on the dashboard.
04:23
And yeah, thanks for watching, thanks for using Cactus and speak to you soon.