slangit_ragaas 1.0.6 copy "slangit_ragaas: ^1.0.6" to clipboard
slangit_ragaas: ^1.0.6 copied to clipboard

Slangit RAG as a service

Slangit RAGAAS #

A Flutter package that provides Retrieval-Augmented Generation as a Service (RAGAAS) through Slangit's conversational AI platform. This package allows Flutter applications to quickly implement knowledge-powered chat interfaces that can answer questions based on your corpus of information.

Features #

  • Conversational Interface: Ready-to-use chat UI with customizable theming
  • Knowledge-Based Responses: Answers user queries based on your knowledge corpus
  • Simple Configuration: Implement with just a few lines of code
  • Fully Customizable: Extensive theming options to match your app's design
  • Authentication: Secure access to your knowledge base
  • Floating Action Button Integration: Easy to add to any existing app

Getting Started #

Prerequisites #

  • Flutter SDK 2.5.0 or higher
  • Dart 2.14.0 or higher
  • A valid Slangit RAGAAS account with:
    • A corpus ID
    • An authentication token

Installation #

Add the package to your pubspec.yaml file:

dependencies:
  slangit_ragaas: ^1.0.0

Run the following command to install the package:

flutter pub get

Usage #

Basic Implementation #

Add the SlangitConversation widget to your app:

import 'package:flutter/material.dart';
import 'package:slangit_ragaas/slangit_ragaas.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Slangit RAGAAS Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: Scaffold(
        floatingActionButton: SlangitConversation(
          spaceId: YOUR_SPACE_ID,
          token: "YOUR_TOKEN",
        ),
        body: Center(
          child: Text('Your App Content Here'),
        ),
      ),
    );
  }
}

Customizing the Theme #

The widget supports extensive theming options:

SlangitConversation(
  spaceId: YOUR_SPACE_ID,
  token: "YOUR_TOKEN",
  theme: ThemeData(
    // Customize loading spinner color
    progressIndicatorTheme: ProgressIndicatorThemeData(
      color: Color(0xFF008182),
    ),
    // Set primary colors
    colorScheme: ColorScheme.fromSeed(
      primary: Color(0xFF008182),
      surface: Color(0xFF008182),
      onSurface: Colors.white,
      seedColor: Color(0xFF008182),
    ),
    // Customize switch appearance
    switchTheme: SwitchThemeData(
      trackColor: WidgetStateProperty.all(Color(0xFF008182)),
      thumbColor: WidgetStateProperty.all(Colors.white),
      trackOutlineColor: WidgetStateProperty.all(Colors.white),
    ),
    // Style icon buttons
    iconButtonTheme: IconButtonThemeData(
      style: IconButton.styleFrom(
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(10),
        ),
        padding: EdgeInsets.all(15),
        backgroundColor: Color(0xFF008182),
        foregroundColor: Colors.white,
      ),
    ),
    // Floating action button appearance
    floatingActionButtonTheme: FloatingActionButtonThemeData(
      backgroundColor: Color(0xFF008182),
      foregroundColor: Colors.white,
    ),
    // Text styling
    textTheme: TextTheme(
      bodyLarge: TextStyle(
        color: Color(0xFF008182),
        fontSize: 20,
        fontWeight: FontWeight.bold,
      ),
      bodyMedium: TextStyle(
        color: Color(0xFF008182),
        fontSize: 16,
        fontWeight: FontWeight.normal,
      ),
    ),
    useMaterial3: true,
  ),
)

Authentication #

The package uses API key for authentication:

SlangitConversation(
  spaceId: number,
  token: "", // Your token
)

Support #

If you encounter any issues or have questions:

License #

This package is available under the MIT License. See the LICENSE file for more information.