Flutter Cohere
Cohere empowers every developer and enterprise to build amazing products and capture true business value with language AI.
This package provides a powerful bridge between your Flutter application and Cohere AI. It empowers you to seamlessly integrate Cohere's capabilities into your app, unlocking possibilities for building innovative, intelligent, and engaging experiences that redefine user interaction.
Package
Table of content
Features
Getting started
To use the Cohere API, you'll need an API key. If you don't already have one, create a key in Cohere's official website. Get an API key.
Installation
Add flutter_cohere
as a dependency in your pubspec.yaml file.
dependencies:
flutter_cohere: ^0.0.1
Import
Import the package into your Dart code.
import 'package:flutter_cohere/flutter_cohere.dart';
Initialize Cohere
For initialization, you must call the CohereClient constructor for Flutter Cohere.
void myFunction() {
/// Add this line
var co = CohereClient(apiKey: '--- Your Cohere Api Key ---');
}
Content-based APIs
Text-only input
This feature lets you perform natural language processing (NLP) tasks such as text generation and completion.
var co = CohereClient(apiKey: '--- Your Cohere Api Key ---');
co.generate(
prompt: "Write a story about a magic backpack.",)
.then((value) => print( value.values.first )) /// or value?.values.first
.catchError((e) => print(e));
Multi-turn conversations (chat)
Using Cohere, you can build freeform conversations across multiple turns.
var co = CohereClient(apiKey: '--- Your Cohere Api Key ---');
co.chat([
{"role": "USER", "message": "Who discovered gravity?"},
{"role": "CHATBOT", "message": "The man who is widely credited with discovering gravity is Sir Isaac Newton"}
])
.then((value) => log(value.values.first ?? 'without output'))
.catchError((e) => log('chat', error: e));
Stream Generate Content
soon
embed
soon
embed-jobs
soon
rerank
soon
classify
soon
datasets
soon
summarize
soon
tokenize
soon
detokenize
soon
connectors
soon
Flutter Cohere widgets
soon