openai_package 1.0.7 copy "openai_package: ^1.0.7" to clipboard
openai_package: ^1.0.7 copied to clipboard

Dart SDK for openAI Apis (Chat & Image & Transcription & Voice and Embeddings), integrate OpenAI products into your Flutter application.

example/openai_package_example.dart

// ignore_for_file: unused_local_variable

import 'package:openai_package/openai_package.dart';
import 'package:openai_package/src/openai/import/importAi.dart'; //  you must add

void main() {
  // Initialize OpenAI instance
  OpenAI.apiKey = 'your-api-key';

  // Define previous messages
  List<Message> messages = [
    Message(role: 'system', content: 'Hello, how can I assist you today?')
  ];

  OpenAI openAi = OpenAI();

  // Generate response
  Future<OpenAIChatMessage> response = openAi.chat(
    messages: messages,
    // for old version prompt: 'I need help with a programming problem.',
    maxTokens: 150,
    temperature: 0.7,
    n: 1,
    stream: false,
  );
print(response.toString());

}
3
likes
150
points
50
downloads

Publisher

verified publishermarijua.business

Weekly Downloads

Dart SDK for openAI Apis (Chat & Image & Transcription & Voice and Embeddings), integrate OpenAI products into your Flutter application.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

AGPL-3.0 (license)

Dependencies

http, http_parser, path

More

Packages that depend on openai_package