https://github.com/priyanshupz/minds_sdk
The MindsClient Dart SDK allows developers to easily interact with the MindsDB API for managing minds, datasources, and completions. This SDK provides a structured way to make API requests using the Dio HTTP client while offering robust error handling and logging through the logging package.
https://github.com/priyanshupz/minds_sdk
dart mindsdb sdk
Last synced: about 1 month ago
JSON representation
The MindsClient Dart SDK allows developers to easily interact with the MindsDB API for managing minds, datasources, and completions. This SDK provides a structured way to make API requests using the Dio HTTP client while offering robust error handling and logging through the logging package.
- Host: GitHub
- URL: https://github.com/priyanshupz/minds_sdk
- Owner: PriyanshuPz
- License: other
- Created: 2024-10-05T17:02:47.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-07T16:24:49.000Z (over 1 year ago)
- Last Synced: 2025-05-12T03:52:08.252Z (about 1 year ago)
- Topics: dart, mindsdb, sdk
- Language: Dart
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Minds Dart SDK
The `MindsClient` Dart SDK allows developers to easily interact with the MindsDB API for managing minds, datasources, and completions. This SDK provides a structured way to make API requests using the `Dio` HTTP client while offering robust error handling and logging through the `logging` package.
## Features
- **Mind Management**: Create, update, delete, and fetch details of Minds from MindsDB.
- **Datasource Management**: Create, update, delete, and fetch Datasources linked to MindsDB.
- **Chat Completion**: Integrate with chat completions API for natural language processing.
- **Error Handling & Logging**: Comprehensive error handling and logging using `Dio` and `Logger`.
## Getting Started
### Prerequisites
Before you can start using the SDK, you'll need:
- A valid MindsDB API Key
- A project set up in Dart or Flutter
### Installation
To install the SDK, add the following to your `pubspec.yaml` file:
```yaml
dependencies:
minds_sdk:
git: https://github.com/priyanshuverma-dev/minds-sdk.git
```
Then, install it by running:
```bash
flutter pub get
```
## Usage
Below is a simple example of how to use the `MindsClient` to interact with the MindsDB API.
```dart
import 'package:minds_sdk/minds_sdk.dart';
void main() async {
final sdk = MindsClient(apiKey: 'your_api_key_here');
// Fetch a list of minds
try {
final minds = await sdk.minds.list();
print("Fetched ${minds.length} minds.");
} catch (e) {
print("Error fetching minds: $e");
}
// Create a new mind
try {
await sdk.minds.create(name: 'TestMind');
print("Mind created successfully.");
} catch (e) {
print("Error creating mind: $e");
}
}
```
## Features
1. **Minds Management**
- Fetch all minds
- Get a specific mind by name
- Create, update, and delete minds
2. **Datasources Management**
- List all datasources
- Get datasource by name
- Add and delete datasources from minds
3. **Completions API**
- Use natural language processing with chat completions
## Example
For more comprehensive examples, check the `/example` folder in this repository.
```dart
import 'package:minds_sdk/minds_sdk.dart';
void main() async {
final sdk = MindsClient(apiKey: 'your_api_key');
// Fetch a specific mind
final mind = await sdk.minds.get(name: 'TestMind');
if (mind != null) {
print('Fetched mind: ${mind.name}');
}
}
```
## Error Handling
The SDK has built-in error handling for various HTTP issues, such as:
- **Connection Timeout**
- **Receive Timeout**
- **Bad Responses** (e.g., 4xx and 5xx errors)
- **Network Issues** (e.g., DNS errors, no internet)
All errors are logged using the `Logger` package for easy debugging.
## Additional Information
This SDK is currently under active development. Contributions are welcome!
- File issues on the [GitHub repository](https://github.com/priyanshuverma-dev/minds-sdk/issues).
- Please ensure you have read the contributing guidelines before submitting a pull request.
- For any inquiries or feature requests, feel free to open a discussion or contact the package authors.
## License
This package is licensed under the MIT License. See the `LICENSE` file for more details.