An open API service indexing awesome lists of open source software.

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.

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.