Note
A powerful and intuitive Dart SDK for interacting with the Minds AI API. Seamlessly integrate machine learning capabilities into your Dart applications!
- π Features
- πͺ Installation
- π Getting Started
- π API Reference
- π Usage Examples
- π€ Contributing
- π License
-
π Secure API Authentication
Safeguard your application with cutting-edge authentication methods that ensure your connection to the Minds API remains protected and confidential. Experience peace of mind while accessing advanced AI functionalities. -
π Intuitive Data Source Management
Easily manage and configure your data sources with sdk. Add, modify, or remove data connections effortlessly, allowing your AI models to access the most relevant and up-to-date information. -
π§ Tailored AI Model Creation (Minds AI)
Design bespoke AI models that suit your specific requirements. With our platform, you can create, customize, and optimize Minds that deliver personalized responses, making your applications smarter and more intuitive. -
π Effortless Minds API Integration
Experience a hassle-free integration with the Minds API, enabling you to tap into the full spectrum of AI capabilities quickly. Connect your systems and workflows seamlessly, enhancing your applicationβs functionality. -
π‘ Real-time Interaction Capabilities
Engage your users in real-time with interactive responses! Our real-time streaming support enables you to build applications that deliver immediate feedback, making conversations more dynamic and engaging. -
π¦ Modular Architecture
Benefit from a flexible, modular architecture that allows you to extend and customize the functionality of your application easily. Add new features and capabilities as your project evolves, ensuring long-term adaptability.
Add
mdb_dart
to your project!
dart pub add mdb_dart
Import the library and create a client:
import 'package:mdb_dart/mdb_dart.dart';
void main() async {
final client = Client('YOUR_API_KEY');
// Now you're ready to use the SDK!!!
}
Checkout
demo
code!
Property | Description |
---|---|
RestAPI api |
Instance for making API calls |
Datasources datasources |
Manages data sources |
Minds minds |
Manages minds (AI models) |
Method | Description |
---|---|
list() |
List all datasources |
get(String name) |
Get a specific datasource |
create(DatabaseConfig dsConfig, {bool replace = false}) |
Create a new datasource |
drop(String name) |
Delete a datasource |
Method | Description |
---|---|
Datasource({String name, String engine, String description, Map<String, dynamic>? connectionData, List<String>? tables}) |
Creates a new Datasource instance with required parameters name , engine , description , and optional connectionData , tables . Inherits from DatabaseConfig . |
fromJson(Map<String, dynamic> json) |
Creates a new Datasource instance from a JSON map. Inherited fields include name , engine , description , connectionData , and tables . |
toJson() |
Converts the Datasource instance into a JSON-compatible map. Inherited from DatabaseConfig . |
Method | Description |
---|---|
list() |
List all minds (AI models) |
get(String name) |
Get a specific mind (AI model) |
create({required String name, modelName, provider, promptTemplate, datasources}) |
Create a new mind |
drop(String name) |
Delete a mind |
Method | Description |
---|---|
update({String? name, modelName, provider, promptTemplate, datasources, parameters}) |
Updates the properties of the mind. |
addDatasource(dynamic datasource) |
Adds a new datasource to the mind. |
delDatasource(dynamic datasource) |
Deletes a specific datasource from the mind. |
completion(String message) |
Sends a chat message to the Mind API and retrieves a completion response. |
streamCompletion(String message) |
Streams chat completions from the Mind API based on a user's message. |
fromJson(Client client, Map<String, dynamic> json) |
Creates a new instance of Mind from a JSON map. |
toJson() |
Converts the Mind instance into a JSON map. |
Exception | Description |
---|---|
ObjectNotFound([String message = 'Object not found.']) |
Thrown when a requested object cannot be found. |
ObjectAlreadyExists([String message = 'Object already exists.']) |
Thrown when trying to create an object that already exists. |
ObjectNotSupported([String message = 'Object not supported.']) |
Thrown when an unsupported operation is attempted. |
Forbidden([String message = 'Access forbidden.']) |
Thrown when access is forbidden. |
Unauthorized([String message = 'Unauthorized access.']) |
Thrown when access is unauthorized. |
UnknownError([String message = 'An unknown error occurred.']) |
Thrown for unspecified errors. |
ValueError(String message) |
Thrown when a value is invalid or out of range. |
List<Datasource> datasources = await client.datasources.list();
for (var ds in datasources) {
print('Datasource: ${ds.name}');
}
final newDatasource = await client.datasources.create(
DatabaseConfig(
name: 'my_postgres_db',
engine: 'postgres',
description: 'My PostgreSQL Database',
connectionData: {
'host': 'localhost',
'port': 5432,
'user': 'username',
'password': 'password',
'database': 'mydb',
},
)
);
print('Created datasource: ${newDatasource.name}');
Datasource datasource = await client.datasources.get('my_postgres_db');
print('Datasource engine: ${datasource.engine}');
await client.datasources.drop('my_postgres_db');
print('Datasource deleted successfully');
List<Mind> minds = await client.minds.list();
for (var mind in minds) {
print('Mind: ${mind.name}');
}
final newMind = await client.minds.create(
name: 'my_predictor',
modelName: 'gpt-4o',
provider: 'openai',
promptTemplate: 'Predict the next value: {{input}}',
datasources: ['my_postgres_db'],
);
print('Created mind: ${newMind.name}');
Mind mind = await client.minds.get('my_predictor');
print('Mind model: ${mind.modelName}');
await client.minds.drop('my_predictor');
print('Mind deleted successfully');
Mind mind = await client.minds.get('my_predictor');
final completion = await mind.completion('What will be the stock price tomorrow?');
print('Prediction: ${completion.choices.first.message.content?.first.text}');
Mind mind = await client.minds.get('my_predictor');
final stream = await mind.streamCompletion('Explain quantum computing');
await for (var chunk in stream) {
print('Chunk: ${chunk.choices.first.delta.content?.first?.text}');
}
We welcome contributions to improve and expand the Minds AI Dart SDK! To get started with contributing, please follow the guidelines outlined in our CONTRIBUTING file.
This project is licensed under the Mozilla Public License 2.0
- see the LICENSE file for details.
If you find this project helpful, please give it a β on GitHub!
Warning
This repository is heavily influenced by the minds_python_sdk and mirrors its structure and functionality.