Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 2.45 KB

README.md

File metadata and controls

81 lines (60 loc) · 2.45 KB

VamboAI

Pub Version GitHub Twitter/X style: very good analysis License: MIT

VamboAI is a Dart package that provides access to the Vambo AI API for language identification and translation. This package allows you to interact with the Vambo AI API in a simple and efficient manner.

Features

  • Identify the language of a given text.
  • Translate text between various supported languages.
  • Supports a wide range of languages commonly used in Africa and beyond.

Installation

Add vamboai to your pubspec.yaml:

dependencies:
  vamboai: ^0.0.1

Then run:

dart pub get

Usage

Import the vamboai package:

import 'package:vamboai/vamboai.dart';

Create an instance of VamboAI using your API key:

void main() async {
  final ai = VamboAI.fromAPIKey('your_api_key');

  // Identify the language of a given text
  final response = await ai.identify('Hello, how are you?');
  print('Primary Language: ${response.primary.name}');
  print('Additional Languages: ${response.additional.map((lang) => lang.name).join(', ')}');

  // Translate text from English to French
  final tResponse = await ai.translate(
    'Hello, how are you?',
    from: Language.english,
    to: Language.french,
  );
  print('Translation: ${translateResponse.output}');
}

Error Handling

All errors from the Vambo AI API are thrown as VamboException.

try {
  final response = await vambo.identify('Some text');
} catch (e) {
  print(e); // Handle the exception
}

Contributing

Contributions to the VamboAI library are welcome. Please feel free to fork the repository, make your changes, and submit a pull request.

License

This library is distributed under the MIT License. See the LICENSE file in the repository for more information.