FLUTTER ECOSYSTEM

leo-elstin/chat_gpt

Dart言語で書かれたFlutterアプリ用のChatGPT SDK

chat_gpt のプロジェクト画像
Stars
6
Forks
6
最終プッシュ(UTC)
2023/10/22
プロジェクト状態
公開中
Leo Elstin GitHub avatar
GITHUB User

Leo Elstin ↗

Senior Mobile Engineer @Maersk-Global

@maersk-globalBangalore, India公式サイト ↗
言語Dart

技術トピック

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 2 件

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

ChatGPT SDK for Flutter

The chatGPT SDK written in dart to access the features of the OpenAI APIs

Features

  1. Text Completion
  2. Chat Completion
  3. Code Generation
  4. Image Generation

Getting started

chat_gpt: 2.0.0
flutter pub get

Usage

Create an instance of the ChatGPT

final chatGpt = ChatGPT.builder( token: '<token>');

You can generate the token from https://beta.openai.com/account/api-keys

Additional information

#Text Completion : The completions endpoint can be used for a wide variety of tasks. More details : https://beta.openai.com/docs/guides/completion

How to write the prompts https://beta.openai.com/docs/guides/completion/prompt-design

Method to do code completion / code completion

    const prompt = "Explain Quantum Computing in simple terms";

    Completion? completion = await chatGpt.textCompletion(
      request: const CompletionRequest(
        prompt: prompt,
        maxTokens: 256,
      ),
    );

    print(completion?.choices);

#Image generation : The image generations endpoint allows you to create an original image given a text prompt. More Details : https://beta.openai.com/docs/guides/images/introduction

Supported Image Generation Types

  1. Creating images from scratch based on a text prompt
  2. Creating edits of an existing image based on a new text prompt
  3. Creating variations of an existing image

Sample Code to generate the image

    Images? images = await chatGpt.generateImage(
      request: const ImageRequest(
        prompt: 'A cute baby sea otter',
      ),
    );

    print(images?.data);

Catch me up on LinkedIn @Leo Elstin

💙 to Code 👨 🏽‍💻 Full Stack Mobile Developer [ Flutter, Native, Spring Boot ]